From 3e630865537bd6dbd7fe408c2b4b8dbdaeb8cd42 Mon Sep 17 00:00:00 2001 From: Brian Wilkerson Date: Tue, 4 Jan 2022 19:06:28 +0000 Subject: [PATCH] Unify three error codes for documentation purposes Change-Id: I71fd9a614f7eb933d20dc54060ab48111b6061fb Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/226140 Reviewed-by: Konstantin Shcheglov Commit-Queue: Brian Wilkerson --- pkg/analyzer/lib/src/error/codes.g.dart | 15 +++++++++------ pkg/analyzer/messages.yaml | 9 ++++++--- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/pkg/analyzer/lib/src/error/codes.g.dart b/pkg/analyzer/lib/src/error/codes.g.dart index 69e838548df..b6c285a96e4 100644 --- a/pkg/analyzer/lib/src/error/codes.g.dart +++ b/pkg/analyzer/lib/src/error/codes.g.dart @@ -4521,27 +4521,30 @@ class CompileTimeErrorCode extends AnalyzerErrorCode { static const CompileTimeErrorCode EXTERNAL_FIELD_CONSTRUCTOR_INITIALIZER = CompileTimeErrorCode( - 'EXTERNAL_FIELD_CONSTRUCTOR_INITIALIZER', - "External fields cannot have initializers.", + 'EXTERNAL_WITH_INITIALIZER', + "External fields can't have initializers.", correctionMessage: "Try removing the field initializer or the 'external' keyword from the " "field declaration.", + uniqueName: 'EXTERNAL_FIELD_CONSTRUCTOR_INITIALIZER', ); static const CompileTimeErrorCode EXTERNAL_FIELD_INITIALIZER = CompileTimeErrorCode( - 'EXTERNAL_FIELD_INITIALIZER', - "External fields cannot have initializers.", + 'EXTERNAL_WITH_INITIALIZER', + "External fields can't have initializers.", correctionMessage: "Try removing the initializer or the 'external' keyword.", + uniqueName: 'EXTERNAL_FIELD_INITIALIZER', ); static const CompileTimeErrorCode EXTERNAL_VARIABLE_INITIALIZER = CompileTimeErrorCode( - 'EXTERNAL_VARIABLE_INITIALIZER', - "External variables cannot have initializers.", + 'EXTERNAL_WITH_INITIALIZER', + "External variables can't have initializers.", correctionMessage: "Try removing the initializer or the 'external' keyword.", + uniqueName: 'EXTERNAL_VARIABLE_INITIALIZER', ); /** diff --git a/pkg/analyzer/messages.yaml b/pkg/analyzer/messages.yaml index 0200008fb24..7235ace20ef 100644 --- a/pkg/analyzer/messages.yaml +++ b/pkg/analyzer/messages.yaml @@ -3971,13 +3971,16 @@ CompileTimeErrorCode: If there are multiple cascaded accesses, you'll need to duplicate the extension override for each one. EXTERNAL_FIELD_CONSTRUCTOR_INITIALIZER: - problemMessage: External fields cannot have initializers. + sharedName: EXTERNAL_WITH_INITIALIZER + problemMessage: External fields can't have initializers. correctionMessage: "Try removing the field initializer or the 'external' keyword from the field declaration." EXTERNAL_FIELD_INITIALIZER: - problemMessage: External fields cannot have initializers. + sharedName: EXTERNAL_WITH_INITIALIZER + problemMessage: External fields can't have initializers. correctionMessage: "Try removing the initializer or the 'external' keyword." EXTERNAL_VARIABLE_INITIALIZER: - problemMessage: External variables cannot have initializers. + sharedName: EXTERNAL_WITH_INITIALIZER + problemMessage: External variables can't have initializers. correctionMessage: "Try removing the initializer or the 'external' keyword." EXTRA_POSITIONAL_ARGUMENTS: problemMessage: "Too many positional arguments: {0} expected, but {1} found."