From 6b3f3403ecf31c8b64b36058239cbc230d1640d9 Mon Sep 17 00:00:00 2001 From: Brian Wilkerson Date: Mon, 26 Oct 2020 04:24:55 +0000 Subject: [PATCH] Unify three diagnostic codes for documentation purposes Change-Id: I46326160fedb26c92843698dd6513b9fe87e32dd Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169041 Reviewed-by: Samuel Rawlins Reviewed-by: Konstantin Shcheglov Commit-Queue: Brian Wilkerson --- pkg/analyzer/lib/src/error/codes.dart | 13 ++++++++++--- tests/language/list/literal6_test.dart | 2 +- tests/language/map/literal14_test.dart | 2 +- tests/language_2/list/literal6_test.dart | 2 +- tests/language_2/map/literal14_test.dart | 2 +- 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/pkg/analyzer/lib/src/error/codes.dart b/pkg/analyzer/lib/src/error/codes.dart index c9df73a59a2..6489ae936da 100644 --- a/pkg/analyzer/lib/src/error/codes.dart +++ b/pkg/analyzer/lib/src/error/codes.dart @@ -5039,7 +5039,8 @@ class CompileTimeErrorCode extends AnalyzerErrorCode { * 0: the name of the type parameter */ static const CompileTimeErrorCode INVALID_TYPE_ARGUMENT_IN_CONST_LIST = - CompileTimeErrorCode( + CompileTimeErrorCodeWithUniqueName( + 'INVALID_TYPE_ARGUMENT_IN_CONST_LITERAL', 'INVALID_TYPE_ARGUMENT_IN_CONST_LIST', "Constant list literals can't include a type parameter as a type " "argument, such as '{0}'.", @@ -5054,15 +5055,21 @@ class CompileTimeErrorCode extends AnalyzerErrorCode { * 0: the name of the type parameter */ static const CompileTimeErrorCode INVALID_TYPE_ARGUMENT_IN_CONST_MAP = - CompileTimeErrorCode( + CompileTimeErrorCodeWithUniqueName( + 'INVALID_TYPE_ARGUMENT_IN_CONST_LITERAL', 'INVALID_TYPE_ARGUMENT_IN_CONST_MAP', "Constant map literals can't include a type parameter as a type " "argument, such as '{0}'.", correction: "Try replacing the type parameter with a different type."); + /** + * Parameters: + * 0: the name of the type parameter + */ static const CompileTimeErrorCode INVALID_TYPE_ARGUMENT_IN_CONST_SET = - CompileTimeErrorCode( + CompileTimeErrorCodeWithUniqueName( + 'INVALID_TYPE_ARGUMENT_IN_CONST_LITERAL', 'INVALID_TYPE_ARGUMENT_IN_CONST_SET', "Constant set literals can't include a type parameter as a type " "argument, such as '{0}'.", diff --git a/tests/language/list/literal6_test.dart b/tests/language/list/literal6_test.dart index 7d6e3d94de8..f066509e981 100644 --- a/tests/language/list/literal6_test.dart +++ b/tests/language/list/literal6_test.dart @@ -9,7 +9,7 @@ class ListLiteral2NegativeTest { // Type parameter is not allowed with const. var m = const []; // ^ - // [analyzer] COMPILE_TIME_ERROR.INVALID_TYPE_ARGUMENT_IN_CONST_LIST + // [analyzer] COMPILE_TIME_ERROR.INVALID_TYPE_ARGUMENT_IN_CONST_LITERAL // [cfe] Type variables can't be used as constants. } } diff --git a/tests/language/map/literal14_test.dart b/tests/language/map/literal14_test.dart index 4351eb9eb5d..1b4108ff481 100644 --- a/tests/language/map/literal14_test.dart +++ b/tests/language/map/literal14_test.dart @@ -8,7 +8,7 @@ class MapLiteral2NegativeTest { test() { var m = const {}; // ^ - // [analyzer] COMPILE_TIME_ERROR.INVALID_TYPE_ARGUMENT_IN_CONST_MAP + // [analyzer] COMPILE_TIME_ERROR.INVALID_TYPE_ARGUMENT_IN_CONST_LITERAL // [cfe] Type variables can't be used as constants. } } diff --git a/tests/language_2/list/literal6_test.dart b/tests/language_2/list/literal6_test.dart index 7d6e3d94de8..f066509e981 100644 --- a/tests/language_2/list/literal6_test.dart +++ b/tests/language_2/list/literal6_test.dart @@ -9,7 +9,7 @@ class ListLiteral2NegativeTest { // Type parameter is not allowed with const. var m = const []; // ^ - // [analyzer] COMPILE_TIME_ERROR.INVALID_TYPE_ARGUMENT_IN_CONST_LIST + // [analyzer] COMPILE_TIME_ERROR.INVALID_TYPE_ARGUMENT_IN_CONST_LITERAL // [cfe] Type variables can't be used as constants. } } diff --git a/tests/language_2/map/literal14_test.dart b/tests/language_2/map/literal14_test.dart index 4351eb9eb5d..1b4108ff481 100644 --- a/tests/language_2/map/literal14_test.dart +++ b/tests/language_2/map/literal14_test.dart @@ -8,7 +8,7 @@ class MapLiteral2NegativeTest { test() { var m = const {}; // ^ - // [analyzer] COMPILE_TIME_ERROR.INVALID_TYPE_ARGUMENT_IN_CONST_MAP + // [analyzer] COMPILE_TIME_ERROR.INVALID_TYPE_ARGUMENT_IN_CONST_LITERAL // [cfe] Type variables can't be used as constants. } }