Unify three diagnostic codes for documentation purposes

Change-Id: I46326160fedb26c92843698dd6513b9fe87e32dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169041
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
Brian Wilkerson 2020-10-26 04:24:55 +00:00 committed by commit-bot@chromium.org
parent 92c07fa8d2
commit 6b3f3403ec
5 changed files with 14 additions and 7 deletions

View file

@ -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}'.",

View file

@ -9,7 +9,7 @@ class ListLiteral2NegativeTest<T> {
// Type parameter is not allowed with const.
var m = const <T>[];
// ^
// [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.
}
}

View file

@ -8,7 +8,7 @@ class MapLiteral2NegativeTest<T> {
test() {
var m = const <String, T>{};
// ^
// [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.
}
}

View file

@ -9,7 +9,7 @@ class ListLiteral2NegativeTest<T> {
// Type parameter is not allowed with const.
var m = const <T>[];
// ^
// [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.
}
}

View file

@ -8,7 +8,7 @@ class MapLiteral2NegativeTest<T> {
test() {
var m = const <String, T>{};
// ^
// [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.
}
}