Unify some error codes for documentation purposes

Change-Id: I3a0f66f29a446d677b459dc92f5bdded9f480719
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196801
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
Brian Wilkerson 2021-04-25 14:59:36 +00:00 committed by commit-bot@chromium.org
parent 7b9cfb4837
commit aaf35b839a
3 changed files with 32 additions and 24 deletions

View file

@ -1188,6 +1188,10 @@ class CompileTimeErrorCode extends AnalyzerErrorCode {
// #### Common fixes
//
// Choose a different name for the extension.
// TODO(brianwilkerson) When the documentation for
// 'BUILT_IN_IDENTIFIER_IN_DECLARATION' is committed it should replace the
// text above and the name of this code should be changed to match it. We
// also need to add a forward for this code at the same time.
static const CompileTimeErrorCode BUILT_IN_IDENTIFIER_AS_EXTENSION_NAME =
CompileTimeErrorCode('BUILT_IN_IDENTIFIER_AS_EXTENSION_NAME',
"The built-in identifier '{0}' can't be used as an extension name.",
@ -1203,9 +1207,10 @@ class CompileTimeErrorCode extends AnalyzerErrorCode {
* 0: the built-in identifier that is being used
*/
static const CompileTimeErrorCode BUILT_IN_IDENTIFIER_AS_PREFIX_NAME =
CompileTimeErrorCode('BUILT_IN_IDENTIFIER_AS_PREFIX_NAME',
CompileTimeErrorCode('BUILT_IN_IDENTIFIER_IN_DECLARATION',
"The built-in identifier '{0}' can't be used as a prefix name.",
correction: "Try choosing a different name for the prefix.");
correction: "Try choosing a different name for the prefix.",
uniqueName: 'BUILT_IN_IDENTIFIER_AS_PREFIX_NAME');
/**
* Parameters:
@ -1247,9 +1252,10 @@ class CompileTimeErrorCode extends AnalyzerErrorCode {
* 0: the built-in identifier that is being used
*/
static const CompileTimeErrorCode BUILT_IN_IDENTIFIER_AS_TYPE_NAME =
CompileTimeErrorCode('BUILT_IN_IDENTIFIER_AS_TYPE_NAME',
CompileTimeErrorCode('BUILT_IN_IDENTIFIER_IN_DECLARATION',
"The built-in identifier '{0}' can't be used as a type name.",
correction: "Try choosing a different name for the type.");
correction: "Try choosing a different name for the type.",
uniqueName: 'BUILT_IN_IDENTIFIER_AS_TYPE_NAME');
/**
* 16.33 Identifier Reference: It is a compile-time error if a built-in
@ -1261,10 +1267,11 @@ class CompileTimeErrorCode extends AnalyzerErrorCode {
*/
static const CompileTimeErrorCode BUILT_IN_IDENTIFIER_AS_TYPE_PARAMETER_NAME =
CompileTimeErrorCode(
'BUILT_IN_IDENTIFIER_AS_TYPE_PARAMETER_NAME',
'BUILT_IN_IDENTIFIER_IN_DECLARATION',
"The built-in identifier '{0}' can't be used as a type parameter "
"name.",
correction: "Try choosing a different name for the type parameter.");
correction: "Try choosing a different name for the type parameter.",
uniqueName: 'BUILT_IN_IDENTIFIER_AS_TYPE_PARAMETER_NAME');
/**
* 16.33 Identifier Reference: It is a compile-time error if a built-in
@ -1275,9 +1282,10 @@ class CompileTimeErrorCode extends AnalyzerErrorCode {
* 0: the built-in identifier that is being used
*/
static const CompileTimeErrorCode BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME =
CompileTimeErrorCode('BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME',
CompileTimeErrorCode('BUILT_IN_IDENTIFIER_IN_DECLARATION',
"The built-in identifier '{0}' can't be used as a typedef name.",
correction: "Try choosing a different name for the typedef.");
correction: "Try choosing a different name for the typedef.",
uniqueName: 'BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME');
/**
* No parameters.

View file

@ -6,15 +6,15 @@
// Pseudo keywords are not allowed to be used as class names.
class abstract { }
// ^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.BUILT_IN_IDENTIFIER_AS_TYPE_NAME
// [analyzer] COMPILE_TIME_ERROR.BUILT_IN_IDENTIFIER_IN_DECLARATION
// [cfe] Can't use 'abstract' as a name here.
class as { }
// ^^
// [analyzer] COMPILE_TIME_ERROR.BUILT_IN_IDENTIFIER_AS_TYPE_NAME
// [analyzer] COMPILE_TIME_ERROR.BUILT_IN_IDENTIFIER_IN_DECLARATION
// [cfe] Can't use 'as' as a name here.
class dynamic { }
// ^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.BUILT_IN_IDENTIFIER_AS_TYPE_NAME
// [analyzer] COMPILE_TIME_ERROR.BUILT_IN_IDENTIFIER_IN_DECLARATION
// [cfe] Can't use 'dynamic' as a name here.
class export { }
// ^^^^^^
@ -38,11 +38,11 @@ class export { }
// [analyzer] SYNTACTIC_ERROR.EXPECTED_TOKEN
class external { }
// ^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.BUILT_IN_IDENTIFIER_AS_TYPE_NAME
// [analyzer] COMPILE_TIME_ERROR.BUILT_IN_IDENTIFIER_IN_DECLARATION
// [cfe] Can't use 'external' as a name here.
class factory { }
// ^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.BUILT_IN_IDENTIFIER_AS_TYPE_NAME
// [analyzer] COMPILE_TIME_ERROR.BUILT_IN_IDENTIFIER_IN_DECLARATION
// [cfe] Can't use 'factory' as a name here.
class get { }
// ^^^
@ -56,7 +56,7 @@ class get { }
// [cfe] Expected an identifier, but got 'get'.
class interface { }
// ^^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.BUILT_IN_IDENTIFIER_AS_TYPE_NAME
// [analyzer] COMPILE_TIME_ERROR.BUILT_IN_IDENTIFIER_IN_DECLARATION
// [cfe] Can't use 'interface' as a name here.
class implements { }
// ^^^^^^^^^^
@ -118,7 +118,7 @@ class library { }
// [cfe] Expected a declaration, but got '}'.
class operator { }
// ^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.BUILT_IN_IDENTIFIER_AS_TYPE_NAME
// [analyzer] COMPILE_TIME_ERROR.BUILT_IN_IDENTIFIER_IN_DECLARATION
// [cfe] Can't use 'operator' as a name here.
class part { }
// ^^^^
@ -152,7 +152,7 @@ class set { }
// [cfe] Expected an identifier, but got 'set'.
class static { }
// ^^^^^^
// [analyzer] COMPILE_TIME_ERROR.BUILT_IN_IDENTIFIER_AS_TYPE_NAME
// [analyzer] COMPILE_TIME_ERROR.BUILT_IN_IDENTIFIER_IN_DECLARATION
// [cfe] Can't use 'static' as a name here.
class typedef { }
// ^^^^^^^

View file

@ -6,15 +6,15 @@
// Pseudo keywords are not allowed to be used as class names.
class abstract { }
// ^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.BUILT_IN_IDENTIFIER_AS_TYPE_NAME
// [analyzer] COMPILE_TIME_ERROR.BUILT_IN_IDENTIFIER_IN_DECLARATION
// [cfe] Can't use 'abstract' as a name here.
class as { }
// ^^
// [analyzer] COMPILE_TIME_ERROR.BUILT_IN_IDENTIFIER_AS_TYPE_NAME
// [analyzer] COMPILE_TIME_ERROR.BUILT_IN_IDENTIFIER_IN_DECLARATION
// [cfe] Can't use 'as' as a name here.
class dynamic { }
// ^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.BUILT_IN_IDENTIFIER_AS_TYPE_NAME
// [analyzer] COMPILE_TIME_ERROR.BUILT_IN_IDENTIFIER_IN_DECLARATION
// [cfe] Can't use 'dynamic' as a name here.
class export { }
// ^^^^^^
@ -38,11 +38,11 @@ class export { }
// [analyzer] SYNTACTIC_ERROR.EXPECTED_TOKEN
class external { }
// ^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.BUILT_IN_IDENTIFIER_AS_TYPE_NAME
// [analyzer] COMPILE_TIME_ERROR.BUILT_IN_IDENTIFIER_IN_DECLARATION
// [cfe] Can't use 'external' as a name here.
class factory { }
// ^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.BUILT_IN_IDENTIFIER_AS_TYPE_NAME
// [analyzer] COMPILE_TIME_ERROR.BUILT_IN_IDENTIFIER_IN_DECLARATION
// [cfe] Can't use 'factory' as a name here.
class get { }
// ^^^
@ -56,7 +56,7 @@ class get { }
// [cfe] Expected an identifier, but got 'get'.
class interface { }
// ^^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.BUILT_IN_IDENTIFIER_AS_TYPE_NAME
// [analyzer] COMPILE_TIME_ERROR.BUILT_IN_IDENTIFIER_IN_DECLARATION
// [cfe] Can't use 'interface' as a name here.
class implements { }
// ^^^^^^^^^^
@ -118,7 +118,7 @@ class library { }
// [cfe] Expected a declaration, but got '}'.
class operator { }
// ^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.BUILT_IN_IDENTIFIER_AS_TYPE_NAME
// [analyzer] COMPILE_TIME_ERROR.BUILT_IN_IDENTIFIER_IN_DECLARATION
// [cfe] Can't use 'operator' as a name here.
class part { }
// ^^^^
@ -152,7 +152,7 @@ class set { }
// [cfe] Expected an identifier, but got 'set'.
class static { }
// ^^^^^^
// [analyzer] COMPILE_TIME_ERROR.BUILT_IN_IDENTIFIER_AS_TYPE_NAME
// [analyzer] COMPILE_TIME_ERROR.BUILT_IN_IDENTIFIER_IN_DECLARATION
// [cfe] Can't use 'static' as a name here.
class typedef { }
// ^^^^^^^