From f563d46dad53d9045a991bf81e421d0f4431ebc2 Mon Sep 17 00:00:00 2001 From: Franklin Oladipo Date: Thu, 24 Oct 2024 12:45:48 +0100 Subject: [PATCH 1/3] modify ASSIGNMENT_TO_CONST error message --- pkg/analyzer/messages.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/analyzer/messages.yaml b/pkg/analyzer/messages.yaml index a2edd39ecb84..c14a3d12cdf8 100644 --- a/pkg/analyzer/messages.yaml +++ b/pkg/analyzer/messages.yaml @@ -788,7 +788,7 @@ CompileTimeErrorCode: } ``` ASSIGNMENT_TO_CONST: - problemMessage: "Constant variables can't be assigned a value." + problemMessage: "Constant variables can't be re-assigned a value." correctionMessage: "Try removing the assignment, or remove the modifier 'const' from the variable." hasPublishedDocs: true comment: No parameters. From 6984375ec0ffb10e6187a704fee7e7d60bb2c2a7 Mon Sep 17 00:00:00 2001 From: "franklin.oladipo" Date: Wed, 6 Nov 2024 19:10:40 +0000 Subject: [PATCH 2/3] change ASSIGNMENT_TO_CONST error message --- pkg/analyzer/messages.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/analyzer/messages.yaml b/pkg/analyzer/messages.yaml index c14a3d12cdf8..71bdfbd82f19 100644 --- a/pkg/analyzer/messages.yaml +++ b/pkg/analyzer/messages.yaml @@ -788,7 +788,7 @@ CompileTimeErrorCode: } ``` ASSIGNMENT_TO_CONST: - problemMessage: "Constant variables can't be re-assigned a value." + problemMessage: "Constant variables can't be assigned a value after initialization." correctionMessage: "Try removing the assignment, or remove the modifier 'const' from the variable." hasPublishedDocs: true comment: No parameters. From fc7f0579a6123fcf5345e7fec4336299bfabaa1d Mon Sep 17 00:00:00 2001 From: "franklin.oladipo" Date: Tue, 24 Dec 2024 21:59:14 +0000 Subject: [PATCH 3/3] generated files for messages.yaml --- pkg/analyzer/lib/src/error/codes.g.dart | 2 +- pkg/analyzer/messages.yaml | 3 ++- pkg/analyzer/pubspec.yaml | 2 +- pkg/analyzer/tool/diagnostics/diagnostics.md | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/analyzer/lib/src/error/codes.g.dart b/pkg/analyzer/lib/src/error/codes.g.dart index ec1258260812..056261973774 100644 --- a/pkg/analyzer/lib/src/error/codes.g.dart +++ b/pkg/analyzer/lib/src/error/codes.g.dart @@ -157,7 +157,7 @@ class CompileTimeErrorCode extends AnalyzerErrorCode { /// No parameters. static const CompileTimeErrorCode ASSIGNMENT_TO_CONST = CompileTimeErrorCode( 'ASSIGNMENT_TO_CONST', - "Constant variables can't be assigned a value.", + "Constant variables can't be assigned a value after initialization.", correctionMessage: "Try removing the assignment, or remove the modifier 'const' from the " "variable.", diff --git a/pkg/analyzer/messages.yaml b/pkg/analyzer/messages.yaml index 71bdfbd82f19..68c82a379fa7 100644 --- a/pkg/analyzer/messages.yaml +++ b/pkg/analyzer/messages.yaml @@ -5,9 +5,10 @@ # Run # # dart run analyzer/tool/messages/generate.dart +# dart run analyzer/tool/diagnostics/generate.dart # # to regenerate messages after having edited this file. - +# # This file is organized as a two level map, where the outer key corresponds to # the name of an analyzer error class (e.g. CompileTimeErrorCode), and the inner # key corresponds to the name of a static variable in that class, describing a diff --git a/pkg/analyzer/pubspec.yaml b/pkg/analyzer/pubspec.yaml index ff759a62ee18..dd2200347488 100644 --- a/pkg/analyzer/pubspec.yaml +++ b/pkg/analyzer/pubspec.yaml @@ -13,7 +13,7 @@ dependencies: convert: ^3.0.0 crypto: ^3.0.0 glob: ^2.0.0 - macros: '>=0.1.3-main.0 <0.1.4' + macros: ^0.0.1 meta: ^1.15.0 package_config: ^2.0.0 path: ^1.9.0 diff --git a/pkg/analyzer/tool/diagnostics/diagnostics.md b/pkg/analyzer/tool/diagnostics/diagnostics.md index ff8791244ab2..23a12a279b2b 100644 --- a/pkg/analyzer/tool/diagnostics/diagnostics.md +++ b/pkg/analyzer/tool/diagnostics/diagnostics.md @@ -1280,7 +1280,7 @@ function producing the value. ### assignment_to_const -_Constant variables can't be assigned a value._ +_Constant variables can't be assigned a value after initialization._ #### Description