Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(966)

Unified Diff: pkg/analyzer/lib/src/error/codes.dart

Issue 2428733005: More correction messages (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/lib/src/error/codes.dart
diff --git a/pkg/analyzer/lib/src/error/codes.dart b/pkg/analyzer/lib/src/error/codes.dart
index 35d71169cbc9c410f257d456eeba298e2c6ce76c..812d0301ad9125e72e2b29525e6f160cfc5b1ab2 100644
--- a/pkg/analyzer/lib/src/error/codes.dart
+++ b/pkg/analyzer/lib/src/error/codes.dart
@@ -56,7 +56,7 @@ class AnalysisOptionsWarningCode extends ErrorCode {
static const AnalysisOptionsWarningCode UNSUPPORTED_OPTION_WITH_LEGAL_VALUES =
const AnalysisOptionsWarningCode(
'UNSUPPORTED_OPTION_WITH_LEGAL_VALUES',
- "The option '{1}' isn't supported by {0}.",
+ "The option '{1}' isn't supported by '{0}'.",
"Try using one of the supported options: {2}.");
/**
@@ -71,7 +71,7 @@ class AnalysisOptionsWarningCode extends ErrorCode {
static const AnalysisOptionsWarningCode UNSUPPORTED_OPTION_WITH_LEGAL_VALUE =
const AnalysisOptionsWarningCode(
'UNSUPPORTED_OPTION_WITH_LEGAL_VALUE',
- "The option '{1}' isn't supported by {0}."
+ "The option '{1}' isn't supported by '{0}'."
"Try using the only supported option: '{2}'.");
/**
@@ -86,8 +86,8 @@ class AnalysisOptionsWarningCode extends ErrorCode {
static const AnalysisOptionsWarningCode UNSUPPORTED_VALUE =
const AnalysisOptionsWarningCode(
'UNSUPPORTED_VALUE',
- "The value '{1}' isn't supported by {0}.",
- "Try using one of the supported options: {2}");
+ "The value '{1}' isn't supported by '{0}'.",
+ "Try using one of the supported options: {2}.");
/**
* An error code indicating that an unrecognized error code is being used to
@@ -98,7 +98,7 @@ class AnalysisOptionsWarningCode extends ErrorCode {
*/
static const AnalysisOptionsWarningCode UNRECOGNIZED_ERROR_CODE =
const AnalysisOptionsWarningCode(
- 'UNRECOGNIZED_ERROR_CODE', "'{0}' isn't a recognized error code");
+ 'UNRECOGNIZED_ERROR_CODE', "'{0}' isn't a recognized error code.");
/**
* Initialize a newly created warning code to have the given [name].
@@ -138,7 +138,8 @@ class CheckedModeCompileTimeErrorCode extends ErrorCode {
CONST_CONSTRUCTOR_FIELD_TYPE_MISMATCH =
const CheckedModeCompileTimeErrorCode(
'CONST_CONSTRUCTOR_FIELD_TYPE_MISMATCH',
- "A value of type '{0}' can't be assigned to the field '{1}', which has type '{2}'.");
+ "A value of type '{0}' can't be assigned to the field '{1}', which "
+ "has type '{2}'.");
/**
* 16.12.2 Const: It is a compile-time error if evaluation of a constant
@@ -148,7 +149,8 @@ class CheckedModeCompileTimeErrorCode extends ErrorCode {
CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH =
const CheckedModeCompileTimeErrorCode(
'CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH',
- "A value of type '{0}' can't be assigned to a parameter of type '{1}'.");
+ "A value of type '{0}' can't be assigned to a parameter of type "
+ "'{1}'.");
/**
* 7.6.1 Generative Constructors: In checked mode, it is a dynamic type error
@@ -166,7 +168,8 @@ class CheckedModeCompileTimeErrorCode extends ErrorCode {
CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE =
const CheckedModeCompileTimeErrorCode(
'CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE',
- "The initializer type '{0}' can't be assigned to the field type '{1}'.");
+ "The initializer type '{0}' can't be assigned to the field type "
+ "'{1}'.");
/**
* 12.6 Lists: A run-time list literal &lt;<i>E</i>&gt; [<i>e<sub>1</sub></i>
@@ -221,16 +224,20 @@ class CheckedModeCompileTimeErrorCode extends ErrorCode {
* &lt;= j &lt;= m</i>.
*/
static const CheckedModeCompileTimeErrorCode MAP_VALUE_TYPE_NOT_ASSIGNABLE =
- const CheckedModeCompileTimeErrorCode('MAP_VALUE_TYPE_NOT_ASSIGNABLE',
- "The element type '{0}' can't be assigned to the map value type '{1}'.");
+ const CheckedModeCompileTimeErrorCode(
+ 'MAP_VALUE_TYPE_NOT_ASSIGNABLE',
+ "The element type '{0}' can't be assigned to the map value type "
+ "'{1}'.");
/**
* 16.12.2 Const: It is a compile-time error if evaluation of a constant
* object results in an uncaught exception being thrown.
*/
static const CheckedModeCompileTimeErrorCode VARIABLE_TYPE_MISMATCH =
- const CheckedModeCompileTimeErrorCode('VARIABLE_TYPE_MISMATCH',
- "A value of type '{0}' can't be assigned to a variable of type '{1}'.");
+ const CheckedModeCompileTimeErrorCode(
+ 'VARIABLE_TYPE_MISMATCH',
+ "A value of type '{0}' can't be assigned to a variable of type "
+ "'{1}'.");
/**
* Initialize a newly created error code to have the given [name]. The message
@@ -262,8 +269,10 @@ class CompileTimeErrorCode extends ErrorCode {
* enum via 'new' or 'const' or to access its private fields.
*/
static const CompileTimeErrorCode ACCESS_PRIVATE_ENUM_FIELD =
- const CompileTimeErrorCode('ACCESS_PRIVATE_ENUM_FIELD',
- "The private fields of an enum can't be accessed, even within the same library.");
+ const CompileTimeErrorCode(
+ 'ACCESS_PRIVATE_ENUM_FIELD',
+ "The private fields of an enum can't be accessed, even within the "
+ "same library.");
/**
* 14.2 Exports: It is a compile-time error if a name <i>N</i> is re-exported
@@ -349,8 +358,10 @@ class CompileTimeErrorCode extends ErrorCode {
* 0: the built-in identifier that is being used
*/
static const CompileTimeErrorCode BUILT_IN_IDENTIFIER_AS_TYPE =
- const CompileTimeErrorCode('BUILT_IN_IDENTIFIER_AS_TYPE',
- "The built-in identifier '{0}' can't be used as a type.");
+ const CompileTimeErrorCode(
+ 'BUILT_IN_IDENTIFIER_AS_TYPE',
+ "The built-in identifier '{0}' can't be used as a type.",
+ "Try correcting the name to match an existing type.");
/**
* 12.30 Identifier Reference: It is a compile-time error if a built-in
@@ -419,7 +430,8 @@ class CompileTimeErrorCode extends ErrorCode {
static const CompileTimeErrorCode CONFLICTING_GETTER_AND_METHOD =
const CompileTimeErrorCode(
'CONFLICTING_GETTER_AND_METHOD',
- "Class '{0}' can't have both getter '{1}.{2}' and method with the same name.",
+ "Class '{0}' can't have both getter '{1}.{2}' and method with the "
+ "same name.",
"Try converting the method to a getter, or "
"renaming the method to a name that doesn't conflit.");
@@ -437,7 +449,8 @@ class CompileTimeErrorCode extends ErrorCode {
static const CompileTimeErrorCode CONFLICTING_METHOD_AND_GETTER =
const CompileTimeErrorCode(
'CONFLICTING_METHOD_AND_GETTER',
- "Class '{0}' can't have both method '{1}.{2}' and getter with the same name.",
+ "Class '{0}' can't have both method '{1}.{2}' and getter with the "
+ "same name.",
"Try converting the getter to a method, or "
"renaming the getter to a name that doesn't conflit.");
@@ -453,7 +466,8 @@ class CompileTimeErrorCode extends ErrorCode {
static const CompileTimeErrorCode CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD =
const CompileTimeErrorCode(
'CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD',
- "'{0}' can't be used to name both a constructor and a field in this class.",
+ "'{0}' can't be used to name both a constructor and a field in this "
+ "class.",
"Try renaming either the constructor or the field.");
/**
@@ -468,7 +482,8 @@ class CompileTimeErrorCode extends ErrorCode {
static const CompileTimeErrorCode CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD =
const CompileTimeErrorCode(
'CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD',
- "'{0}' can't be used to name both a constructor and a method in this class.",
+ "'{0}' can't be used to name both a constructor and a method in this "
+ "class.",
"Try renaming either the constructor or the field.");
/**
@@ -482,7 +497,8 @@ class CompileTimeErrorCode extends ErrorCode {
static const CompileTimeErrorCode CONFLICTING_TYPE_VARIABLE_AND_CLASS =
const CompileTimeErrorCode(
'CONFLICTING_TYPE_VARIABLE_AND_CLASS',
- "'{0}' can't be used to name both a type variable and the class in which the type variable is defined.",
+ "'{0}' can't be used to name both a type variable and the class in "
+ "which the type variable is defined.",
"Try renaming either the type variable or the class.");
/**
@@ -496,7 +512,8 @@ class CompileTimeErrorCode extends ErrorCode {
static const CompileTimeErrorCode CONFLICTING_TYPE_VARIABLE_AND_MEMBER =
const CompileTimeErrorCode(
'CONFLICTING_TYPE_VARIABLE_AND_MEMBER',
- "'{0}' can't be used to name both a type variable and a member in this class.",
+ "'{0}' can't be used to name both a type variable and a member in "
+ "this class.",
"Try renaming either the type variable or the member.");
/**
@@ -504,8 +521,10 @@ class CompileTimeErrorCode extends ErrorCode {
* object results in an uncaught exception being thrown.
*/
static const CompileTimeErrorCode CONST_CONSTRUCTOR_THROWS_EXCEPTION =
- const CompileTimeErrorCode('CONST_CONSTRUCTOR_THROWS_EXCEPTION',
- "Const constructors can't throw exceptions.");
+ const CompileTimeErrorCode(
+ 'CONST_CONSTRUCTOR_THROWS_EXCEPTION',
+ "Const constructors can't throw exceptions.",
+ "Try removing the throw statement, or removing the keyword 'const'.");
/**
* 10.6.3 Constant Constructors: It is a compile-time error if a constant
@@ -552,7 +571,8 @@ class CompileTimeErrorCode extends ErrorCode {
static const CompileTimeErrorCode CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER =
const CompileTimeErrorCode(
'CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER',
- "Constant constructor can't call non-constant super constructor of '{0}'.",
+ "Constant constructor can't call non-constant super constructor of "
+ "'{0}'.",
"Try calling a const constructor in the superclass, or "
"removing the keyword 'const' from the constructor.");
@@ -577,7 +597,7 @@ class CompileTimeErrorCode extends ErrorCode {
'CONST_DEFERRED_CLASS',
"Deferred classes can't be created with 'const'.",
"Try using 'new' to create the instance, or "
- "change the import to not be deferred.");
+ "changing the import to not be deferred.");
/**
* 6.2 Formal Parameters: It is a compile-time error if a formal parameter is
@@ -608,9 +628,11 @@ class CompileTimeErrorCode extends ErrorCode {
CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE_FROM_DEFERRED_LIBRARY =
const CompileTimeErrorCode(
'CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE_FROM_DEFERRED_LIBRARY',
- "Constant values from a deferred library can't be used to initialized a const variable.",
- "Try initializing the variable without referencing members of the deferred library, or"
- "change the import to not be deferred.");
+ "Constant values from a deferred library can't be used to "
+ "initialized a const variable.",
+ "Try initializing the variable without referencing members of the "
+ "deferred library, or"
+ "changing the import to not be deferred.");
/**
* 7.5 Instance Variables: It is a compile-time error if an instance variable
@@ -634,7 +656,8 @@ class CompileTimeErrorCode extends ErrorCode {
CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUALS =
const CompileTimeErrorCode(
'CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUALS',
- "The constant map entry key expression type '{0}' can't override the == operator.",
+ "The constant map entry key expression type '{0}' can't override "
+ "the == operator.",
"Try using a different value for the key, or "
"removing the keyword 'const' from the map.");
@@ -657,8 +680,10 @@ class CompileTimeErrorCode extends ErrorCode {
* value.
*/
static const CompileTimeErrorCode CONST_EVAL_TYPE_BOOL =
- const CompileTimeErrorCode('CONST_EVAL_TYPE_BOOL',
- "In constant expressions, operand(s) of this operator must be of type 'bool'.");
+ const CompileTimeErrorCode(
+ 'CONST_EVAL_TYPE_BOOL',
+ "In constant expressions, operands of this operator must be of type "
+ "'bool'.");
/**
* 16.12.2 Const: An expression of one of the forms e1 == e2 or e1 != e2 where
@@ -666,8 +691,10 @@ class CompileTimeErrorCode extends ErrorCode {
* boolean value or to null.
*/
static const CompileTimeErrorCode CONST_EVAL_TYPE_BOOL_NUM_STRING =
- const CompileTimeErrorCode('CONST_EVAL_TYPE_BOOL_NUM_STRING',
- "In constant expressions, operands of this operator must be of type 'bool', 'num', 'String' or 'null'.");
+ const CompileTimeErrorCode(
+ 'CONST_EVAL_TYPE_BOOL_NUM_STRING',
+ "In constant expressions, operands of this operator must be of type "
+ "'bool', 'num', 'String' or 'null'.");
/**
* 16.12.2 Const: An expression of one of the forms ~e, e1 ^ e2, e1 & e2,
@@ -675,8 +702,10 @@ class CompileTimeErrorCode extends ErrorCode {
* that evaluate to an integer value or to null.
*/
static const CompileTimeErrorCode CONST_EVAL_TYPE_INT =
- const CompileTimeErrorCode('CONST_EVAL_TYPE_INT',
- "In constant expressions, operand(s) of this operator must be of type 'int'.");
+ const CompileTimeErrorCode(
+ 'CONST_EVAL_TYPE_INT',
+ "In constant expressions, operands of this operator must be of type "
+ "'int'.");
/**
* 16.12.2 Const: An expression of one of the forms e, e1 + e2, e1 - e2, e1 *
@@ -685,8 +714,10 @@ class CompileTimeErrorCode extends ErrorCode {
* value or to null.
*/
static const CompileTimeErrorCode CONST_EVAL_TYPE_NUM =
- const CompileTimeErrorCode('CONST_EVAL_TYPE_NUM',
- "In constant expressions, operand(s) of this operator must be of type 'num'.");
+ const CompileTimeErrorCode(
+ 'CONST_EVAL_TYPE_NUM',
+ "In constant expressions, operands of this operator must be of type "
+ "'num'.");
/**
* 16.12.2 Const: It is a compile-time error if evaluation of a constant
@@ -694,15 +725,17 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode CONST_EVAL_THROWS_EXCEPTION =
const CompileTimeErrorCode('CONST_EVAL_THROWS_EXCEPTION',
- "Evaluation of this constant expression causes an exception.");
+ "Evaluation of this constant expression throws an exception.");
/**
* 16.12.2 Const: It is a compile-time error if evaluation of a constant
* object results in an uncaught exception being thrown.
*/
static const CompileTimeErrorCode CONST_EVAL_THROWS_IDBZE =
- const CompileTimeErrorCode('CONST_EVAL_THROWS_IDBZE',
- "Evaluation of this constant expression throws IntegerDivisionByZeroException.");
+ const CompileTimeErrorCode(
+ 'CONST_EVAL_THROWS_IDBZE',
+ "Evaluation of this constant expression throws an "
+ "IntegerDivisionByZeroException.");
/**
* 16.12.2 Const: If <i>T</i> is a parameterized type <i>S&lt;U<sub>1</sub>,
@@ -720,8 +753,10 @@ class CompileTimeErrorCode extends ErrorCode {
static const CompileTimeErrorCode CONST_WITH_INVALID_TYPE_PARAMETERS =
const CompileTimeErrorCode(
'CONST_WITH_INVALID_TYPE_PARAMETERS',
- "The type '{0}' is declared with {1} type parameters, but {2} type arguments were given.",
- "Try adjusting the number of type arguments to match the number of type parameters.");
+ "The type '{0}' is declared with {1} type parameters, but {2} type "
+ "arguments were given.",
+ "Try adjusting the number of type arguments to match the number of "
+ "type parameters.");
/**
* 16.12.2 Const: If <i>e</i> is of the form <i>const T(a<sub>1</sub>,
@@ -772,8 +807,10 @@ class CompileTimeErrorCode extends ErrorCode {
* error if <i>T</i> includes a type variable among its type arguments.
*/
static const CompileTimeErrorCode CONST_WITH_TYPE_PARAMETERS =
- const CompileTimeErrorCode('CONST_WITH_TYPE_PARAMETERS',
- "A constant creation can't use a type parameter as a type argument.");
+ const CompileTimeErrorCode(
+ 'CONST_WITH_TYPE_PARAMETERS',
+ "A constant creation can't use a type parameter as a type argument.",
+ "Try replacing the type parameter with a different type.");
/**
* 16.12.2 Const: It is a compile-time error if <i>T.id</i> is not the name of
@@ -784,8 +821,10 @@ class CompileTimeErrorCode extends ErrorCode {
* 1: the name of the requested constant constructor
*/
static const CompileTimeErrorCode CONST_WITH_UNDEFINED_CONSTRUCTOR =
- const CompileTimeErrorCode('CONST_WITH_UNDEFINED_CONSTRUCTOR',
- "The class '{0}' doesn't have a constant constructor '{1}'.");
+ const CompileTimeErrorCode(
+ 'CONST_WITH_UNDEFINED_CONSTRUCTOR',
+ "The class '{0}' doesn't have a constant constructor '{1}'.",
+ "Try calling a different contructor.");
/**
* 16.12.2 Const: It is a compile-time error if <i>T.id</i> is not the name of
@@ -795,8 +834,10 @@ class CompileTimeErrorCode extends ErrorCode {
* 0: the name of the type
*/
static const CompileTimeErrorCode CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT =
- const CompileTimeErrorCode('CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT',
- "The class '{0}' doesn't have a default constant constructor.");
+ const CompileTimeErrorCode(
+ 'CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT',
+ "The class '{0}' doesn't have a default constant constructor.",
+ "Try calling a different contructor.");
/**
* 15.3.1 Typedef: It is a compile-time error if any default values are
@@ -815,8 +856,10 @@ class CompileTimeErrorCode extends ErrorCode {
* function type.
*/
static const CompileTimeErrorCode DEFAULT_VALUE_IN_FUNCTION_TYPED_PARAMETER =
- const CompileTimeErrorCode('DEFAULT_VALUE_IN_FUNCTION_TYPED_PARAMETER',
- "Default values aren't allowed in function type parameters.");
+ const CompileTimeErrorCode(
+ 'DEFAULT_VALUE_IN_FUNCTION_TYPED_PARAMETER',
+ "Default values aren't allowed in function typed parameters.",
+ "Try removing the default value.");
/**
* 7.6.2 Factories: It is a compile-time error if <i>k</i> explicitly
@@ -826,15 +869,19 @@ class CompileTimeErrorCode extends ErrorCode {
DEFAULT_VALUE_IN_REDIRECTING_FACTORY_CONSTRUCTOR =
const CompileTimeErrorCode(
'DEFAULT_VALUE_IN_REDIRECTING_FACTORY_CONSTRUCTOR',
- "Default values aren't allowed in factory constructors that redirect to another constructor.");
+ "Default values aren't allowed in factory constructors that redirect "
+ "to another constructor.",
+ "Try removing the default value.");
/**
* 3.1 Scoping: It is a compile-time error if there is more than one entity
* with the same name declared in the same scope.
*/
static const CompileTimeErrorCode DUPLICATE_CONSTRUCTOR_DEFAULT =
- const CompileTimeErrorCode('DUPLICATE_CONSTRUCTOR_DEFAULT',
- "The default constructor is already defined.");
+ const CompileTimeErrorCode(
+ 'DUPLICATE_CONSTRUCTOR_DEFAULT',
+ "The default constructor is already defined.",
+ "Try giving one of the constructors a name.");
/**
* 3.1 Scoping: It is a compile-time error if there is more than one entity
@@ -844,8 +891,10 @@ class CompileTimeErrorCode extends ErrorCode {
* 0: the name of the duplicate entity
*/
static const CompileTimeErrorCode DUPLICATE_CONSTRUCTOR_NAME =
- const CompileTimeErrorCode('DUPLICATE_CONSTRUCTOR_NAME',
- "The constructor with name '{0}' is already defined.");
+ const CompileTimeErrorCode(
+ 'DUPLICATE_CONSTRUCTOR_NAME',
+ "The constructor with name '{0}' is already defined.",
+ "Try renaming one of the constructors.");
/**
* 3.1 Scoping: It is a compile-time error if there is more than one entity
@@ -862,7 +911,9 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode DUPLICATE_DEFINITION =
const CompileTimeErrorCode(
- 'DUPLICATE_DEFINITION', "The name '{0}' is already defined.");
+ 'DUPLICATE_DEFINITION',
+ "The name '{0}' is already defined.",
+ "Try renaming one of the declarations.");
/**
* 18.3 Parts: It's a compile-time error if the same library contains two part
@@ -873,7 +924,8 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode DUPLICATE_PART = const CompileTimeErrorCode(
'DUPLICATE_PART',
- "The library already contains a part with the uri '{0}'.");
+ "The library already contains a part with the uri '{0}'.",
+ "Try removing all but one of the duplicated part directives.");
/**
* 7. Classes: It is a compile-time error if a class has an instance member
@@ -884,13 +936,15 @@ class CompileTimeErrorCode extends ErrorCode {
*
* Parameters:
* 0: the name of the class that has conflicting instance/static members
- * 1: the name of the conflicting members
+ * 1: the name of the conflicting member
*
* See [DUPLICATE_DEFINITION].
*/
static const CompileTimeErrorCode DUPLICATE_DEFINITION_INHERITANCE =
- const CompileTimeErrorCode('DUPLICATE_DEFINITION_INHERITANCE',
- "The name '{0}' is already defined in '{1}'.");
+ const CompileTimeErrorCode(
+ 'DUPLICATE_DEFINITION_INHERITANCE',
+ "The name '{0}' is already defined in '{1}'.",
+ "Try renaming one of the declarations.");
/**
* 12.14.2 Binding Actuals to Formals: It is a compile-time error if
@@ -901,8 +955,11 @@ class CompileTimeErrorCode extends ErrorCode {
* 0: the name of the parameter that was duplicated
*/
static const CompileTimeErrorCode DUPLICATE_NAMED_ARGUMENT =
- const CompileTimeErrorCode('DUPLICATE_NAMED_ARGUMENT',
- "The argument for the named parameter '{0}' was already specified.");
+ const CompileTimeErrorCode(
+ 'DUPLICATE_NAMED_ARGUMENT',
+ "The argument for the named parameter '{0}' was already specified.",
+ "Try removing one of the named arguments, or "
+ "correcting one of the names to reference a different named parameter.");
/**
* SDK implementation libraries can be exported only by other SDK libraries.
@@ -922,15 +979,19 @@ class CompileTimeErrorCode extends ErrorCode {
* 0: the uri pointing to a non-library declaration
*/
static const CompileTimeErrorCode EXPORT_OF_NON_LIBRARY =
- const CompileTimeErrorCode('EXPORT_OF_NON_LIBRARY',
- "The exported library '{0}' can't have a part-of directive.");
+ const CompileTimeErrorCode(
+ 'EXPORT_OF_NON_LIBRARY',
+ "The exported library '{0}' can't have a part-of directive.",
+ "Try exporting the library that the part is a part of.");
/**
* Enum proposal: It is a compile-time error to subclass, mix-in or implement
* an enum.
*/
static const CompileTimeErrorCode EXTENDS_ENUM = const CompileTimeErrorCode(
- 'EXTENDS_ENUM', "Classes can't extend an enum.");
+ 'EXTENDS_ENUM',
+ "Classes can't extend an enum.",
+ "Try specifying a different superclass, or removing the extends clause.");
/**
* 7.9 Superclasses: It is a compile-time error if the extends clause of a
@@ -940,9 +1001,10 @@ class CompileTimeErrorCode extends ErrorCode {
* Parameters:
* 0: the name of the superclass that was not found
*/
- static const CompileTimeErrorCode EXTENDS_NON_CLASS =
- const CompileTimeErrorCode(
- 'EXTENDS_NON_CLASS', "Classes can only extend other classes.");
+ static const CompileTimeErrorCode EXTENDS_NON_CLASS = const CompileTimeErrorCode(
+ 'EXTENDS_NON_CLASS',
+ "Classes can only extend other classes.",
+ "Try specifying a different superclass, or removing the extends clause.");
/**
* 12.2 Null: It is a compile-time error for a class to attempt to extend or
@@ -971,7 +1033,10 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode EXTENDS_DISALLOWED_CLASS =
const CompileTimeErrorCode(
- 'EXTENDS_DISALLOWED_CLASS', "Classes can't extend '{0}'.");
+ 'EXTENDS_DISALLOWED_CLASS',
+ "Classes can't extend '{0}'.",
+ "Try specifying a different superclass, or "
+ "removing the extends clause.");
/**
* 7.9 Superclasses: It is a compile-time error if the extends clause of a
@@ -983,8 +1048,11 @@ class CompileTimeErrorCode extends ErrorCode {
* See [IMPLEMENTS_DEFERRED_CLASS], and [MIXIN_DEFERRED_CLASS].
*/
static const CompileTimeErrorCode EXTENDS_DEFERRED_CLASS =
- const CompileTimeErrorCode('EXTENDS_DEFERRED_CLASS',
- "This class can't extend the deferred class '{0}'.");
+ const CompileTimeErrorCode(
+ 'EXTENDS_DEFERRED_CLASS',
+ "This class can't extend the deferred class '{0}'.",
+ "Try specifying a different superclass, or "
+ "removing the extends clause.");
/**
* DEP 37 extends the syntax for assert() to allow a second "message"
@@ -992,8 +1060,10 @@ class CompileTimeErrorCode extends ErrorCode {
* argument but the DEP is not enabled.
*/
static const CompileTimeErrorCode EXTRA_ARGUMENT_TO_ASSERT =
- const CompileTimeErrorCode('EXTRA_ARGUMENT_TO_ASSERT',
- "Assertions only accept a single argument.");
+ const CompileTimeErrorCode(
+ 'EXTRA_ARGUMENT_TO_ASSERT',
+ "Assertions only accept a single argument.",
+ "Try removing the message, or enable messages in assert statements.");
/**
* 12.14.2 Binding Actuals to Formals: It is a static warning if <i>m &lt;
@@ -1007,8 +1077,10 @@ class CompileTimeErrorCode extends ErrorCode {
* 1: the actual number of positional arguments given
*/
static const CompileTimeErrorCode EXTRA_POSITIONAL_ARGUMENTS =
- const CompileTimeErrorCode('EXTRA_POSITIONAL_ARGUMENTS',
- "{0} positional arguments expected, but {1} found.");
+ const CompileTimeErrorCode(
+ 'EXTRA_POSITIONAL_ARGUMENTS',
+ "{0} positional arguments expected, but {1} found.",
+ "Try removing the extra arguments.");
/**
* 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It
@@ -1019,8 +1091,10 @@ class CompileTimeErrorCode extends ErrorCode {
* 0: the name of the field being initialized multiple times
*/
static const CompileTimeErrorCode FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS =
- const CompileTimeErrorCode('FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS',
- "The field '{0}' can't be initialized twice in the same constructor.");
+ const CompileTimeErrorCode(
+ 'FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS',
+ "The field '{0}' can't be initialized twice in the same constructor.",
+ "Try removing one of the initializations.");
/**
* 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It
@@ -1032,7 +1106,9 @@ class CompileTimeErrorCode extends ErrorCode {
FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER =
const CompileTimeErrorCode(
'FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER',
- "Fields can't be initialized in both the parameter list and the initializers.");
+ "Fields can't be initialized in both the parameter list and the "
+ "initializers.",
+ "Try removing one of the initializations.");
/**
* 5 Variables: It is a compile-time error if a final instance variable that
@@ -1043,8 +1119,10 @@ class CompileTimeErrorCode extends ErrorCode {
* 0: the name of the field in question
*/
static const CompileTimeErrorCode FINAL_INITIALIZED_MULTIPLE_TIMES =
- const CompileTimeErrorCode('FINAL_INITIALIZED_MULTIPLE_TIMES',
- "'{0}' is a final field and so can only be set once.");
+ const CompileTimeErrorCode(
+ 'FINAL_INITIALIZED_MULTIPLE_TIMES',
+ "'{0}' is a final field and so can only be set once.",
+ "Try removing all but one of the initializations.");
/**
* 7.6.1 Generative Constructors: It is a compile-time error if an
@@ -1052,8 +1130,10 @@ class CompileTimeErrorCode extends ErrorCode {
* generative constructor.
*/
static const CompileTimeErrorCode FIELD_INITIALIZER_FACTORY_CONSTRUCTOR =
- const CompileTimeErrorCode('FIELD_INITIALIZER_FACTORY_CONSTRUCTOR',
- "Initializing formal fields can't be used in factory constructors.");
+ const CompileTimeErrorCode(
+ 'FIELD_INITIALIZER_FACTORY_CONSTRUCTOR',
+ "Initializing formal parameters can't be used in factory constructors.",
+ "Try using a normal parameter.");
/**
* 7.6.1 Generative Constructors: It is a compile-time error if an
@@ -1061,8 +1141,10 @@ class CompileTimeErrorCode extends ErrorCode {
* generative constructor.
*/
static const CompileTimeErrorCode FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR =
- const CompileTimeErrorCode('FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR',
- "Initializing formal fields can only be used in constructors.");
+ const CompileTimeErrorCode(
+ 'FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR',
+ "Initializing formal parameters can only be used in constructors.",
+ "Try using a normal parameter.");
/**
* 7.6.1 Generative Constructors: A generative constructor may be redirecting,
@@ -1073,8 +1155,10 @@ class CompileTimeErrorCode extends ErrorCode {
* generative constructor.
*/
static const CompileTimeErrorCode FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR =
- const CompileTimeErrorCode('FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR',
- "The redirecting constructor can't have a field initializer.");
+ const CompileTimeErrorCode(
+ 'FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR',
+ "The redirecting constructor can't have a field initializer.",
+ "Try using a normal parameter.");
/**
* 7.2 Getters: It is a compile-time error if a class has both a getter and a
@@ -1084,8 +1168,11 @@ class CompileTimeErrorCode extends ErrorCode {
* 0: the conflicting name of the getter and method
*/
static const CompileTimeErrorCode GETTER_AND_METHOD_WITH_SAME_NAME =
- const CompileTimeErrorCode('GETTER_AND_METHOD_WITH_SAME_NAME',
- "'{0}' can't be used to name a getter, there is already a method with the same name.");
+ const CompileTimeErrorCode(
+ 'GETTER_AND_METHOD_WITH_SAME_NAME',
+ "'{0}' can't be used to name a getter, there is already a method "
+ "with the same name.",
+ "Try renaming either the getter or the method.");
/**
* 7.10 Superinterfaces: It is a compile-time error if the implements clause
@@ -1098,8 +1185,12 @@ class CompileTimeErrorCode extends ErrorCode {
* See [EXTENDS_DEFERRED_CLASS], and [MIXIN_DEFERRED_CLASS].
*/
static const CompileTimeErrorCode IMPLEMENTS_DEFERRED_CLASS =
- const CompileTimeErrorCode('IMPLEMENTS_DEFERRED_CLASS',
- "This class can't implement the deferred class '{0}'.");
+ const CompileTimeErrorCode(
+ 'IMPLEMENTS_DEFERRED_CLASS',
+ "This class can't implement the deferred class '{0}'.",
+ "Try specifying a different interface, "
+ "removing the class from the list, or "
+ "changing the import to not be deferred..");
/**
* 12.2 Null: It is a compile-time error for a class to attempt to extend or
@@ -1128,7 +1219,10 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode IMPLEMENTS_DISALLOWED_CLASS =
const CompileTimeErrorCode(
- 'IMPLEMENTS_DISALLOWED_CLASS', "Classes can't implement '{0}'.");
+ 'IMPLEMENTS_DISALLOWED_CLASS',
+ "Classes can't implement '{0}'.",
+ "Try specifying a different interface, or "
+ "remove the class from the list.");
/**
* 7.10 Superinterfaces: It is a compile-time error if the implements clause
@@ -1136,7 +1230,9 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode IMPLEMENTS_DYNAMIC =
const CompileTimeErrorCode(
- 'IMPLEMENTS_DYNAMIC', "Classes can't implement 'dynamic'.");
+ 'IMPLEMENTS_DYNAMIC',
+ "Classes can't implement 'dynamic'.",
+ "Try specifying an interface, or remove 'dynamic' from the list.");
/**
* Enum proposal: It is a compile-time error to subclass, mix-in or implement
@@ -1144,7 +1240,9 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode IMPLEMENTS_ENUM =
const CompileTimeErrorCode(
- 'IMPLEMENTS_ENUM', "Classes can't implement an enum.");
+ 'IMPLEMENTS_ENUM',
+ "Classes can't implement an enum.",
+ "Try specifying an interface, or remove the enum from the list.");
/**
* 7.10 Superinterfaces: It is a compile-time error if the implements clause
@@ -1156,7 +1254,9 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode IMPLEMENTS_NON_CLASS =
const CompileTimeErrorCode(
- 'IMPLEMENTS_NON_CLASS', "Classes can only implement other classes.");
+ 'IMPLEMENTS_NON_CLASS',
+ "Classes can only implement other classes.",
+ "Try specifying a class, or remove the name from the list.");
/**
* 7.10 Superinterfaces: It is a compile-time error if a type <i>T</i> appears
@@ -1167,7 +1267,9 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode IMPLEMENTS_REPEATED =
const CompileTimeErrorCode(
- 'IMPLEMENTS_REPEATED', "'{0}' can only be implemented once.");
+ 'IMPLEMENTS_REPEATED',
+ "'{0}' can only be implemented once.",
+ "Try removing all but one occurance of the class name.");
/**
* 7.10 Superinterfaces: It is a compile-time error if the superclass of a
@@ -1178,8 +1280,10 @@ class CompileTimeErrorCode extends ErrorCode {
* clauses
*/
static const CompileTimeErrorCode IMPLEMENTS_SUPER_CLASS =
- const CompileTimeErrorCode('IMPLEMENTS_SUPER_CLASS',
- "'{0}' can't be used in both 'extends' and 'implements' clauses.");
+ const CompileTimeErrorCode(
+ 'IMPLEMENTS_SUPER_CLASS',
+ "'{0}' can't be used in both 'extends' and 'implements' clauses.",
+ "Try removing one of the occurances.");
/**
* 7.6.1 Generative Constructors: Note that <b>this</b> is not in scope on the
@@ -1189,9 +1293,6 @@ class CompileTimeErrorCode extends ErrorCode {
* function or variable initializer, in a factory constructor, or in a static
* method or variable initializer, or in the initializer of an instance
* variable.
- *
- * Parameters:
- * 0: the name of the type in question
*/
static const CompileTimeErrorCode IMPLICIT_THIS_REFERENCE_IN_INITIALIZER =
const CompileTimeErrorCode('IMPLICIT_THIS_REFERENCE_IN_INITIALIZER',
@@ -1217,8 +1318,10 @@ class CompileTimeErrorCode extends ErrorCode {
* See [StaticWarningCode.IMPORT_OF_NON_LIBRARY].
*/
static const CompileTimeErrorCode IMPORT_OF_NON_LIBRARY =
- const CompileTimeErrorCode('IMPORT_OF_NON_LIBRARY',
- "The imported library '{0}' can't have a part-of directive.");
+ const CompileTimeErrorCode(
+ 'IMPORT_OF_NON_LIBRARY',
+ "The imported library '{0}' can't have a part-of directive.",
+ "Try importing the library that the part is a part of.");
/**
* 13.9 Switch: It is a compile-time error if values of the expressions
@@ -1246,8 +1349,11 @@ class CompileTimeErrorCode extends ErrorCode {
* See [INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD].
*/
static const CompileTimeErrorCode INITIALIZER_FOR_NON_EXISTENT_FIELD =
- const CompileTimeErrorCode('INITIALIZER_FOR_NON_EXISTENT_FIELD',
- "'{0}' isn't a variable in the enclosing class.");
+ const CompileTimeErrorCode(
+ 'INITIALIZER_FOR_NON_EXISTENT_FIELD',
+ "'{0}' isn't a field in the enclosing class.",
+ "Try correcting the name to match an existing field, or "
+ "defining a field named '{0}'.");
/**
* 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It
@@ -1262,8 +1368,11 @@ class CompileTimeErrorCode extends ErrorCode {
* See [INITIALIZING_FORMAL_FOR_STATIC_FIELD].
*/
static const CompileTimeErrorCode INITIALIZER_FOR_STATIC_FIELD =
- const CompileTimeErrorCode('INITIALIZER_FOR_STATIC_FIELD',
- "'{0}' is a static variable in the enclosing class, variables initialized in a constructor can't be static.");
+ const CompileTimeErrorCode(
+ 'INITIALIZER_FOR_STATIC_FIELD',
+ "'{0}' is a static field in the enclosing class. Fields initialized "
+ "in a constructor can't be static.",
+ "Try removing the initialization.");
/**
* 7.6.1 Generative Constructors: An initializing formal has the form
@@ -1278,8 +1387,11 @@ class CompileTimeErrorCode extends ErrorCode {
* [INITIALIZER_FOR_NON_EXISTENT_FIELD].
*/
static const CompileTimeErrorCode INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD =
- const CompileTimeErrorCode('INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD',
- "'{0}' isn't a variable in the enclosing class.");
+ const CompileTimeErrorCode(
+ 'INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD',
+ "'{0}' isn't a field in the enclosing class.",
+ "Try correcting the name to match an existing field, or "
+ "defining a field named '{0}'.");
/**
* 7.6.1 Generative Constructors: An initializing formal has the form
@@ -1293,24 +1405,32 @@ class CompileTimeErrorCode extends ErrorCode {
* See [INITIALIZER_FOR_STATIC_FIELD].
*/
static const CompileTimeErrorCode INITIALIZING_FORMAL_FOR_STATIC_FIELD =
- const CompileTimeErrorCode('INITIALIZING_FORMAL_FOR_STATIC_FIELD',
- "'{0}' is a static field in the enclosing class, fields initialized in a constructor can't be static.");
+ const CompileTimeErrorCode(
+ 'INITIALIZING_FORMAL_FOR_STATIC_FIELD',
+ "'{0}' is a static field in the enclosing class. Fields initialized "
+ "in a constructor can't be static.",
+ "Try removing the initialization.");
/**
* 12.30 Identifier Reference: Otherwise, e is equivalent to the property
* extraction <b>this</b>.<i>id</i>.
*/
static const CompileTimeErrorCode INSTANCE_MEMBER_ACCESS_FROM_FACTORY =
- const CompileTimeErrorCode('INSTANCE_MEMBER_ACCESS_FROM_FACTORY',
- "Instance members can't be accessed from a factory constructor.");
+ const CompileTimeErrorCode(
+ 'INSTANCE_MEMBER_ACCESS_FROM_FACTORY',
+ "Instance members can't be accessed from a factory constructor.",
+ "Try removing the reference to the instance member.");
/**
* 12.30 Identifier Reference: Otherwise, e is equivalent to the property
* extraction <b>this</b>.<i>id</i>.
*/
static const CompileTimeErrorCode INSTANCE_MEMBER_ACCESS_FROM_STATIC =
- const CompileTimeErrorCode('INSTANCE_MEMBER_ACCESS_FROM_STATIC',
- "Instance members can't be accessed from a static method.");
+ const CompileTimeErrorCode(
+ 'INSTANCE_MEMBER_ACCESS_FROM_STATIC',
+ "Instance members can't be accessed from a static method.",
+ "Try removing the reference to the instance member, or ."
+ "removing the keyword 'static' from the method.");
/**
* Enum proposal: It is also a compile-time error to explicitly instantiate an
@@ -1318,7 +1438,9 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode INSTANTIATE_ENUM =
const CompileTimeErrorCode(
- 'INSTANTIATE_ENUM', "Enums can't be instantiated.");
+ 'INSTANTIATE_ENUM',
+ "Enums can't be instantiated.",
+ "Try using one of the defined constants.");
/**
* 15 Metadata: Metadata consists of a series of annotations, each of which
@@ -1326,9 +1448,11 @@ class CompileTimeErrorCode extends ErrorCode {
* either a reference to a compile-time constant variable, or a call to a
* constant constructor.
*/
- static const CompileTimeErrorCode INVALID_ANNOTATION = const CompileTimeErrorCode(
- 'INVALID_ANNOTATION',
- "Annotation must be either a const variable reference or const constructor invocation.");
+ static const CompileTimeErrorCode INVALID_ANNOTATION =
+ const CompileTimeErrorCode(
+ 'INVALID_ANNOTATION',
+ "Annotation must be either a const variable reference or const "
+ "constructor invocation.");
/**
* 15 Metadata: Metadata consists of a series of annotations, each of which
@@ -1340,8 +1464,11 @@ class CompileTimeErrorCode extends ErrorCode {
* not qualified by a deferred prefix.
*/
static const CompileTimeErrorCode INVALID_ANNOTATION_FROM_DEFERRED_LIBRARY =
- const CompileTimeErrorCode('INVALID_ANNOTATION_FROM_DEFERRED_LIBRARY',
- "Constant values from a deferred library can't be used as annotations.");
+ const CompileTimeErrorCode(
+ 'INVALID_ANNOTATION_FROM_DEFERRED_LIBRARY',
+ "Constant values from a deferred library can't be used as annotations.",
+ "Try removing the annotation, or "
+ "changing the import to not be deferred.");
/**
* 15.31 Identifier Reference: It is a compile-time error if any of the
@@ -1349,24 +1476,32 @@ class CompileTimeErrorCode extends ErrorCode {
* body marked with either async, async* or sync*.
*/
static const CompileTimeErrorCode INVALID_IDENTIFIER_IN_ASYNC =
- const CompileTimeErrorCode('INVALID_IDENTIFIER_IN_ASYNC',
- "The identifier '{0}' can't be used in a function marked with 'async', 'async*' or 'sync*'.");
+ const CompileTimeErrorCode(
+ 'INVALID_IDENTIFIER_IN_ASYNC',
+ "The identifier '{0}' can't be used in a function marked with "
+ "'async', 'async*' or 'sync*'.",
+ "Try using a different name, or "
+ "remove the modifier on the function body.");
/**
* 9. Functions: It is a compile-time error if an async, async* or sync*
* modifier is attached to the body of a setter or constructor.
*/
static const CompileTimeErrorCode INVALID_MODIFIER_ON_CONSTRUCTOR =
- const CompileTimeErrorCode('INVALID_MODIFIER_ON_CONSTRUCTOR',
- "The modifier '{0}' can't be applied to the body of a constructor.");
+ const CompileTimeErrorCode(
+ 'INVALID_MODIFIER_ON_CONSTRUCTOR',
+ "The modifier '{0}' can't be applied to the body of a constructor.",
+ "Try removing the modifier.");
/**
* 9. Functions: It is a compile-time error if an async, async* or sync*
* modifier is attached to the body of a setter or constructor.
*/
static const CompileTimeErrorCode INVALID_MODIFIER_ON_SETTER =
- const CompileTimeErrorCode('INVALID_MODIFIER_ON_SETTER',
- "The modifier '{0}' can't be applied to the body of a setter.");
+ const CompileTimeErrorCode(
+ 'INVALID_MODIFIER_ON_SETTER',
+ "The modifier '{0}' can't be applied to the body of a setter.",
+ "Try removing the modifier.");
/**
* TODO(brianwilkerson) Remove this when we have decided on how to report
@@ -1391,8 +1526,10 @@ class CompileTimeErrorCode extends ErrorCode {
* the immediately enclosing class.
*/
static const CompileTimeErrorCode INVALID_FACTORY_NAME_NOT_A_CLASS =
- const CompileTimeErrorCode('INVALID_FACTORY_NAME_NOT_A_CLASS',
- "The name of the immediately enclosing class expected.");
+ const CompileTimeErrorCode(
+ 'INVALID_FACTORY_NAME_NOT_A_CLASS',
+ "The name of a factory constructor must be the same as the name of "
+ "the immediately enclosing class.");
/**
* 12.10 This: It is a compile-time error if this appears in a top-level
@@ -1412,8 +1549,11 @@ class CompileTimeErrorCode extends ErrorCode {
* 0: the name of the type parameter
*/
static const CompileTimeErrorCode INVALID_TYPE_ARGUMENT_IN_CONST_LIST =
- const CompileTimeErrorCode('INVALID_TYPE_ARGUMENT_IN_CONST_LIST',
- "Constant list literals can't include a type parameter as a type argument, such as '{0}'.");
+ const CompileTimeErrorCode(
+ 'INVALID_TYPE_ARGUMENT_IN_CONST_LIST',
+ "Constant list literals can't include a type parameter as a type "
+ "argument, such as '{0}'.",
+ "Try replacing the type parameter with a different type.");
/**
* 12.7 Maps: It is a compile time error if the type arguments of a constant
@@ -1423,8 +1563,11 @@ class CompileTimeErrorCode extends ErrorCode {
* 0: the name of the type parameter
*/
static const CompileTimeErrorCode INVALID_TYPE_ARGUMENT_IN_CONST_MAP =
- const CompileTimeErrorCode('INVALID_TYPE_ARGUMENT_IN_CONST_MAP',
- "Constant map literals can't include a type parameter as a type argument, such as '{0}'.");
+ const CompileTimeErrorCode(
+ 'INVALID_TYPE_ARGUMENT_IN_CONST_MAP',
+ "Constant map literals can't include a type parameter as a type "
+ "argument, such as '{0}'.",
+ "Try replacing the type parameter with a different type.");
/**
* 14.2 Exports: It is a compile-time error if the compilation unit found at
@@ -1474,7 +1617,10 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode LABEL_UNDEFINED =
const CompileTimeErrorCode(
- 'LABEL_UNDEFINED', "Can't reference undefined label '{0}'.");
+ 'LABEL_UNDEFINED',
+ "Can't reference undefined label '{0}'.",
+ "Try defining the label, or "
+ "correcting the name to match an existing label.");
/**
* 7 Classes: It is a compile time error if a class <i>C</i> declares a member
@@ -1492,22 +1638,30 @@ class CompileTimeErrorCode extends ErrorCode {
* 0: the conflicting name of the getter and method
*/
static const CompileTimeErrorCode METHOD_AND_GETTER_WITH_SAME_NAME =
- const CompileTimeErrorCode('METHOD_AND_GETTER_WITH_SAME_NAME',
- "'{0}' can't be used to name a method, there is already a getter with the same name.");
+ const CompileTimeErrorCode(
+ 'METHOD_AND_GETTER_WITH_SAME_NAME',
+ "'{0}' can't be used to name a method, there is already a getter "
+ "with the same name.");
/**
* 12.1 Constants: A constant expression is ... a constant list literal.
*/
static const CompileTimeErrorCode MISSING_CONST_IN_LIST_LITERAL =
- const CompileTimeErrorCode('MISSING_CONST_IN_LIST_LITERAL',
- "List literals must be prefixed with 'const' when used as a constant expression.");
+ const CompileTimeErrorCode(
+ 'MISSING_CONST_IN_LIST_LITERAL',
+ "List literals must be prefixed with 'const' when used as a constant "
+ "expression.",
+ "Try adding the keyword 'const' before the literal.");
/**
* 12.1 Constants: A constant expression is ... a constant map literal.
*/
static const CompileTimeErrorCode MISSING_CONST_IN_MAP_LITERAL =
- const CompileTimeErrorCode('MISSING_CONST_IN_MAP_LITERAL',
- "Map literals must be prefixed with 'const' when used as a constant expression.");
+ const CompileTimeErrorCode(
+ 'MISSING_CONST_IN_MAP_LITERAL',
+ "Map literals must be prefixed with 'const' when used as a constant "
+ "expression.",
+ "Try adding the keyword 'const' before the literal.");
/**
* 9 Mixins: It is a compile-time error if a declared or derived mixin
@@ -1517,8 +1671,10 @@ class CompileTimeErrorCode extends ErrorCode {
* 0: the name of the mixin that is invalid
*/
static const CompileTimeErrorCode MIXIN_DECLARES_CONSTRUCTOR =
- const CompileTimeErrorCode('MIXIN_DECLARES_CONSTRUCTOR',
- "The class '{0}' can't be used as a mixin because it declares a constructor.");
+ const CompileTimeErrorCode(
+ 'MIXIN_DECLARES_CONSTRUCTOR',
+ "The class '{0}' can't be used as a mixin because it declares a "
+ "constructor.");
/**
* 9.1 Mixin Application: It is a compile-time error if the with clause of a
@@ -1530,8 +1686,10 @@ class CompileTimeErrorCode extends ErrorCode {
* See [EXTENDS_DEFERRED_CLASS], and [IMPLEMENTS_DEFERRED_CLASS].
*/
static const CompileTimeErrorCode MIXIN_DEFERRED_CLASS =
- const CompileTimeErrorCode('MIXIN_DEFERRED_CLASS',
- "This class can't mixin the deferred class '{0}'.");
+ const CompileTimeErrorCode(
+ 'MIXIN_DEFERRED_CLASS',
+ "This class can't mixin the deferred class '{0}'.",
+ "Try changing the import to not be deferred.");
/**
* Not yet in the spec, but consistent with VM behavior. It is a
@@ -1554,8 +1712,10 @@ class CompileTimeErrorCode extends ErrorCode {
* 0: the name of the mixin that is invalid
*/
static const CompileTimeErrorCode MIXIN_INHERITS_FROM_NOT_OBJECT =
- const CompileTimeErrorCode('MIXIN_INHERITS_FROM_NOT_OBJECT',
- "The class '{0}' can't be used as a mixin because it extends a class other than Object.");
+ const CompileTimeErrorCode(
+ 'MIXIN_INHERITS_FROM_NOT_OBJECT',
+ "The class '{0}' can't be used as a mixin because it extends a class "
+ "other than Object.");
/**
* 12.2 Null: It is a compile-time error for a class to attempt to extend or
@@ -1605,8 +1765,10 @@ class CompileTimeErrorCode extends ErrorCode {
* to super.
*/
static const CompileTimeErrorCode MIXIN_REFERENCES_SUPER =
- const CompileTimeErrorCode('MIXIN_REFERENCES_SUPER',
- "The class '{0}' can't be used as a mixin because it references 'super'.");
+ const CompileTimeErrorCode(
+ 'MIXIN_REFERENCES_SUPER',
+ "The class '{0}' can't be used as a mixin because it references "
+ "'super'.");
/**
* 9.1 Mixin Application: It is a compile-time error if <i>S</i> does not
@@ -1623,7 +1785,8 @@ class CompileTimeErrorCode extends ErrorCode {
static const CompileTimeErrorCode
MULTIPLE_REDIRECTING_CONSTRUCTOR_INVOCATIONS = const CompileTimeErrorCode(
'MULTIPLE_REDIRECTING_CONSTRUCTOR_INVOCATIONS',
- "Constructor may have at most one 'this' redirection.");
+ "Constructors can have at most one 'this' redirection.",
+ "Try removing all but one of the redirections.");
/**
* 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor.
@@ -1631,8 +1794,10 @@ class CompileTimeErrorCode extends ErrorCode {
* list or a compile time error occurs.
*/
static const CompileTimeErrorCode MULTIPLE_SUPER_INITIALIZERS =
- const CompileTimeErrorCode('MULTIPLE_SUPER_INITIALIZERS',
- "Constructor may have at most one 'super' initializer.");
+ const CompileTimeErrorCode(
+ 'MULTIPLE_SUPER_INITIALIZERS',
+ "Constructor may have at most one 'super' initializer.",
+ "Try removing all but one of the 'super' initializers.");
/**
* 15 Metadata: Metadata consists of a series of annotations, each of which
@@ -1641,8 +1806,10 @@ class CompileTimeErrorCode extends ErrorCode {
* constant constructor.
*/
static const CompileTimeErrorCode NO_ANNOTATION_CONSTRUCTOR_ARGUMENTS =
- const CompileTimeErrorCode('NO_ANNOTATION_CONSTRUCTOR_ARGUMENTS',
- "Annotation creation must have arguments.");
+ const CompileTimeErrorCode(
+ 'NO_ANNOTATION_CONSTRUCTOR_ARGUMENTS',
+ "Annotation creation must have arguments.",
+ "Try adding an empty argument list.");
/**
* This error is generated if a constructor declaration has an implicit
@@ -1693,7 +1860,8 @@ class CompileTimeErrorCode extends ErrorCode {
'NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT',
"The superclass '{0}' doesn't have a zero argument constructor.",
"Try declaring a zero argument constructor in '{0}', or "
- "declaring a constructor in {1} that explicitly invokes a constructor in '{0}'.");
+ "declaring a constructor in {1} that explicitly invokes a "
+ "constructor in '{0}'.");
/**
* 13.2 Expression Statements: It is a compile-time error if a non-constant
@@ -1701,8 +1869,10 @@ class CompileTimeErrorCode extends ErrorCode {
* statement is expected.
*/
static const CompileTimeErrorCode NON_CONST_MAP_AS_EXPRESSION_STATEMENT =
- const CompileTimeErrorCode('NON_CONST_MAP_AS_EXPRESSION_STATEMENT',
- "A non-constant map literal without type arguments can't be used as an expression statement.");
+ const CompileTimeErrorCode(
+ 'NON_CONST_MAP_AS_EXPRESSION_STATEMENT',
+ "A non-constant map literal without type arguments can't be used as "
+ "an expression statement.");
/**
* 13.9 Switch: Given a switch statement of the form <i>switch (e) {
@@ -1737,7 +1907,10 @@ class CompileTimeErrorCode extends ErrorCode {
NON_CONSTANT_CASE_EXPRESSION_FROM_DEFERRED_LIBRARY =
const CompileTimeErrorCode(
'NON_CONSTANT_CASE_EXPRESSION_FROM_DEFERRED_LIBRARY',
- "Constant values from a deferred library can't be used as a case expression.");
+ "Constant values from a deferred library can't be used as a case "
+ "expression.",
+ "Try re-writing the switch as a series of if statements, or "
+ "changing the import to not be deferred.");
/**
* 6.2.2 Optional Formals: It is a compile-time error if the default value of
@@ -1758,15 +1931,20 @@ class CompileTimeErrorCode extends ErrorCode {
NON_CONSTANT_DEFAULT_VALUE_FROM_DEFERRED_LIBRARY =
const CompileTimeErrorCode(
'NON_CONSTANT_DEFAULT_VALUE_FROM_DEFERRED_LIBRARY',
- "Constant values from a deferred library can't be used as a default parameter value.");
+ "Constant values from a deferred library can't be used as a default "
+ "parameter value.",
+ "Try leaving the default as null and initializing the parameter "
+ "inside the function body.");
/**
* 12.6 Lists: It is a compile time error if an element of a constant list
* literal is not a compile-time constant.
*/
static const CompileTimeErrorCode NON_CONSTANT_LIST_ELEMENT =
- const CompileTimeErrorCode('NON_CONSTANT_LIST_ELEMENT',
- "'const' lists must have all constant values.");
+ const CompileTimeErrorCode(
+ 'NON_CONSTANT_LIST_ELEMENT',
+ "The values in a const list literal must be constants.",
+ "Try removing the keyword 'const' from the map literal.");
/**
* 12.6 Lists: It is a compile time error if an element of a constant list
@@ -1779,7 +1957,9 @@ class CompileTimeErrorCode extends ErrorCode {
NON_CONSTANT_LIST_ELEMENT_FROM_DEFERRED_LIBRARY =
const CompileTimeErrorCode(
'NON_CONSTANT_LIST_ELEMENT_FROM_DEFERRED_LIBRARY',
- "Constant values from a deferred library can't be used as values in a 'const' list.");
+ "Constant values from a deferred library can't be used as values in "
+ "a 'const' list.",
+ "Try removing the keyword 'const' from the list literal.");
/**
* 12.7 Maps: It is a compile time error if either a key or a value of an
@@ -1787,7 +1967,9 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode NON_CONSTANT_MAP_KEY =
const CompileTimeErrorCode(
- 'NON_CONSTANT_MAP_KEY', "The keys in a map must be constant.");
+ 'NON_CONSTANT_MAP_KEY',
+ "The keys in a const map literal must be constant.",
+ "Try removing the keyword 'const' from the map literal.");
/**
* 12.7 Maps: It is a compile time error if either a key or a value of an
@@ -1797,16 +1979,21 @@ class CompileTimeErrorCode extends ErrorCode {
* not qualified by a deferred prefix.
*/
static const CompileTimeErrorCode NON_CONSTANT_MAP_KEY_FROM_DEFERRED_LIBRARY =
- const CompileTimeErrorCode('NON_CONSTANT_MAP_KEY_FROM_DEFERRED_LIBRARY',
- "Constant values from a deferred library can't be used as keys in a map.");
+ const CompileTimeErrorCode(
+ 'NON_CONSTANT_MAP_KEY_FROM_DEFERRED_LIBRARY',
+ "Constant values from a deferred library can't be used as keys in a "
+ "const map literal.",
+ "Try removing the keyword 'const' from the map literal.");
/**
* 12.7 Maps: It is a compile time error if either a key or a value of an
* entry in a constant map literal is not a compile-time constant.
*/
static const CompileTimeErrorCode NON_CONSTANT_MAP_VALUE =
- const CompileTimeErrorCode('NON_CONSTANT_MAP_VALUE',
- "The values in a 'const' map must be constant.");
+ const CompileTimeErrorCode(
+ 'NON_CONSTANT_MAP_VALUE',
+ "The values in a const map literal must be constant.",
+ "Try removing the keyword 'const' from the map literal.");
/**
* 12.7 Maps: It is a compile time error if either a key or a value of an
@@ -1818,7 +2005,9 @@ class CompileTimeErrorCode extends ErrorCode {
static const CompileTimeErrorCode
NON_CONSTANT_MAP_VALUE_FROM_DEFERRED_LIBRARY = const CompileTimeErrorCode(
'NON_CONSTANT_MAP_VALUE_FROM_DEFERRED_LIBRARY',
- "Constant values from a deferred library can't be used as values in a 'const' map.");
+ "Constant values from a deferred library can't be used as values in "
+ "a const map literal.",
+ "Try removing the keyword 'const' from the map literal.");
/**
* 15 Metadata: Metadata consists of a series of annotations, each of which
@@ -1831,7 +2020,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode NON_CONSTANT_ANNOTATION_CONSTRUCTOR =
const CompileTimeErrorCode('NON_CONSTANT_ANNOTATION_CONSTRUCTOR',
- "Annotation creation can use only 'const' constructor.");
+ "Annotation creation can only call a const constructor.");
/**
* 7.6.3 Constant Constructors: Any expression that appears within the
@@ -1854,7 +2043,9 @@ class CompileTimeErrorCode extends ErrorCode {
NON_CONSTANT_VALUE_IN_INITIALIZER_FROM_DEFERRED_LIBRARY =
const CompileTimeErrorCode(
'NON_CONSTANT_VALUE_IN_INITIALIZER_FROM_DEFERRED_LIBRARY',
- "Constant values from a deferred library can't be used as constant initializers.");
+ "Constant values from a deferred library can't be used as constant "
+ "initializers.",
+ "Try changing the import to not be deferred.");
/**
* 12.14.2 Binding Actuals to Formals: It is a static warning if <i>m < h</i>
@@ -1868,8 +2059,10 @@ class CompileTimeErrorCode extends ErrorCode {
* 1: the actual number of positional arguments given
*/
static const CompileTimeErrorCode NOT_ENOUGH_REQUIRED_ARGUMENTS =
- const CompileTimeErrorCode('NOT_ENOUGH_REQUIRED_ARGUMENTS',
- "{0} required argument(s) expected, but {1} found.");
+ const CompileTimeErrorCode(
+ 'NOT_ENOUGH_REQUIRED_ARGUMENTS',
+ "{0} required argument(s) expected, but {1} found.",
+ "Try adding the missing arguments.");
/**
* 7.6.1 Generative Constructors: Let <i>C</i> be the class in which the
@@ -1879,8 +2072,11 @@ class CompileTimeErrorCode extends ErrorCode {
* (respectively <i>S.id</i>)
*/
static const CompileTimeErrorCode NON_GENERATIVE_CONSTRUCTOR =
- const CompileTimeErrorCode('NON_GENERATIVE_CONSTRUCTOR',
- "The generative constructor '{0}' expected, but factory found.");
+ const CompileTimeErrorCode(
+ 'NON_GENERATIVE_CONSTRUCTOR',
+ "The generative constructor '{0}' expected, but factory found.",
+ "Try calling a different constructor in the superclass, or "
+ "making the called constructor not be a factory constructor.");
/**
* 7.9 Superclasses: It is a compile-time error to specify an extends clause
@@ -1895,8 +2091,10 @@ class CompileTimeErrorCode extends ErrorCode {
* parameter in an operator.
*/
static const CompileTimeErrorCode OPTIONAL_PARAMETER_IN_OPERATOR =
- const CompileTimeErrorCode('OPTIONAL_PARAMETER_IN_OPERATOR',
- "Optional parameters aren't allowed when defining an operator.");
+ const CompileTimeErrorCode(
+ 'OPTIONAL_PARAMETER_IN_OPERATOR',
+ "Optional parameters aren't allowed when defining an operator.",
+ "Try removing the optional parameters.");
/**
* 14.3 Parts: It is a compile time error if the contents of the URI are not a
@@ -1916,16 +2114,23 @@ class CompileTimeErrorCode extends ErrorCode {
* top-level member named <i>p</i>.
*/
static const CompileTimeErrorCode PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER =
- const CompileTimeErrorCode('PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER',
- "The name '{0}' is already used as an import prefix and can't be used to name a top-level element.");
+ const CompileTimeErrorCode(
+ 'PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER',
+ "The name '{0}' is already used as an import prefix and can't be "
+ "used to name a top-level element.",
+ "Try renaming either the top-level element or the prefix.");
/**
* 16.32 Identifier Reference: If d is a prefix p, a compile-time error
* occurs unless the token immediately following d is '.'.
*/
static const CompileTimeErrorCode PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT =
- const CompileTimeErrorCode('PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT',
- "The name '{0}' refers to an import prefix, so it must be followed by '.'.");
+ const CompileTimeErrorCode(
+ 'PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT',
+ "The name '{0}' refers to an import prefix, so it must be followed "
+ "by '.'.",
+ "Try correcting the name to refer to something other than a prefix, or "
+ "renaming the prefix.");
/**
* 6.2.2 Optional Formals: It is a compile-time error if the name of a named
@@ -2046,24 +2251,33 @@ class CompileTimeErrorCode extends ErrorCode {
* the const modifier but <i>k'</i> is not a constant constructor.
*/
static const CompileTimeErrorCode REDIRECT_TO_MISSING_CONSTRUCTOR =
- const CompileTimeErrorCode('REDIRECT_TO_MISSING_CONSTRUCTOR',
- "The constructor '{0}' couldn't be found in '{1}'.");
+ const CompileTimeErrorCode(
+ 'REDIRECT_TO_MISSING_CONSTRUCTOR',
+ "The constructor '{0}' couldn't be found in '{1}'.",
+ "Try redirecting to a different constructor, or "
+ "define the constructor named '{0}'.");
/**
* 7.6.2 Factories: It is a compile-time error if <i>k</i> is prefixed with
* the const modifier but <i>k'</i> is not a constant constructor.
*/
static const CompileTimeErrorCode REDIRECT_TO_NON_CLASS =
- const CompileTimeErrorCode('REDIRECT_TO_NON_CLASS',
- "The name '{0}' isn't a type and can't be used in a redirected constructor.");
+ const CompileTimeErrorCode(
+ 'REDIRECT_TO_NON_CLASS',
+ "The name '{0}' isn't a type and can't be used in a redirected "
+ "constructor.",
+ "Try redirecting to a different constructor.");
/**
* 7.6.2 Factories: It is a compile-time error if <i>k</i> is prefixed with
* the const modifier but <i>k'</i> is not a constant constructor.
*/
static const CompileTimeErrorCode REDIRECT_TO_NON_CONST_CONSTRUCTOR =
- const CompileTimeErrorCode('REDIRECT_TO_NON_CONST_CONSTRUCTOR',
- "Constant factory constructor can't delegate to a non-constant constructor.");
+ const CompileTimeErrorCode(
+ 'REDIRECT_TO_NON_CONST_CONSTRUCTOR',
+ "Constant factory constructor can't delegate to a non-constant "
+ "constructor.",
+ "Try redirecting to a different constructor.");
/**
* 7.6.1 Generative constructors: A generative constructor may be
@@ -2071,8 +2285,11 @@ class CompileTimeErrorCode extends ErrorCode {
* generative constructor.
*/
static const CompileTimeErrorCode REDIRECT_GENERATIVE_TO_MISSING_CONSTRUCTOR =
- const CompileTimeErrorCode('REDIRECT_GENERATIVE_TO_MISSING_CONSTRUCTOR',
- "The constructor '{0}' couldn't be found in '{1}'.");
+ const CompileTimeErrorCode(
+ 'REDIRECT_GENERATIVE_TO_MISSING_CONSTRUCTOR',
+ "The constructor '{0}' couldn't be found in '{1}'.",
+ "Try redirecting to a different constructor, or "
+ "defining the constructor named '{0}'.");
/**
* 7.6.1 Generative constructors: A generative constructor may be
@@ -2083,7 +2300,8 @@ class CompileTimeErrorCode extends ErrorCode {
REDIRECT_GENERATIVE_TO_NON_GENERATIVE_CONSTRUCTOR =
const CompileTimeErrorCode(
'REDIRECT_GENERATIVE_TO_NON_GENERATIVE_CONSTRUCTOR',
- "Generative constructor can't redirect to a factory constructor.");
+ "Generative constructor can't redirect to a factory constructor.",
+ "Try redirecting to a different constructor.");
/**
* 5 Variables: A local variable may only be referenced at a source code
@@ -2091,8 +2309,12 @@ class CompileTimeErrorCode extends ErrorCode {
* compile-time error occurs.
*/
static const CompileTimeErrorCode REFERENCED_BEFORE_DECLARATION =
- const CompileTimeErrorCode('REFERENCED_BEFORE_DECLARATION',
- "Local variable '{0}' can't be referenced before it is declared.");
+ const CompileTimeErrorCode(
+ 'REFERENCED_BEFORE_DECLARATION',
+ "Local variable '{0}' can't be referenced before it is declared.",
+ "Try moving the declaration to before the first use, or "
+ "renaming the local variable so that it doesn't hide a name from an "
+ "enclosing scope.");
/**
* 12.8.1 Rethrow: It is a compile-time error if an expression of the form
@@ -2102,7 +2324,8 @@ class CompileTimeErrorCode extends ErrorCode {
const CompileTimeErrorCode(
'RETHROW_OUTSIDE_CATCH',
"Rethrow must be inside of catch clause.",
- "Try moving the expression into a catch clause, or using a 'throw' expression.");
+ "Try moving the expression into a catch clause, or using a 'throw' "
+ "expression.");
/**
* 13.12 Return: It is a compile-time error if a return statement of the form
@@ -2121,15 +2344,19 @@ class CompileTimeErrorCode extends ErrorCode {
static const CompileTimeErrorCode RETURN_IN_GENERATOR = const CompileTimeErrorCode(
'RETURN_IN_GENERATOR',
"Can't return a value from a generator function (using the '{0}' modifier).",
- "Try removing the value, replacing 'return' with 'yield' or changing the method body modifier.");
+ "Try removing the value, replacing 'return' with 'yield' or changing the "
+ "method body modifier.");
/**
* 14.1 Imports: It is a compile-time error if a prefix used in a deferred
* import is used in another import clause.
*/
static const CompileTimeErrorCode SHARED_DEFERRED_PREFIX =
- const CompileTimeErrorCode('SHARED_DEFERRED_PREFIX',
- "The prefix of a deferred import can't be used in other import directives.");
+ const CompileTimeErrorCode(
+ 'SHARED_DEFERRED_PREFIX',
+ "The prefix of a deferred import can't be used in other import "
+ "directives.",
+ "Try renaming one of the prefixes.");
/**
* 12.15.4 Super Invocation: A super method invocation <i>i</i> has the form
@@ -2182,22 +2409,27 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode TYPE_ARGUMENT_NOT_MATCHING_BOUNDS =
const CompileTimeErrorCode(
- 'TYPE_ARGUMENT_NOT_MATCHING_BOUNDS', "'{0}' doesn't extend '{1}'.");
+ 'TYPE_ARGUMENT_NOT_MATCHING_BOUNDS',
+ "'{0}' doesn't extend '{1}'.",
+ "Try using a type that is or is a subclass of '{1}'.");
/**
* 15.3.1 Typedef: Any self reference, either directly, or recursively via
* another typedef, is a compile time error.
*/
static const CompileTimeErrorCode TYPE_ALIAS_CANNOT_REFERENCE_ITSELF =
- const CompileTimeErrorCode('TYPE_ALIAS_CANNOT_REFERENCE_ITSELF',
- "Type alias can't reference itself directly or recursively via another typedef.");
+ const CompileTimeErrorCode(
+ 'TYPE_ALIAS_CANNOT_REFERENCE_ITSELF',
+ "Typedefs can't reference themselves directly or recursively via "
+ "another typedef.");
/**
* 16.12.2 Const: It is a compile-time error if <i>T</i> is not a class
* accessible in the current scope, optionally followed by type arguments.
*/
static const CompileTimeErrorCode UNDEFINED_CLASS =
- const CompileTimeErrorCode('UNDEFINED_CLASS', "Undefined class '{0}'.");
+ const CompileTimeErrorCode('UNDEFINED_CLASS', "Undefined class '{0}'.",
+ "Try defining the class.");
/**
* 7.6.1 Generative Constructors: Let <i>C</i> be the class in which the
@@ -2215,7 +2447,7 @@ class CompileTimeErrorCode extends ErrorCode {
'UNDEFINED_CONSTRUCTOR_IN_INITIALIZER',
"The class '{0}' doesn't have a constructor named '{1}'.",
"Try defining a constructor named '{1}' in '{0}', or "
- "invoking a different constructor");
+ "invoking a different constructor.");
/**
* 7.6.1 Generative Constructors: Let <i>C</i> be the class in which the
@@ -2232,7 +2464,7 @@ class CompileTimeErrorCode extends ErrorCode {
'UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT',
"The class '{0}' doesn't have an unnamed constructor.",
"Try defining an unnamed constructor in '{0}', or "
- "invoking a different constructor");
+ "invoking a different constructor.");
/**
* 12.14.2 Binding Actuals to Formals: Furthermore, each <i>q<sub>i</sub></i>,
@@ -2247,8 +2479,11 @@ class CompileTimeErrorCode extends ErrorCode {
* 0: the name of the requested named parameter
*/
static const CompileTimeErrorCode UNDEFINED_NAMED_PARAMETER =
- const CompileTimeErrorCode('UNDEFINED_NAMED_PARAMETER',
- "The named parameter '{0}' isn't defined.");
+ const CompileTimeErrorCode(
+ 'UNDEFINED_NAMED_PARAMETER',
+ "The named parameter '{0}' isn't defined.",
+ "Try correcting the name to an existing named parameter's name, or "
+ "defining a named parameter with the name '{0}'.");
/**
* 14.2 Exports: It is a compile-time error if the compilation unit found at
@@ -2265,10 +2500,12 @@ class CompileTimeErrorCode extends ErrorCode {
*
* See [INVALID_URI], [URI_HAS_NOT_BEEN_GENERATED].
*/
- static const CompileTimeErrorCode URI_DOES_NOT_EXIST = const CompileTimeErrorCode(
- 'URI_DOES_NOT_EXIST',
- "Target of URI doesn't exist: '{0}'.",
- "Try creating the file referenced by the URI or try using a URI for a file that does exist.");
+ static const CompileTimeErrorCode URI_DOES_NOT_EXIST =
+ const CompileTimeErrorCode(
+ 'URI_DOES_NOT_EXIST',
+ "Target of URI doesn't exist: '{0}'.",
+ "Try creating the file referenced by the URI, or "
+ "try using a URI for a file that does exist.");
/**
* Just like [URI_DOES_NOT_EXIST], but used when the URI refers to a file that
@@ -2283,7 +2520,8 @@ class CompileTimeErrorCode extends ErrorCode {
const CompileTimeErrorCode(
'URI_HAS_NOT_BEEN_GENERATED',
"Target of URI hasn't been generated: '{0}'.",
- "Try running the generator that will generate the file referenced by the URI.");
+ "Try running the generator that will generate the file referenced by "
+ "the URI.");
/**
* 14.1 Imports: It is a compile-time error if <i>x</i> is not a compile-time
@@ -2344,16 +2582,22 @@ class CompileTimeErrorCode extends ErrorCode {
* function that is not a generator function.
*/
static const CompileTimeErrorCode YIELD_EACH_IN_NON_GENERATOR =
- const CompileTimeErrorCode('YIELD_EACH_IN_NON_GENERATOR',
- "Yield-each statements must be in a generator function (one marked with either 'async*' or 'sync*').");
+ const CompileTimeErrorCode(
+ 'YIELD_EACH_IN_NON_GENERATOR',
+ "Yield-each statements must be in a generator function "
+ "(one marked with either 'async*' or 'sync*').",
+ "Try adding 'async*' or 'sync*' to the enclosing function.");
/**
* ?? Yield: It is a compile-time error if a yield statement appears in a
* function that is not a generator function.
*/
static const CompileTimeErrorCode YIELD_IN_NON_GENERATOR =
- const CompileTimeErrorCode('YIELD_IN_NON_GENERATOR',
- "Yield statements must be in a generator function (one marked with either 'async*' or 'sync*').");
+ const CompileTimeErrorCode(
+ 'YIELD_IN_NON_GENERATOR',
+ "Yield statements must be in a generator function "
+ "(one marked with either 'async*' or 'sync*').",
+ "Try adding 'async*' or 'sync*' to the enclosing function.");
/**
* Initialize a newly created error code to have the given [name]. The message
@@ -2377,7 +2621,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
class HintCode extends ErrorCode {
/**
- * When an abstract supertype member is references with `super` as its target,
+ * When an abstract supertype member is referenced with `super` as its target,
* it cannot be overridden, so it is always a runtime error.
*
* Parameters:
@@ -2414,8 +2658,11 @@ class HintCode extends ErrorCode {
* Dead code is code that is never reached, this can happen for instance if a
* statement follows a return statement.
*/
- static const HintCode DEAD_CODE = const HintCode('DEAD_CODE', "Dead code",
- "Try removing the code, or fixing the code before it so that it can be reached.");
+ static const HintCode DEAD_CODE = const HintCode(
+ 'DEAD_CODE',
+ "Dead code.",
+ "Try removing the code, or "
+ "fixing the code before it so that it can be reached.");
/**
* Dead code is code that is never reached. This case covers cases where the
@@ -2423,7 +2670,10 @@ class HintCode extends ErrorCode {
*/
static const HintCode DEAD_CODE_CATCH_FOLLOWING_CATCH = const HintCode(
'DEAD_CODE_CATCH_FOLLOWING_CATCH',
- "Dead code: catch clauses after a 'catch (e)' or an 'on Object catch (e)' are never reached.");
+ "Dead code: catch clauses after a 'catch (e)' or "
+ "an 'on Object catch (e)' are never reached.",
+ "Try reordering the catch clauses so that they can be reached, or "
+ "removing the unreachable catch clauses.");
/**
* Dead code is code that is never reached. This case covers cases where the
@@ -2436,7 +2686,10 @@ class HintCode extends ErrorCode {
*/
static const HintCode DEAD_CODE_ON_CATCH_SUBTYPE = const HintCode(
'DEAD_CODE_ON_CATCH_SUBTYPE',
- "Dead code: this on-catch block will never be executed since '{0}' is a subtype of '{1}'.");
+ "Dead code: this on-catch block will never be executed because '{0}' is "
+ "a subtype of '{1}' and hence will have been caught above.",
+ "Try reordering the catch clauses so that this block can be reached, or "
+ "removing the unreachable catch clause.");
/**
* Deprecated members should not be invoked or used.
@@ -2466,33 +2719,49 @@ class HintCode extends ErrorCode {
/**
* Hint for the `x is double` type checks.
*/
- static const HintCode IS_DOUBLE = const HintCode('IS_DOUBLE',
- "When compiled to JS, this test might return true when the left hand side is an int.");
+ static const HintCode IS_DOUBLE = const HintCode(
+ 'IS_DOUBLE',
+ "When compiled to JS, this test might return true when the left hand "
+ "side is an int.",
+ "Try testing for 'num' instead.");
/**
* Hint for the `x is int` type checks.
*/
- static const HintCode IS_INT = const HintCode('IS_INT',
- "When compiled to JS, this test might return true when the left hand side is a double.");
+ static const HintCode IS_INT = const HintCode(
+ 'IS_INT',
+ "When compiled to JS, this test might return true when the left hand "
+ "side is a double.",
+ "Try testing for 'num' instead.");
/**
* Hint for the `x is! double` type checks.
*/
- static const HintCode IS_NOT_DOUBLE = const HintCode('IS_NOT_DOUBLE',
- "When compiled to JS, this test might return false when the left hand side is an int.");
+ static const HintCode IS_NOT_DOUBLE = const HintCode(
+ 'IS_NOT_DOUBLE',
+ "When compiled to JS, this test might return false when the left hand "
+ "side is an int.",
+ "Try testing for 'num' instead.");
/**
* Hint for the `x is! int` type checks.
*/
- static const HintCode IS_NOT_INT = const HintCode('IS_NOT_INT',
- "When compiled to JS, this test might return false when the left hand side is a double.");
+ static const HintCode IS_NOT_INT = const HintCode(
+ 'IS_NOT_INT',
+ "When compiled to JS, this test might return false when the left hand "
+ "side is a double.",
+ "Try testing for 'num' instead.");
/**
* Deferred libraries shouldn't define a top level function 'loadLibrary'.
*/
- static const HintCode IMPORT_DEFERRED_LIBRARY_WITH_LOAD_FUNCTION = const HintCode(
- 'IMPORT_DEFERRED_LIBRARY_WITH_LOAD_FUNCTION',
- "The library '{0}' defines a top-level function named 'loadLibrary' which is hidden by deferring this library.");
+ static const HintCode IMPORT_DEFERRED_LIBRARY_WITH_LOAD_FUNCTION =
+ const HintCode(
+ 'IMPORT_DEFERRED_LIBRARY_WITH_LOAD_FUNCTION',
+ "The library '{0}' defines a top-level function named 'loadLibrary' "
+ "which is hidden by deferring this library.",
+ "Try changing the import to not be deferred, or "
+ "rename the function in the imported library.");
/**
* This hint is generated anywhere where the
@@ -2547,7 +2816,8 @@ class HintCode extends ErrorCode {
*/
static const HintCode INVALID_USE_OF_PROTECTED_MEMBER = const HintCode(
'INVALID_USE_OF_PROTECTED_MEMBER',
- "The member '{0}' can only be used within instance members of subclasses of '{1}'.");
+ "The member '{0}' can only be used within instance members of subclasses "
+ "of '{1}'.");
/**
* Generate a hint for a constructor, function or method invocation where a
@@ -2569,7 +2839,7 @@ class HintCode extends ErrorCode {
*/
static const HintCode MISSING_REQUIRED_PARAM_WITH_DETAILS = const HintCode(
'MISSING_REQUIRED_PARAM_WITH_DETAILS',
- "The parameter '{0}' is required. {1}");
+ "The parameter '{0}' is required. {1}.");
/**
* Generate a hint for an element that is annotated with `@JS(...)` whose
@@ -2577,7 +2847,9 @@ class HintCode extends ErrorCode {
*/
static const HintCode MISSING_JS_LIB_ANNOTATION = const HintCode(
'MISSING_JS_LIB_ANNOTATION',
- "The @JS() annotation can only be used if it is also declared on the library directive.");
+ "The @JS() annotation can only be used if it is also declared on the "
+ "library directive.",
+ "Try adding the annotation to the library directive.");
/**
* Generate a hint for methods or functions that have a return type, but do
@@ -2590,8 +2862,9 @@ class HintCode extends ErrorCode {
*/
static const HintCode MISSING_RETURN = const HintCode(
'MISSING_RETURN',
- "This function declares a return type of '{0}', but doesn't end with a return statement.",
- "Either add a return statement or change the return type to 'void'");
+ "This function declares a return type of '{0}', but doesn't end with a "
+ "return statement.",
+ "Try adding a return statement, or changing the return type to 'void'.");
/**
* Generate a hint for methods that override methods annotated `@mustCallSuper`
@@ -2603,7 +2876,7 @@ class HintCode extends ErrorCode {
static const HintCode MUST_CALL_SUPER = const HintCode(
'MUST_CALL_SUPER',
"This method overrides a method annotated as @mustCall super in '{0}', "
- "but does invoke the overriden method,");
+ "but does invoke the overriden method.");
/**
* A condition in a control flow statement could evaluate to `null` because it
@@ -2611,36 +2884,46 @@ class HintCode extends ErrorCode {
*/
static const HintCode NULL_AWARE_IN_CONDITION = const HintCode(
'NULL_AWARE_IN_CONDITION',
- "The value of the '?.' operator can be 'null', which isn't appropriate in a condition,",
- "Replace the '?.' with a '.', testing the left-hand side for null if necessary,");
+ "The value of the '?.' operator can be 'null', which isn't appropriate "
+ "in a condition.",
+ "Try replacing the '?.' with a '.', testing the left-hand side for null if "
+ "necessary.");
/**
* A getter with the override annotation does not override an existing getter.
*/
static const HintCode OVERRIDE_ON_NON_OVERRIDING_GETTER = const HintCode(
'OVERRIDE_ON_NON_OVERRIDING_GETTER',
- "Getter doesn't override an inherited getter.");
+ "Getter doesn't override an inherited getter.",
+ "Try updating this class to match the superclass, or "
+ "removing the override annotation.");
/**
* A field with the override annotation does not override a getter or setter.
*/
static const HintCode OVERRIDE_ON_NON_OVERRIDING_FIELD = const HintCode(
'OVERRIDE_ON_NON_OVERRIDING_FIELD',
- "Field doesn't override an inherited getter or setter.");
+ "Field doesn't override an inherited getter or setter.",
+ "Try updating this class to match the superclass, or "
+ "removing the override annotation.");
/**
* A method with the override annotation does not override an existing method.
*/
static const HintCode OVERRIDE_ON_NON_OVERRIDING_METHOD = const HintCode(
'OVERRIDE_ON_NON_OVERRIDING_METHOD',
- "Method doesn't override an inherited method.");
+ "Method doesn't override an inherited method.",
+ "Try updating this class to match the superclass, or "
+ "removing the override annotation.");
/**
* A setter with the override annotation does not override an existing setter.
*/
static const HintCode OVERRIDE_ON_NON_OVERRIDING_SETTER = const HintCode(
'OVERRIDE_ON_NON_OVERRIDING_SETTER',
- "Setter doesn't override an inherited setter.");
+ "Setter doesn't override an inherited setter.",
+ "Try updating this class to match the superclass, or "
+ "removing the override annotation.");
/**
* Hint for classes that override equals, but not hashCode.
@@ -2650,7 +2933,8 @@ class HintCode extends ErrorCode {
*/
static const HintCode OVERRIDE_EQUALS_BUT_NOT_HASH_CODE = const HintCode(
'OVERRIDE_EQUALS_BUT_NOT_HASH_CODE',
- "The class '{0}' overrides 'operator==', but not 'get hashCode'.");
+ "The class '{0}' overrides 'operator==', but not 'get hashCode'.",
+ "Try implementing 'hashCode'.");
/**
* Type checks of the type `x is! Null` should be done with `x != null`.
@@ -2688,7 +2972,8 @@ class HintCode extends ErrorCode {
*/
static const HintCode UNDEFINED_HIDDEN_NAME = const HintCode(
'UNDEFINED_HIDDEN_NAME',
- "The library '{0}' doesn't export a member with the hidden name '{1}'.");
+ "The library '{0}' doesn't export a member with the hidden name '{1}'.",
+ "Try removing the name from the list of hidden members.");
/**
* This hint is generated anywhere where the
@@ -2699,8 +2984,11 @@ class HintCode extends ErrorCode {
* 0: the name of the method that is undefined
* 1: the resolved type name that the method lookup is happening on
*/
- static const HintCode UNDEFINED_METHOD = const HintCode('UNDEFINED_METHOD',
- "The method '{0}' isn't defined for the class '{1}'.");
+ static const HintCode UNDEFINED_METHOD = const HintCode(
+ 'UNDEFINED_METHOD',
+ "The method '{0}' isn't defined for the class '{1}'.",
+ "Try correcting the name to the name of an existing method, or"
+ "defining a method named '{0}'.");
/**
* This hint is generated anywhere where the
@@ -2713,7 +3001,8 @@ class HintCode extends ErrorCode {
*/
static const HintCode UNDEFINED_OPERATOR = const HintCode(
'UNDEFINED_OPERATOR',
- "The operator '{0}' isn't defined for the class '{1}'.");
+ "The operator '{0}' isn't defined for the class '{1}'.",
+ "Try defining the operator '{0}'.");
/**
* This hint is generated anywhere where the
@@ -2735,7 +3024,8 @@ class HintCode extends ErrorCode {
*/
static const HintCode UNDEFINED_SHOWN_NAME = const HintCode(
'UNDEFINED_SHOWN_NAME',
- "The library '{0}' doesn't export a member with the shown name '{1}'.");
+ "The library '{0}' doesn't export a member with the shown name '{1}'.",
+ "Try removing the name from the list of shown members.");
/**
* Unnecessary cast.
@@ -2752,24 +3042,26 @@ class HintCode extends ErrorCode {
"Try removing the declaration of 'noSuchMethod'.");
/**
- * Unnecessary type checks, the result is always true.
+ * Unnecessary type checks, the result is always false.
*/
static const HintCode UNNECESSARY_TYPE_CHECK_FALSE = const HintCode(
'UNNECESSARY_TYPE_CHECK_FALSE',
- "Unnecessary type check, the result is always false.");
+ "Unnecessary type check, the result is always false.",
+ "Try correcting the type check, or removing the type check.");
/**
- * Unnecessary type checks, the result is always false.
+ * Unnecessary type checks, the result is always true.
*/
static const HintCode UNNECESSARY_TYPE_CHECK_TRUE = const HintCode(
'UNNECESSARY_TYPE_CHECK_TRUE',
- "Unnecessary type check, the result is always true.");
+ "Unnecessary type check, the result is always true.",
+ "Try correcting the type check, or removing the type check.");
/**
* See [Modifier.IS_USED_IN_LIBRARY].
*/
- static const HintCode UNUSED_ELEMENT =
- const HintCode('UNUSED_ELEMENT', "The {0} '{1}' isn't used.");
+ static const HintCode UNUSED_ELEMENT = const HintCode('UNUSED_ELEMENT',
+ "The {0} '{1}' isn't used.", "Try removing the declaration of '{1}'.");
/**
* Unused fields are fields which are never read.
@@ -2816,7 +3108,9 @@ class HintCode extends ErrorCode {
* Unused shown names are names shown on imports which are never used.
*/
static const HintCode UNUSED_SHOWN_NAME = const HintCode(
- 'UNUSED_SHOWN_NAME', "The name {0} is shown, but not used.");
+ 'UNUSED_SHOWN_NAME',
+ "The name {0} is shown, but not used.",
+ "Try removing the name from the list of shown members.");
/**
* Hint for cases where the source expects a method or function to return a
@@ -2837,8 +3131,12 @@ class HintCode extends ErrorCode {
* directory.
*/
static const HintCode FILE_IMPORT_INSIDE_LIB_REFERENCES_FILE_OUTSIDE =
- const HintCode('FILE_IMPORT_INSIDE_LIB_REFERENCES_FILE_OUTSIDE',
- "A file in the 'lib' directory hierarchy shouldn't reference a file outside that hierarchy.");
+ const HintCode(
+ 'FILE_IMPORT_INSIDE_LIB_REFERENCES_FILE_OUTSIDE',
+ "A file in the 'lib' directory shouldn't import a file outside the "
+ "'lib' directory.",
+ "Try removing the import, or "
+ "moving the imported file inside the 'lib' directory.");
/**
* It is a bad practice for a source file ouside a package "lib" directory
@@ -2850,8 +3148,9 @@ class HintCode extends ErrorCode {
static const HintCode FILE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSIDE =
const HintCode(
'FILE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSIDE',
- "A file outside the 'lib' directory hierarchy shouldn't reference a "
- "file inside that hierarchy. Use a package: reference instead.");
+ "A file outside the 'lib' directory shouldn't reference a file "
+ "inside the 'lib' directory using a relative path.",
+ "Try using a package: URI instead.");
/**
* It is a bad practice for a package import to reference anything outside the
@@ -2987,8 +3286,11 @@ class StaticTypeWarningCode extends ErrorCode {
* 0: the number of provided type arguments
*/
static const StaticTypeWarningCode EXPECTED_ONE_LIST_TYPE_ARGUMENTS =
- const StaticTypeWarningCode('EXPECTED_ONE_LIST_TYPE_ARGUMENTS',
- "List literal requires exactly one type arguments or none, but {0} found.");
+ const StaticTypeWarningCode(
+ 'EXPECTED_ONE_LIST_TYPE_ARGUMENTS',
+ "List literals require exactly one type argument or none, "
+ "but {0} found.",
+ "Try adjusting the number of type arguments.");
/**
* 12.8 Maps: A fresh instance (7.6.1) <i>m</i>, of size <i>n</i>, whose class
@@ -2998,16 +3300,23 @@ class StaticTypeWarningCode extends ErrorCode {
* 0: the number of provided type arguments
*/
static const StaticTypeWarningCode EXPECTED_TWO_MAP_TYPE_ARGUMENTS =
- const StaticTypeWarningCode('EXPECTED_TWO_MAP_TYPE_ARGUMENTS',
- "Map literal requires exactly two type arguments or none, but {0} found.");
+ const StaticTypeWarningCode(
+ 'EXPECTED_TWO_MAP_TYPE_ARGUMENTS',
+ "Map literals require exactly two type arguments or none, "
+ "but {0} found.",
+ "Try adjusting the number of type arguments.");
/**
* 9 Functions: It is a static warning if the declared return type of a
* function marked async* may not be assigned to Stream.
*/
static const StaticTypeWarningCode ILLEGAL_ASYNC_GENERATOR_RETURN_TYPE =
- const StaticTypeWarningCode('ILLEGAL_ASYNC_GENERATOR_RETURN_TYPE',
- "Functions marked 'async*' must have a return type assignable to 'Stream'.");
+ const StaticTypeWarningCode(
+ 'ILLEGAL_ASYNC_GENERATOR_RETURN_TYPE',
+ "Functions marked 'async*' must have a return type assignable to "
+ "'Stream'.",
+ "Try fixing the return type of the function, or "
+ "removing the modifier 'async*' from the function body.");
/**
* 9 Functions: It is a static warning if the declared return type of a
@@ -3016,17 +3325,21 @@ class StaticTypeWarningCode extends ErrorCode {
static const StaticTypeWarningCode ILLEGAL_ASYNC_RETURN_TYPE =
const StaticTypeWarningCode(
'ILLEGAL_ASYNC_RETURN_TYPE',
- "Functions marked 'async' must have a return type assignable to 'Future'.",
+ "Functions marked 'async' must have a return type assignable to "
+ "'Future'.",
"Try fixing the return type of the function, or "
- "removing the keyword 'async' from the function body.");
+ "removing the modifier 'async' from the function body.");
/**
* 9 Functions: It is a static warning if the declared return type of a
* function marked sync* may not be assigned to Iterable.
*/
static const StaticTypeWarningCode ILLEGAL_SYNC_GENERATOR_RETURN_TYPE =
- const StaticTypeWarningCode('ILLEGAL_SYNC_GENERATOR_RETURN_TYPE',
- "Functions marked 'sync*' must have a return type assignable to 'Iterable'.");
+ const StaticTypeWarningCode(
+ 'ILLEGAL_SYNC_GENERATOR_RETURN_TYPE',
+ "Functions marked 'sync*' must have a return type assignable to 'Iterable'.",
+ "Try fixing the return type of the function, or "
+ "removing the modifier 'sync*' from the function body.");
/**
* 8.1.1 Inheritance and Overriding: However, if the above rules would cause
@@ -3057,8 +3370,11 @@ class StaticTypeWarningCode extends ErrorCode {
* m<sub>k</sub></i> is inherited.
*/
static const StaticTypeWarningCode INCONSISTENT_METHOD_INHERITANCE =
- const StaticTypeWarningCode('INCONSISTENT_METHOD_INHERITANCE',
- "'{0}' is inherited by at least two interfaces inconsistently, from {1}.");
+ const StaticTypeWarningCode(
+ 'INCONSISTENT_METHOD_INHERITANCE',
+ "Inconsistent declarations of '{0}' are inherited from {1}.",
+ "Try adjusting the supertypes of this class to remove the "
+ "inconsistency.");
/**
* 12.15.1 Ordinary Invocation: It is a static type warning if <i>T</i> does
@@ -3201,9 +3517,17 @@ class StaticTypeWarningCode extends ErrorCode {
const StaticTypeWarningCode('NON_BOOL_OPERAND',
"The operands of the '{0}' operator must be assignable to 'bool'.");
+ /**
+ * Parameters:
+ * 0: the name of the variable
+ * 1: the type of the variable
+ */
static const StaticTypeWarningCode NON_NULLABLE_FIELD_NOT_INITIALIZED =
- const StaticTypeWarningCode('NON_NULLABLE_FIELD_NOT_INITIALIZED',
- "Variable '{0}' of non-nullable type '{1}' must be initialized.");
+ const StaticTypeWarningCode(
+ 'NON_NULLABLE_FIELD_NOT_INITIALIZED',
+ "Variable '{0}' of non-nullable type '{1}' must be initialized.",
+ "Try adding an initializer to the declaration, or "
+ "making the variable nullable by adding a '?' after the type name.");
/**
* 15.8 Parameterized Types: It is a static type warning if <i>A<sub>i</sub>,
@@ -3260,7 +3584,9 @@ class StaticTypeWarningCode extends ErrorCode {
*/
static const StaticTypeWarningCode TYPE_ARGUMENT_NOT_MATCHING_BOUNDS =
const StaticTypeWarningCode(
- 'TYPE_ARGUMENT_NOT_MATCHING_BOUNDS', "'{0}' doesn't extend '{1}'.");
+ 'TYPE_ARGUMENT_NOT_MATCHING_BOUNDS',
+ "'{0}' doesn't extend '{1}'.",
+ "Try using a type that is or is a subclass of '{1}'.");
/**
* 10 Generics: It is a static type warning if a type parameter is a supertype
@@ -3268,12 +3594,15 @@ class StaticTypeWarningCode extends ErrorCode {
*
* Parameters:
* 0: the name of the type parameter
+ * 1: the name of the bounding type
*
* See [TYPE_ARGUMENT_NOT_MATCHING_BOUNDS].
*/
static const StaticTypeWarningCode TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND =
- const StaticTypeWarningCode('TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND',
- "'{0}' can't be a supertype of its upper bound.");
+ const StaticTypeWarningCode(
+ 'TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND',
+ "'{0}' can't be a supertype of its upper bound.",
+ "Try using a type that is or is a subclass of '{1}'.");
/**
* 12.17 Getter Invocation: It is a static warning if there is no class
@@ -3508,8 +3837,11 @@ class StaticTypeWarningCode extends ErrorCode {
* [CompileTimeErrorCode.NEW_WITH_INVALID_TYPE_PARAMETERS].
*/
static const StaticTypeWarningCode WRONG_NUMBER_OF_TYPE_ARGUMENTS =
- const StaticTypeWarningCode('WRONG_NUMBER_OF_TYPE_ARGUMENTS',
- "The type '{0}' is declared with {1} type parameters, but {2} type arguments were given.");
+ const StaticTypeWarningCode(
+ 'WRONG_NUMBER_OF_TYPE_ARGUMENTS',
+ "The type '{0}' is declared with {1} type parameters, "
+ "but {2} type arguments were given.",
+ "Try adjusting the number of type arguments.");
/**
* 17.16.1 Yield: Let T be the static type of e [the expression to the right
@@ -3530,8 +3862,10 @@ class StaticTypeWarningCode extends ErrorCode {
* T may not be assigned to Stream.
*/
static const StaticTypeWarningCode YIELD_OF_INVALID_TYPE =
- const StaticTypeWarningCode('YIELD_OF_INVALID_TYPE',
- "The type '{0}' implied by the 'yield' expression must be assignable to '{1}'.");
+ const StaticTypeWarningCode(
+ 'YIELD_OF_INVALID_TYPE',
+ "The type '{0}' implied by the 'yield' expression must be assignable "
+ "to '{1}'.");
/**
* 17.6.2 For-in. If the iterable expression does not implement Iterable,
@@ -3556,8 +3890,10 @@ class StaticTypeWarningCode extends ErrorCode {
* 2: The loop variable type.
*/
static const StaticTypeWarningCode FOR_IN_OF_INVALID_ELEMENT_TYPE =
- const StaticTypeWarningCode('FOR_IN_OF_INVALID_ELEMENT_TYPE',
- "The type '{0}' used in the 'for' loop must implement {1} with a type argument that can be assigned to '{2}'.");
+ const StaticTypeWarningCode(
+ 'FOR_IN_OF_INVALID_ELEMENT_TYPE',
+ "The type '{0}' used in the 'for' loop must implement {1} with a "
+ "type argument that can be assigned to '{2}'.");
/**
* Initialize a newly created error code to have the given [name]. The message
@@ -3643,7 +3979,10 @@ class StaticWarningCode extends ErrorCode {
* A constant variable is always implicitly final.
*/
static const StaticWarningCode ASSIGNMENT_TO_CONST = const StaticWarningCode(
- 'ASSIGNMENT_TO_CONST', "Constant variables can't be assigned a value.");
+ 'ASSIGNMENT_TO_CONST',
+ "Constant variables can't be assigned a value.",
+ "Try removing the assignment, or "
+ "remove the modifier 'const' from the variable.");
/**
* 5 Variables: Attempting to assign to a final variable elsewhere will cause
@@ -3661,8 +4000,11 @@ class StaticWarningCode extends ErrorCode {
* assignment will also give rise to a static warning for the same reason.
*/
static const StaticWarningCode ASSIGNMENT_TO_FINAL_NO_SETTER =
- const StaticWarningCode('ASSIGNMENT_TO_FINAL_NO_SETTER',
- "No setter named '{0}' in class '{1}'.");
+ const StaticWarningCode(
+ 'ASSIGNMENT_TO_FINAL_NO_SETTER',
+ "No setter named '{0}' in class '{1}'.",
+ "Try correcting the name to reference an existing setter, or "
+ "declare the setter.");
/**
* 12.18 Assignment: It is as static warning if an assignment of the form
@@ -3701,7 +4043,8 @@ class StaticWarningCode extends ErrorCode {
static const StaticWarningCode CASE_BLOCK_NOT_TERMINATED =
const StaticWarningCode(
'CASE_BLOCK_NOT_TERMINATED',
- "The last statement of the 'case' should be 'break', 'continue', 'return' or 'throw'.",
+ "The last statement of the 'case' should be 'break', 'continue', "
+ "'return' or 'throw'.",
"Try adding one of the required statements.");
/**
@@ -3742,8 +4085,10 @@ class StaticWarningCode extends ErrorCode {
* 2: the name of the non-dart: library in which the element is found
*/
static const StaticWarningCode CONFLICTING_DART_IMPORT =
- const StaticWarningCode('CONFLICTING_DART_IMPORT',
- "Element '{0}' from SDK library '{1}' is implicitly hidden by '{2}'.");
+ const StaticWarningCode(
+ 'CONFLICTING_DART_IMPORT',
+ "Element '{0}' from SDK library '{1}' is implicitly hidden by '{2}'.",
+ "Try adding an explicit hide combinator.");
/**
* 7.2 Getters: It is a static warning if a class <i>C</i> declares an
@@ -3757,23 +4102,30 @@ class StaticWarningCode extends ErrorCode {
CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_MEMBER =
const StaticWarningCode(
'CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_MEMBER',
- "Superclass '{0}' declares static member with the same name.");
+ "Superclass '{0}' declares static member with the same name.",
+ "Try renaming either the getter or the static member.");
/**
* 7.1 Instance Methods: It is a static warning if a class <i>C</i> declares
* an instance method named <i>n</i> and has a setter named <i>n=</i>.
*/
static const StaticWarningCode CONFLICTING_INSTANCE_METHOD_SETTER =
- const StaticWarningCode('CONFLICTING_INSTANCE_METHOD_SETTER',
- "Class '{0}' declares instance method '{1}', but also has a setter with the same name from '{2}'.");
+ const StaticWarningCode(
+ 'CONFLICTING_INSTANCE_METHOD_SETTER',
+ "Class '{0}' declares instance method '{1}', "
+ "but also has a setter with the same name from '{2}'.",
+ "Try renaming either the method or the setter.");
/**
* 7.1 Instance Methods: It is a static warning if a class <i>C</i> declares
* an instance method named <i>n</i> and has a setter named <i>n=</i>.
*/
static const StaticWarningCode CONFLICTING_INSTANCE_METHOD_SETTER2 =
- const StaticWarningCode('CONFLICTING_INSTANCE_METHOD_SETTER2',
- "Class '{0}' declares the setter '{1}', but also has an instance method in the same class.");
+ const StaticWarningCode(
+ 'CONFLICTING_INSTANCE_METHOD_SETTER2',
+ "Class '{0}' declares the setter '{1}', "
+ "but also has an instance method in the same class.",
+ "Try renaming either the method or the setter.");
/**
* 7.3 Setters: It is a static warning if a class <i>C</i> declares an
@@ -3787,23 +4139,28 @@ class StaticWarningCode extends ErrorCode {
CONFLICTING_INSTANCE_SETTER_AND_SUPERCLASS_MEMBER =
const StaticWarningCode(
'CONFLICTING_INSTANCE_SETTER_AND_SUPERCLASS_MEMBER',
- "Superclass '{0}' declares static member with the same name.");
+ "Superclass '{0}' declares a static member with the same name.",
+ "Try renaming either the setter or the inherited member.");
/**
* 7.2 Getters: It is a static warning if a class declares a static getter
* named <i>v</i> and also has a non-static setter named <i>v=</i>.
*/
static const StaticWarningCode CONFLICTING_STATIC_GETTER_AND_INSTANCE_SETTER =
- const StaticWarningCode('CONFLICTING_STATIC_GETTER_AND_INSTANCE_SETTER',
- "Class '{0}' declares non-static setter with the same name.");
+ const StaticWarningCode(
+ 'CONFLICTING_STATIC_GETTER_AND_INSTANCE_SETTER',
+ "Class '{0}' declares non-static setter with the same name.",
+ "Try renaming either the getter or the setter.");
/**
* 7.3 Setters: It is a static warning if a class declares a static setter
* named <i>v=</i> and also has a non-static member named <i>v</i>.
*/
static const StaticWarningCode CONFLICTING_STATIC_SETTER_AND_INSTANCE_MEMBER =
- const StaticWarningCode('CONFLICTING_STATIC_SETTER_AND_INSTANCE_MEMBER',
- "Class '{0}' declares non-static member with the same name.");
+ const StaticWarningCode(
+ 'CONFLICTING_STATIC_SETTER_AND_INSTANCE_MEMBER',
+ "Class '{0}' declares non-static member with the same name.",
+ "Try renaming either the inherited member or the setter.");
/**
* 16.12.2 Const: Given an instance creation expression of the form <i>const
@@ -3812,15 +4169,17 @@ class StaticWarningCode extends ErrorCode {
* factory constructor.
*/
static const StaticWarningCode CONST_WITH_ABSTRACT_CLASS =
- const StaticWarningCode('CONST_WITH_ABSTRACT_CLASS',
- "Abstract classes can't be created with a 'const' expression.");
+ const StaticWarningCode(
+ 'CONST_WITH_ABSTRACT_CLASS',
+ "Abstract classes can't be created with a 'const' expression.",
+ "Try creating an instance of a subtype.");
/**
* 12.7 Maps: It is a static warning if the values of any two keys in a map
* literal are equal.
*/
static const StaticWarningCode EQUAL_KEYS_IN_MAP = const StaticWarningCode(
- 'EQUAL_KEYS_IN_MAP', "Keys in a map can't be equal.");
+ 'EQUAL_KEYS_IN_MAP', "Two keys in a map literal can't be equal.");
/**
* 14.2 Exports: It is a static warning to export two different libraries with
@@ -3832,8 +4191,10 @@ class StaticWarningCode extends ErrorCode {
* 2:e the shared name of the exported libraries
*/
static const StaticWarningCode EXPORT_DUPLICATED_LIBRARY_NAMED =
- const StaticWarningCode('EXPORT_DUPLICATED_LIBRARY_NAMED',
- "The exported libraries '{0}' and '{1}' can't have the same name '{2}'.");
+ const StaticWarningCode(
+ 'EXPORT_DUPLICATED_LIBRARY_NAMED',
+ "The exported libraries '{0}' and '{1}' can't have the same name '{2}'.",
+ "Try adding a hide clause to one of the export directives.");
/**
* 12.14.2 Binding Actuals to Formals: It is a static warning if <i>m &lt;
@@ -3849,8 +4210,7 @@ class StaticWarningCode extends ErrorCode {
const StaticWarningCode(
'EXTRA_POSITIONAL_ARGUMENTS',
"{0} positional arguments expected, but {1} found.",
- "Try removing the extra positional arguments, or "
- "defining additional parameters.");
+ "Try removing the extra positional arguments.");
/**
* 5. Variables: It is a static warning if a final instance variable that has
@@ -3861,7 +4221,9 @@ class StaticWarningCode extends ErrorCode {
FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION =
const StaticWarningCode(
'FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION',
- "Values can't be set in the constructor if they are final and have already been set.");
+ "Fields can't be initialized in the constructor if they are final "
+ "and have already been initialized at their declaration.",
+ "Try removing one of the initializations.");
/**
* 5. Variables: It is a static warning if a final instance variable that has
@@ -3875,7 +4237,9 @@ class StaticWarningCode extends ErrorCode {
FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR =
const StaticWarningCode(
'FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR',
- "'{0}' is final and was given a value when it was declared, so it can't be set to a new value.");
+ "'{0}' is final and was given a value when it was declared, "
+ "so it can't be set to a new value.",
+ "Try removing one of the initializations.");
/**
* 7.6.1 Generative Constructors: Execution of an initializer of the form
@@ -3908,8 +4272,11 @@ class StaticWarningCode extends ErrorCode {
* 1: the name of the type of the field
*/
static const StaticWarningCode FIELD_INITIALIZING_FORMAL_NOT_ASSIGNABLE =
- const StaticWarningCode('FIELD_INITIALIZING_FORMAL_NOT_ASSIGNABLE',
- "The parameter type '{0}' is incompatable with the field type '{1}'.");
+ const StaticWarningCode(
+ 'FIELD_INITIALIZING_FORMAL_NOT_ASSIGNABLE',
+ "The parameter type '{0}' is incompatable with the field type '{1}'.",
+ "Try changing or removing the parameter's type, or "
+ "changing the field's type.");
/**
* 5 Variables: It is a static warning if a library, static or local variable
@@ -4008,8 +4375,10 @@ class StaticWarningCode extends ErrorCode {
* 2: the shared name of the imported libraries
*/
static const StaticWarningCode IMPORT_DUPLICATED_LIBRARY_NAMED =
- const StaticWarningCode('IMPORT_DUPLICATED_LIBRARY_NAMED',
- "The imported libraries '{0}' and '{1}' can't have the same name '{2}'.");
+ const StaticWarningCode(
+ 'IMPORT_DUPLICATED_LIBRARY_NAMED',
+ "The imported libraries '{0}' and '{1}' can't have the same name '{2}'.",
+ "Try adding a hide clause to one of the imports.");
/**
* 14.1 Imports: It is a static warning if the specified URI of a deferred
@@ -4021,8 +4390,10 @@ class StaticWarningCode extends ErrorCode {
* See [CompileTimeErrorCode.IMPORT_OF_NON_LIBRARY].
*/
static const StaticWarningCode IMPORT_OF_NON_LIBRARY =
- const StaticWarningCode('IMPORT_OF_NON_LIBRARY',
- "The imported library '{0}' can't have a part-of directive.");
+ const StaticWarningCode(
+ 'IMPORT_OF_NON_LIBRARY',
+ "The imported library '{0}' can't have a part-of directive.",
+ "Try importing the library that the part is a part of.");
/**
* 8.1.1 Inheritance and Overriding: However, if the above rules would cause
@@ -4039,7 +4410,9 @@ class StaticWarningCode extends ErrorCode {
INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_METHOD =
const StaticWarningCode(
'INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_METHOD',
- "'{0}' is inherited as a getter and also a method.");
+ "'{0}' is inherited as a getter and also a method.",
+ "Try adjusting the supertypes of this class to remove the "
+ "inconsistency.");
/**
* 7.1 Instance Methods: It is a static warning if a class <i>C</i> declares
@@ -4054,7 +4427,8 @@ class StaticWarningCode extends ErrorCode {
INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLASS_STATIC =
const StaticWarningCode(
'INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLASS_STATIC',
- "'{0}' collides with a static member in the superclass '{1}'.");
+ "'{0}' collides with a static member in the superclass '{1}'.",
+ "Try renaming either the method or the inherited member.");
/**
* 7.2 Getters: It is a static warning if a getter <i>m1</i> overrides a
@@ -4070,8 +4444,11 @@ class StaticWarningCode extends ErrorCode {
* See [INVALID_METHOD_OVERRIDE_RETURN_TYPE].
*/
static const StaticWarningCode INVALID_GETTER_OVERRIDE_RETURN_TYPE =
- const StaticWarningCode('INVALID_GETTER_OVERRIDE_RETURN_TYPE',
- "The return type '{0}' isn't assignable to '{1}' as required by the getter it is overriding from '{2}'.");
+ const StaticWarningCode(
+ 'INVALID_GETTER_OVERRIDE_RETURN_TYPE',
+ "The return type '{0}' isn't assignable to '{1}' as required by the "
+ "getter it is overriding from '{2}'.",
+ "Try changing the return types so that they are compatible.");
/**
* 7.1 Instance Methods: It is a static warning if an instance method
@@ -4085,8 +4462,11 @@ class StaticWarningCode extends ErrorCode {
* 2: the name of the class where the overridden method is declared
*/
static const StaticWarningCode INVALID_METHOD_OVERRIDE_NAMED_PARAM_TYPE =
- const StaticWarningCode('INVALID_METHOD_OVERRIDE_NAMED_PARAM_TYPE',
- "The parameter type '{0}' isn't assignable to '{1}' as required by the method it is overriding from '{2}'.");
+ const StaticWarningCode(
+ 'INVALID_METHOD_OVERRIDE_NAMED_PARAM_TYPE',
+ "The parameter type '{0}' isn't assignable to '{1}' as required by "
+ "the method it is overriding from '{2}'.",
+ "Try changing the parameter types so that they are compatible.");
/**
* Generic Method DEP: number of type parameters must match.
@@ -4098,8 +4478,11 @@ class StaticWarningCode extends ErrorCode {
* 2: the name of the class where the overridden method is declared
*/
static const StaticWarningCode INVALID_METHOD_OVERRIDE_TYPE_PARAMETERS =
- const StaticWarningCode('INVALID_METHOD_OVERRIDE_TYPE_PARAMETERS',
- "The method has {0} type parameters, but it is overriding a method with {1} type parameters from '{2}'.");
+ const StaticWarningCode(
+ 'INVALID_METHOD_OVERRIDE_TYPE_PARAMETERS',
+ "The method has {0} type parameters, but it is overriding a method "
+ "with {1} type parameters from '{2}'.",
+ "Try changing the number of type parameters so that they are the same.");
/**
* Generic Method DEP: bounds of type parameters must be compatible.
@@ -4113,8 +4496,11 @@ class StaticWarningCode extends ErrorCode {
* 4: the name of the class where the overridden method is declared
*/
static const StaticWarningCode INVALID_METHOD_OVERRIDE_TYPE_PARAMETER_BOUND =
- const StaticWarningCode('INVALID_METHOD_OVERRIDE_TYPE_PARAMETER_BOUND',
- "The type parameter '{0}' extends '{1}', but that is stricter than '{2}' extends '{3}' in the overridden method from '{4}'.");
+ const StaticWarningCode(
+ 'INVALID_METHOD_OVERRIDE_TYPE_PARAMETER_BOUND',
+ "The type parameter '{0}' extends '{1}', but that is stricter than "
+ "'{2}' extends '{3}' in the overridden method from '{4}'.",
+ "Try changing the bounds on the type parameters so that they are compatible.");
/**
* 7.1 Instance Methods: It is a static warning if an instance method
@@ -4129,8 +4515,11 @@ class StaticWarningCode extends ErrorCode {
* See [INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE].
*/
static const StaticWarningCode INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE =
- const StaticWarningCode('INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE',
- "The parameter type '{0}' isn't assignable to '{1}' as required by the method it is overriding from '{2}'.");
+ const StaticWarningCode(
+ 'INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE',
+ "The parameter type '{0}' isn't assignable to '{1}' as required by "
+ "the method it is overriding from '{2}'.",
+ "Try changing the parameter types so that they are compatible.");
/**
* 7.1 Instance Methods: It is a static warning if an instance method
@@ -4144,8 +4533,11 @@ class StaticWarningCode extends ErrorCode {
* 2: the name of the class where the overridden method is declared
*/
static const StaticWarningCode INVALID_METHOD_OVERRIDE_OPTIONAL_PARAM_TYPE =
- const StaticWarningCode('INVALID_METHOD_OVERRIDE_OPTIONAL_PARAM_TYPE',
- "The parameter type '{0}' isn't assignable to '{1}' as required by the method it is overriding from '{2}'.");
+ const StaticWarningCode(
+ 'INVALID_METHOD_OVERRIDE_OPTIONAL_PARAM_TYPE',
+ "The parameter type '{0}' isn't assignable to '{1}' as required by "
+ "the method it is overriding from '{2}'.",
+ "Try changing the parameter types so that they are compatible.");
/**
* 7.1 Instance Methods: It is a static warning if an instance method
@@ -4161,8 +4553,11 @@ class StaticWarningCode extends ErrorCode {
* See [INVALID_GETTER_OVERRIDE_RETURN_TYPE].
*/
static const StaticWarningCode INVALID_METHOD_OVERRIDE_RETURN_TYPE =
- const StaticWarningCode('INVALID_METHOD_OVERRIDE_RETURN_TYPE',
- "The return type '{0}' isn't assignable to '{1}' as required by the method it is overriding from '{2}'.");
+ const StaticWarningCode(
+ 'INVALID_METHOD_OVERRIDE_RETURN_TYPE',
+ "The return type '{0}' isn't assignable to '{1}' as required by the "
+ "method it is overriding from '{2}'.",
+ "Try changing the return types so that they are compatible.");
/**
* 7.1 Instance Methods: It is a static warning if an instance method
@@ -4174,7 +4569,9 @@ class StaticWarningCode extends ErrorCode {
static const StaticWarningCode
INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_NAMED = const StaticWarningCode(
'INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_NAMED',
- "Parameters can't override default values, this method overrides '{0}.{1}' where '{2}' has a different value.");
+ "Parameters can't override default values, "
+ "this method overrides '{0}.{1}' where '{2}' has a different value.",
+ "Try using the same default value in both methods.");
/**
* 7.1 Instance Methods: It is a static warning if an instance method
@@ -4187,7 +4584,9 @@ class StaticWarningCode extends ErrorCode {
INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_POSITIONAL =
const StaticWarningCode(
'INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_POSITIONAL',
- "Parameters can't override default values, this method overrides '{0}.{1}' where this positional parameter has a different value.");
+ "Parameters can't override default values, this method overrides "
+ "'{0}.{1}' where this positional parameter has a different value.",
+ "Try using the same default value in both methods.");
/**
* 7.1 Instance Methods: It is a static warning if an instance method
@@ -4199,9 +4598,13 @@ class StaticWarningCode extends ErrorCode {
* 1: the signature of the overridden member
* 2: the name of the class from the overridden method
*/
- static const StaticWarningCode INVALID_OVERRIDE_NAMED = const StaticWarningCode(
- 'INVALID_OVERRIDE_NAMED',
- "Missing the named parameter '{0}' to match the overridden method from '{1}' from '{2}'.");
+ static const StaticWarningCode INVALID_OVERRIDE_NAMED =
+ const StaticWarningCode(
+ 'INVALID_OVERRIDE_NAMED',
+ "Missing the named parameter '{0}' "
+ "to match the overridden method from '{1}' from '{2}'.",
+ "Try adding the named parameter to this method, or "
+ "removing it from the overridden method.");
/**
* 7.1 Instance Methods: It is a static warning if an instance method
@@ -4214,8 +4617,11 @@ class StaticWarningCode extends ErrorCode {
* 2: the name of the class from the overridden method
*/
static const StaticWarningCode INVALID_OVERRIDE_POSITIONAL =
- const StaticWarningCode('INVALID_OVERRIDE_POSITIONAL',
- "Must have at least {0} parameters to match the overridden method '{1}' from '{2}'.");
+ const StaticWarningCode(
+ 'INVALID_OVERRIDE_POSITIONAL',
+ "Must have at least {0} parameters "
+ "to match the overridden method '{1}' from '{2}'.",
+ "Try adding the necessary parameters.");
/**
* 7.1 Instance Methods: It is a static warning if an instance method
@@ -4228,8 +4634,11 @@ class StaticWarningCode extends ErrorCode {
* 2: the name of the class from the overridden method
*/
static const StaticWarningCode INVALID_OVERRIDE_REQUIRED =
- const StaticWarningCode('INVALID_OVERRIDE_REQUIRED',
- "Must have {0} required parameters or less to match the overridden method '{1}' from '{2}'.");
+ const StaticWarningCode(
+ 'INVALID_OVERRIDE_REQUIRED',
+ "Must have {0} required parameters or less "
+ "to match the overridden method '{1}' from '{2}'.",
+ "Try removing the extra parameters.");
/**
* 7.3 Setters: It is a static warning if a setter <i>m1</i> overrides a
@@ -4245,8 +4654,11 @@ class StaticWarningCode extends ErrorCode {
* See [INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE].
*/
static const StaticWarningCode INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE =
- const StaticWarningCode('INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE',
- "The parameter type '{0}' isn't assignable to '{1}' as required by the setter it is overriding from '{2}'.");
+ const StaticWarningCode(
+ 'INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE',
+ "The parameter type '{0}' isn't assignable to '{1}' as required by "
+ "the setter it is overriding from '{2}'.",
+ "Try changing the parameter types so that they are compatible.");
/**
* 12.6 Lists: A run-time list literal &lt;<i>E</i>&gt; [<i>e<sub>1</sub></i>
@@ -4311,8 +4723,9 @@ class StaticWarningCode extends ErrorCode {
static const StaticWarningCode MISMATCHED_GETTER_AND_SETTER_TYPES =
const StaticWarningCode(
'MISMATCHED_GETTER_AND_SETTER_TYPES',
- "The parameter type for setter '{0}' is '{1}' which isn't assignable to its getter (of type '{2}').",
- null,
+ "The parameter type for setter '{0}' is '{1}' which isn't assignable "
+ "to its getter (of type '{2}').",
+ "Try changing the types so that they are compatible.",
false);
/**
@@ -4324,8 +4737,9 @@ class StaticWarningCode extends ErrorCode {
MISMATCHED_GETTER_AND_SETTER_TYPES_FROM_SUPERTYPE =
const StaticWarningCode(
'MISMATCHED_GETTER_AND_SETTER_TYPES_FROM_SUPERTYPE',
- "The parameter type for setter '{0}' is '{1}' which isn't assignable to its getter (of type '{2}'), from superclass '{3}'.",
- null,
+ "The parameter type for setter '{0}' is '{1}' which isn't assignable "
+ "to its getter (of type '{2}'), from superclass '{3}'.",
+ "Try changing the types so that they are compatible.",
false);
/**
@@ -4345,7 +4759,8 @@ class StaticWarningCode extends ErrorCode {
const StaticWarningCode(
'MISSING_ENUM_CONSTANT_IN_SWITCH',
"Missing case clause for '{0}'.",
- "Add a case clause for the missing constant or add a default clause.",
+ "Try adding a case clause for the missing constant, or "
+ "adding a default clause.",
false);
/**
@@ -4355,8 +4770,11 @@ class StaticWarningCode extends ErrorCode {
*/
static const StaticWarningCode MIXED_RETURN_TYPES = const StaticWarningCode(
'MIXED_RETURN_TYPES',
- "Methods and functions can't use return both with and without values.",
- null,
+ "Functions can't include return statements both with and without values.",
+ // TODO(brianwilkerson) Split this error code depending on whether the
+ // function declares a return type.
+ "Try making all the return statements consistent "
+ "(either include a value or not).",
false);
/**
@@ -4364,8 +4782,10 @@ class StaticWarningCode extends ErrorCode {
* abstract class and <i>q</i> is not a factory constructor.
*/
static const StaticWarningCode NEW_WITH_ABSTRACT_CLASS =
- const StaticWarningCode('NEW_WITH_ABSTRACT_CLASS',
- "Abstract classes can't be created with a 'new' expression.");
+ const StaticWarningCode(
+ 'NEW_WITH_ABSTRACT_CLASS',
+ "Abstract classes can't be created with a 'new' expression.",
+ "Try creating an instance of a subtype.");
/**
* 15.8 Parameterized Types: Any use of a malbounded type gives rise to a
@@ -4380,8 +4800,11 @@ class StaticWarningCode extends ErrorCode {
* [StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS].
*/
static const StaticWarningCode NEW_WITH_INVALID_TYPE_PARAMETERS =
- const StaticWarningCode('NEW_WITH_INVALID_TYPE_PARAMETERS',
- "The type '{0}' is declared with {1} type parameters, but {2} type arguments were given.");
+ const StaticWarningCode(
+ 'NEW_WITH_INVALID_TYPE_PARAMETERS',
+ "The type '{0}' is declared with {1} type parameters, "
+ "but {2} type arguments were given.",
+ "Try adjusting the number of type arguments.");
/**
* 12.11.1 New: It is a static warning if <i>T</i> is not a class accessible
@@ -4391,7 +4814,9 @@ class StaticWarningCode extends ErrorCode {
* 0: the name of the non-type element
*/
static const StaticWarningCode NEW_WITH_NON_TYPE = const StaticWarningCode(
- 'NEW_WITH_NON_TYPE', "The name '{0}' isn't a class.");
+ 'NEW_WITH_NON_TYPE',
+ "The name '{0}' isn't a class.",
+ "Try correcting the name to match an existing class.");
/**
* 12.11.1 New: If <i>T</i> is a class or parameterized type accessible in the
@@ -4426,8 +4851,10 @@ class StaticWarningCode extends ErrorCode {
* same name as the declaration of <i>T</i>.
*/
static const StaticWarningCode NEW_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT =
- const StaticWarningCode('NEW_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT',
- "The class '{0}' doesn't have a default constructor.");
+ const StaticWarningCode(
+ 'NEW_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT',
+ "The class '{0}' doesn't have a default constructor.",
+ "Try using one of the named constructors defined in '{0}'.");
/**
* 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract
@@ -4568,8 +4995,10 @@ class StaticWarningCode extends ErrorCode {
* 0: the name of the non-type element
*/
static const StaticWarningCode NON_TYPE_IN_CATCH_CLAUSE =
- const StaticWarningCode('NON_TYPE_IN_CATCH_CLAUSE',
- "The name '{0}' isn't a type and can't be used in an on-catch clause.");
+ const StaticWarningCode(
+ 'NON_TYPE_IN_CATCH_CLAUSE',
+ "The name '{0}' isn't a type and can't be used in an on-catch clause.",
+ "Try correcting the name to match an existing class.");
/**
* 7.1.1 Operators: It is a static warning if the return type of the
@@ -4609,8 +5038,10 @@ class StaticWarningCode extends ErrorCode {
* Parameters:
* 0: the name that is not a type
*/
- static const StaticWarningCode NOT_A_TYPE =
- const StaticWarningCode('NOT_A_TYPE', "{0} isn't a type.");
+ static const StaticWarningCode NOT_A_TYPE = const StaticWarningCode(
+ 'NOT_A_TYPE',
+ "{0} isn't a type.",
+ "Try correcting the name to match an existing type.");
/**
* 12.14.2 Binding Actuals to Formals: It is a static warning if <i>m &lt;
@@ -4638,8 +5069,11 @@ class StaticWarningCode extends ErrorCode {
* 1: the non-matching actual library name from the "part of" declaration
*/
static const StaticWarningCode PART_OF_DIFFERENT_LIBRARY =
- const StaticWarningCode('PART_OF_DIFFERENT_LIBRARY',
- "Expected this library to be part of '{0}', not '{1}'.");
+ const StaticWarningCode(
+ 'PART_OF_DIFFERENT_LIBRARY',
+ "Expected this library to be part of '{0}', not '{1}'.",
+ "Try including a different part, or "
+ "changing the name of the library in the part's part-of directive.");
/**
* 7.6.2 Factories: It is a static warning if the function type of <i>k'</i>
@@ -4650,20 +5084,26 @@ class StaticWarningCode extends ErrorCode {
* 1: the name of the redirecting constructor
*/
static const StaticWarningCode REDIRECT_TO_INVALID_FUNCTION_TYPE =
- const StaticWarningCode('REDIRECT_TO_INVALID_FUNCTION_TYPE',
- "The redirected constructor '{0}' has incompatible parameters with '{1}'.");
+ const StaticWarningCode(
+ 'REDIRECT_TO_INVALID_FUNCTION_TYPE',
+ "The redirected constructor '{0}' has incompatible parameters with '{1}'.",
+ "Try redirecting to a different constructor, or "
+ "directly invoking the desired constructor rather than redirecting to it.");
/**
* 7.6.2 Factories: It is a static warning if the function type of <i>k'</i>
* is not a subtype of the type of <i>k</i>.
*
* Parameters:
- * 0: the name of the redirected constructor return type
- * 1: the name of the redirecting constructor return type
+ * 0: the name of the redirected constructor's return type
+ * 1: the name of the redirecting constructor's return type
*/
static const StaticWarningCode REDIRECT_TO_INVALID_RETURN_TYPE =
- const StaticWarningCode('REDIRECT_TO_INVALID_RETURN_TYPE',
- "The return type '{0}' of the redirected constructor isn't assignable to '{1}'.");
+ const StaticWarningCode(
+ 'REDIRECT_TO_INVALID_RETURN_TYPE',
+ "The return type '{0}' of the redirected constructor isn't assignable to '{1}'.",
+ "Try redirecting to a different constructor, or "
+ "directly invoking the desired constructor rather than redirecting to it.");
/**
* 7.6.2 Factories: It is a static warning if type does not denote a class
@@ -4672,8 +5112,11 @@ class StaticWarningCode extends ErrorCode {
* <i>type.id</i>) is not a constructor of <i>C</i>.
*/
static const StaticWarningCode REDIRECT_TO_MISSING_CONSTRUCTOR =
- const StaticWarningCode('REDIRECT_TO_MISSING_CONSTRUCTOR',
- "The constructor '{0}' couldn't be found in '{1}'.");
+ const StaticWarningCode(
+ 'REDIRECT_TO_MISSING_CONSTRUCTOR',
+ "The constructor '{0}' couldn't be found in '{1}'.",
+ "Try correcting the constructor name to an existing constructor, or "
+ "defining the constructor in '{1}'.");
/**
* 7.6.2 Factories: It is a static warning if type does not denote a class
@@ -4683,7 +5126,8 @@ class StaticWarningCode extends ErrorCode {
*/
static const StaticWarningCode REDIRECT_TO_NON_CLASS = const StaticWarningCode(
'REDIRECT_TO_NON_CLASS',
- "The name '{0}' isn't a type and can't be used in a redirected constructor.");
+ "The name '{0}' isn't a type and can't be used in a redirected constructor.",
+ "Try correcting the name to match an existing class.");
/**
* 13.12 Return: Let <i>f</i> be the function immediately enclosing a return
@@ -4714,8 +5158,10 @@ class StaticWarningCode extends ErrorCode {
* assigned to the type of <i>e<sub>k</sub></i>.
*/
static const StaticWarningCode SWITCH_EXPRESSION_NOT_ASSIGNABLE =
- const StaticWarningCode('SWITCH_EXPRESSION_NOT_ASSIGNABLE',
- "Type '{0}' of the switch expression isn't assignable to the type '{1}' of case expressions.");
+ const StaticWarningCode(
+ 'SWITCH_EXPRESSION_NOT_ASSIGNABLE',
+ "Type '{0}' of the switch expression isn't assignable to "
+ "the type '{1}' of case expressions.");
/**
* 15.1 Static Types: It is a static warning to use a deferred type in a type
@@ -4726,16 +5172,21 @@ class StaticWarningCode extends ErrorCode {
* annotation
*/
static const StaticWarningCode TYPE_ANNOTATION_DEFERRED_CLASS =
- const StaticWarningCode('TYPE_ANNOTATION_DEFERRED_CLASS',
- "The deferred type '{0}' can't be used in a declaration, cast or type test.");
+ const StaticWarningCode(
+ 'TYPE_ANNOTATION_DEFERRED_CLASS',
+ "The deferred type '{0}' can't be used in a declaration, cast or type test.",
+ "Try using a different type, or "
+ "changing the import to not be deferred.");
/**
* 12.31 Type Test: It is a static warning if <i>T</i> does not denote a type
* available in the current lexical scope.
*/
static const StaticWarningCode TYPE_TEST_WITH_NON_TYPE =
- const StaticWarningCode('TYPE_TEST_WITH_NON_TYPE',
- "The name '{0}' isn't a type and can't be used in an 'is' expression.");
+ const StaticWarningCode(
+ 'TYPE_TEST_WITH_NON_TYPE',
+ "The name '{0}' isn't a type and can't be used in an 'is' expression.",
+ "Try correcting the name to match an existing type.");
/**
* 12.31 Type Test: It is a static warning if <i>T</i> does not denote a type
@@ -4836,8 +5287,11 @@ class StaticWarningCode extends ErrorCode {
* 0: the name of the requested named parameter
*/
static const StaticWarningCode UNDEFINED_NAMED_PARAMETER =
- const StaticWarningCode('UNDEFINED_NAMED_PARAMETER',
- "The named parameter '{0}' isn't defined.");
+ const StaticWarningCode(
+ 'UNDEFINED_NAMED_PARAMETER',
+ "The named parameter '{0}' isn't defined.",
+ "Try correcting the name to an existing named parameter, or "
+ "defining a new parameter with this name.");
/**
* 12.18 Assignment: It is as static warning if an assignment of the form
@@ -4868,8 +5322,11 @@ class StaticWarningCode extends ErrorCode {
* 1: the name of the enclosing type where the method is being looked for
*/
static const StaticWarningCode UNDEFINED_STATIC_METHOD_OR_GETTER =
- const StaticWarningCode('UNDEFINED_STATIC_METHOD_OR_GETTER',
- "The static method, getter or setter '{0}' isn't defined for the class '{1}'.");
+ const StaticWarningCode(
+ 'UNDEFINED_STATIC_METHOD_OR_GETTER',
+ "The static method, getter or setter '{0}' isn't defined for the class '{1}'.",
+ "Try correcting the name to an existing member, or "
+ "defining the member in '{1}'.");
/**
* 12.17 Getter Invocation: It is a static warning if there is no class
@@ -4881,8 +5338,11 @@ class StaticWarningCode extends ErrorCode {
* 1: the name of the enclosing type where the getter is being looked for
*/
static const StaticWarningCode UNDEFINED_SUPER_GETTER =
- const StaticWarningCode('UNDEFINED_SUPER_GETTER',
- "The getter '{0}' isn't defined in a superclass of '{1}'.");
+ const StaticWarningCode(
+ 'UNDEFINED_SUPER_GETTER',
+ "The getter '{0}' isn't defined in a superclass of '{1}'.",
+ "Try correcting the name to an existing getter, or "
+ "defining the getter in a superclass of '{1}'.");
/**
* 12.18 Assignment: It is as static warning if an assignment of the form
@@ -4900,8 +5360,11 @@ class StaticWarningCode extends ErrorCode {
* 1: the name of the enclosing type where the setter is being looked for
*/
static const StaticWarningCode UNDEFINED_SUPER_SETTER =
- const StaticWarningCode('UNDEFINED_SUPER_SETTER',
- "The setter '{0}' isn't defined in a superclass of '{1}'.");
+ const StaticWarningCode(
+ 'UNDEFINED_SUPER_SETTER',
+ "The setter '{0}' isn't defined in a superclass of '{1}'.",
+ "Try correcting the name to an existing setter, or "
+ "defining the setter in a superclass of '{1}'.");
/**
* 7.2 Getters: It is a static warning if the return type of a getter is void.
@@ -5023,7 +5486,7 @@ class StrongModeCode extends ErrorCode {
static const StrongModeCode STATIC_TYPE_ERROR = const StrongModeCode(
ErrorType.COMPILE_TIME_ERROR,
'STATIC_TYPE_ERROR',
- "Type check failed: '{0}' ('{1}') isn't of type '{2}'");
+ "Type check failed: '{0}' ('{1}') isn't of type '{2}'.");
static const StrongModeCode INVALID_SUPER_INVOCATION = const StrongModeCode(
ErrorType.COMPILE_TIME_ERROR,
« no previous file with comments | « pkg/analyzer/lib/src/dart/error/syntactic_errors.dart ('k') | pkg/analyzer/lib/src/generated/error_verifier.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698