From b3c433c7614e39d0dedcab2ef130bf6d0e291390 Mon Sep 17 00:00:00 2001 From: Kallen Tu Date: Wed, 23 Aug 2023 18:06:31 +0000 Subject: [PATCH] [linter] Add more const errors to hasConstError in the linter. More errors surfaced from the changes in https://dart-review.googlesource.com/c/sdk/+/319911. This CL allows them to be marked as const errors when we check that a constructor can be const-ified. Bug: https://github.com/flutter/flutter/issues/133152 Change-Id: Ic514fba9d544d5019ca76567be04738a5d5db768 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/322361 Reviewed-by: Brian Wilkerson Commit-Queue: Kallen Tu --- pkg/analyzer/lib/src/lint/linter.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/analyzer/lib/src/lint/linter.dart b/pkg/analyzer/lib/src/lint/linter.dart index dd55a696e748..d07161e21fea 100644 --- a/pkg/analyzer/lib/src/lint/linter.dart +++ b/pkg/analyzer/lib/src/lint/linter.dart @@ -974,11 +974,13 @@ class _ConstantAnalysisErrorListener extends AnalysisErrorListener { .CONST_CONSTRUCTOR_WITH_FIELD_INITIALIZED_BY_NON_CONST: case CompileTimeErrorCode.CONST_EVAL_EXTENSION_METHOD: case CompileTimeErrorCode.CONST_EVAL_METHOD_INVOCATION: + case CompileTimeErrorCode.CONST_EVAL_PROPERTY_ACCESS: case CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL: case CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL_INT: case CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL_NUM_STRING: case CompileTimeErrorCode.CONST_EVAL_TYPE_INT: case CompileTimeErrorCode.CONST_EVAL_TYPE_NUM: + case CompileTimeErrorCode.CONST_EVAL_TYPE_STRING: case CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION: case CompileTimeErrorCode.CONST_EVAL_THROWS_IDBZE: case CompileTimeErrorCode.CONST_EVAL_FOR_ELEMENT: