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

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

Issue 2426583003: Improve error messages and add many corrections (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 7d9eec5a84b97e3da242c27e3ac0e2a77deb78a9..35d71169cbc9c410f257d456eeba298e2c6ce76c 100644
--- a/pkg/analyzer/lib/src/error/codes.dart
+++ b/pkg/analyzer/lib/src/error/codes.dart
@@ -54,8 +54,10 @@ class AnalysisOptionsWarningCode extends ErrorCode {
* 2: legal values
*/
static const AnalysisOptionsWarningCode UNSUPPORTED_OPTION_WITH_LEGAL_VALUES =
- const AnalysisOptionsWarningCode('UNSUPPORTED_OPTION_WITH_LEGAL_VALUES',
- "The option '{1}' is not supported by {0}, supported values are {2}");
+ const AnalysisOptionsWarningCode(
+ 'UNSUPPORTED_OPTION_WITH_LEGAL_VALUES',
+ "The option '{1}' isn't supported by {0}.",
+ "Try using one of the supported options: {2}.");
/**
* An error code indicating that a plugin is being configured with an
@@ -67,8 +69,10 @@ class AnalysisOptionsWarningCode extends ErrorCode {
* 2: the legal value
*/
static const AnalysisOptionsWarningCode UNSUPPORTED_OPTION_WITH_LEGAL_VALUE =
- const AnalysisOptionsWarningCode('UNSUPPORTED_OPTION_WITH_LEGAL_VALUE',
- "The option '{1}' is not supported by {0}, did you mean {2}?");
+ const AnalysisOptionsWarningCode(
+ 'UNSUPPORTED_OPTION_WITH_LEGAL_VALUE',
+ "The option '{1}' isn't supported by {0}."
+ "Try using the only supported option: '{2}'.");
/**
* An error code indicating that an option entry is being configured with an
@@ -80,8 +84,10 @@ class AnalysisOptionsWarningCode extends ErrorCode {
* 2: legal values
*/
static const AnalysisOptionsWarningCode UNSUPPORTED_VALUE =
- const AnalysisOptionsWarningCode('UNSUPPORTED_VALUE',
- "The value '{1}' is not supported by {0}, legal values are {2}");
+ const AnalysisOptionsWarningCode(
+ 'UNSUPPORTED_VALUE',
+ "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
@@ -92,7 +98,7 @@ class AnalysisOptionsWarningCode extends ErrorCode {
*/
static const AnalysisOptionsWarningCode UNRECOGNIZED_ERROR_CODE =
const AnalysisOptionsWarningCode(
- 'UNRECOGNIZED_ERROR_CODE', "'{0}' is not 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].
@@ -125,31 +131,31 @@ class CheckedModeCompileTimeErrorCode extends ErrorCode {
// errors.
/**
- * 12.11.2 Const: It is a compile-time error if evaluation of a constant
+ * 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
CONST_CONSTRUCTOR_FIELD_TYPE_MISMATCH =
const CheckedModeCompileTimeErrorCode(
'CONST_CONSTRUCTOR_FIELD_TYPE_MISMATCH',
- "The object type '{0}' cannot 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}'.");
/**
- * 12.11.2 Const: It is a compile-time error if evaluation of a constant
+ * 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
CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH =
const CheckedModeCompileTimeErrorCode(
'CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH',
- "The object type '{0}' cannot 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
* if o is not <b>null</b> and the interface of the class of <i>o</i> is not a
* subtype of the static type of the field <i>v</i>.
*
- * 12.11.2 Const: It is a compile-time error if evaluation of a constant
+ * 16.12.2 Const: It is a compile-time error if evaluation of a constant
* object results in an uncaught exception being thrown.
*
* Parameters:
@@ -160,7 +166,7 @@ class CheckedModeCompileTimeErrorCode extends ErrorCode {
CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE =
const CheckedModeCompileTimeErrorCode(
'CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE',
- "The initializer type '{0}' cannot 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>
@@ -178,7 +184,7 @@ class CheckedModeCompileTimeErrorCode extends ErrorCode {
static const CheckedModeCompileTimeErrorCode
LIST_ELEMENT_TYPE_NOT_ASSIGNABLE = const CheckedModeCompileTimeErrorCode(
'LIST_ELEMENT_TYPE_NOT_ASSIGNABLE',
- "The element type '{0}' cannot be assigned to the list type '{1}'");
+ "The element type '{0}' can't be assigned to the list type '{1}'.");
/**
* 12.7 Map: A run-time map literal &lt;<i>K</i>, <i>V</i>&gt;
@@ -197,7 +203,7 @@ class CheckedModeCompileTimeErrorCode extends ErrorCode {
*/
static const CheckedModeCompileTimeErrorCode MAP_KEY_TYPE_NOT_ASSIGNABLE =
const CheckedModeCompileTimeErrorCode('MAP_KEY_TYPE_NOT_ASSIGNABLE',
- "The element type '{0}' cannot be assigned to the map key type '{1}'");
+ "The element type '{0}' can't be assigned to the map key type '{1}'.");
/**
* 12.7 Map: A run-time map literal &lt;<i>K</i>, <i>V</i>&gt;
@@ -216,15 +222,15 @@ class CheckedModeCompileTimeErrorCode extends ErrorCode {
*/
static const CheckedModeCompileTimeErrorCode MAP_VALUE_TYPE_NOT_ASSIGNABLE =
const CheckedModeCompileTimeErrorCode('MAP_VALUE_TYPE_NOT_ASSIGNABLE',
- "The element type '{0}' cannot be assigned to the map value type '{1}'");
+ "The element type '{0}' can't be assigned to the map value type '{1}'.");
/**
- * 12.11.2 Const: It is a compile-time error if evaluation of a constant
+ * 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',
- "The object type '{0}' cannot be assigned to a variable of type '{1}'");
+ "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
@@ -257,7 +263,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode ACCESS_PRIVATE_ENUM_FIELD =
const CompileTimeErrorCode('ACCESS_PRIVATE_ENUM_FIELD',
- "The private fields of an enum cannot be accessed, even within the same library");
+ "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
@@ -267,21 +273,24 @@ class CompileTimeErrorCode extends ErrorCode {
*
* Parameters:
* 0: the name of the ambiguous element
- * 1: the name of the first library that the type is found
- * 2: the name of the second library that the type is found
+ * 1: the name of the first library in which the type is found
+ * 2: the name of the second library in which the type is found
*/
static const CompileTimeErrorCode AMBIGUOUS_EXPORT =
- const CompileTimeErrorCode('AMBIGUOUS_EXPORT',
- "The name '{0}' is defined in the libraries '{1}' and '{2}'");
+ const CompileTimeErrorCode(
+ 'AMBIGUOUS_EXPORT',
+ "The name '{0}' is defined in the libraries '{1}' and '{2}'.",
+ "Try removing the export of one of the libraries, or "
+ "explicitly hiding the name in one of the export directives.");
/**
* 15 Metadata: The constant expression given in an annotation is type checked
* and evaluated in the scope surrounding the declaration being annotated.
*
- * 12.11.2 Const: It is a compile-time error if <i>T</i> is not a class
+ * 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.
*
- * 12.11.2 Const: If <i>e</i> is of the form <i>const T.id(a<sub>1</sub>,
+ * 16.12.2 Const: If <i>e</i> is of the form <i>const T.id(a<sub>1</sub>,
* &hellip;, a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n+1</sub>, &hellip;
* x<sub>n+k</sub>: a<sub>n+k</sub>)</i> it is a compile-time error if
* <i>T</i> is not a class accessible in the current scope, optionally
@@ -292,7 +301,11 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode ANNOTATION_WITH_NON_CLASS =
const CompileTimeErrorCode(
- 'ANNOTATION_WITH_NON_CLASS', "The name '{0}' is not a class");
+ 'ANNOTATION_WITH_NON_CLASS',
+ "The name '{0}' isn't a class.",
+ "Try importing the library that declares the class, "
+ "correcting the name to match a defined class, or "
+ "defining a class with the given name.");
/**
* 12.33 Argument Definition Test: It is a compile time error if <i>v</i> does
@@ -304,151 +317,212 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode ARGUMENT_DEFINITION_TEST_NON_PARAMETER =
const CompileTimeErrorCode(
- 'ARGUMENT_DEFINITION_TEST_NON_PARAMETER', "'{0}' is not a parameter");
+ 'ARGUMENT_DEFINITION_TEST_NON_PARAMETER', "'{0}' isn't a parameter.");
/**
- * ?? Asynchronous For-in: It is a compile-time error if an asynchronous
+ * 17.6.3 Asynchronous For-in: It is a compile-time error if an asynchronous
* for-in statement appears inside a synchronous function.
*/
static const CompileTimeErrorCode ASYNC_FOR_IN_WRONG_CONTEXT =
- const CompileTimeErrorCode('ASYNC_FOR_IN_WRONG_CONTEXT',
- "The asynchronous for-in can only be used in a function marked with async or async*");
+ const CompileTimeErrorCode(
+ 'ASYNC_FOR_IN_WRONG_CONTEXT',
+ "The asynchronous for-in can only be used in an asynchronous function.",
+ "Try marking the function body with either 'async' or 'async*', or "
+ "removing the 'await' before the for loop.");
/**
- * ??: It is a compile-time error if the function immediately enclosing a is
- * not declared asynchronous.
+ * 16.30 Await Expressions: It is a compile-time error if the function
+ * immediately enclosing _a_ is not declared asynchronous. (Where _a_ is the
+ * await expression.)
*/
static const CompileTimeErrorCode AWAIT_IN_WRONG_CONTEXT =
- const CompileTimeErrorCode('AWAIT_IN_WRONG_CONTEXT',
- "The await expression can only be used in a function marked as async or async*");
+ const CompileTimeErrorCode(
+ 'AWAIT_IN_WRONG_CONTEXT',
+ "The await expression can only be used in an asynchronous function.",
+ "Try marking the function body with either 'async' or 'async*'.");
/**
* 12.30 Identifier Reference: It is a compile-time error to use a built-in
* identifier other than dynamic as a type annotation.
+ *
+ * Parameters:
+ * 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}' cannot be used as a type");
+ "The built-in identifier '{0}' can't be used as a type.");
/**
* 12.30 Identifier Reference: It is a compile-time error if a built-in
* identifier is used as the declared name of a class, type parameter or type
* alias.
+ *
+ * Parameters:
+ * 0: the built-in identifier that is being used
*/
static const CompileTimeErrorCode BUILT_IN_IDENTIFIER_AS_TYPE_NAME =
- const CompileTimeErrorCode('BUILT_IN_IDENTIFIER_AS_TYPE_NAME',
- "The built-in identifier '{0}' cannot be used as a type name");
+ const CompileTimeErrorCode(
+ 'BUILT_IN_IDENTIFIER_AS_TYPE_NAME',
+ "The built-in identifier '{0}' can't be used as a type name.",
+ "Try choosing a different name for the type.");
/**
* 12.30 Identifier Reference: It is a compile-time error if a built-in
* identifier is used as the declared name of a class, type parameter or type
* alias.
+ *
+ * Parameters:
+ * 0: the built-in identifier that is being used
*/
static const CompileTimeErrorCode BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME =
- const CompileTimeErrorCode('BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME',
- "The built-in identifier '{0}' cannot be used as a type alias name");
+ const CompileTimeErrorCode(
+ 'BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME',
+ "The built-in identifier '{0}' can't be used as a typedef name.",
+ "Try choosing a different name for the typedef.");
/**
* 12.30 Identifier Reference: It is a compile-time error if a built-in
* identifier is used as the declared name of a class, type parameter or type
* alias.
+ *
+ * Parameters:
+ * 0: the built-in identifier that is being used
*/
static const CompileTimeErrorCode BUILT_IN_IDENTIFIER_AS_TYPE_PARAMETER_NAME =
- const CompileTimeErrorCode('BUILT_IN_IDENTIFIER_AS_TYPE_PARAMETER_NAME',
- "The built-in identifier '{0}' cannot be used as a type parameter name");
+ const CompileTimeErrorCode(
+ 'BUILT_IN_IDENTIFIER_AS_TYPE_PARAMETER_NAME',
+ "The built-in identifier '{0}' can't be used as a type parameter name.",
+ "Try choosing a different name for the type parameter.");
/**
* 13.9 Switch: It is a compile-time error if the class <i>C</i> implements
* the operator <i>==</i>.
+ *
+ * Parameters:
+ * 0: the this of the switch case expression
*/
static const CompileTimeErrorCode CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS =
const CompileTimeErrorCode('CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS',
- "The switch case expression type '{0}' cannot override the == operator");
-
- /**
- * 12.1 Constants: It is a compile-time error if evaluation of a compile-time
- * constant would raise
- * an exception.
- */
- static const CompileTimeErrorCode COMPILE_TIME_CONSTANT_RAISES_EXCEPTION =
- const CompileTimeErrorCode('COMPILE_TIME_CONSTANT_RAISES_EXCEPTION', "");
+ "The switch case expression type '{0}' can't override the == operator.");
/**
* 7.2 Getters: It is a compile-time error if a class has both a getter and a
* method with the same name. This restriction holds regardless of whether the
* getter is defined explicitly or implicitly, or whether the getter or the
* method are inherited or not.
+ *
+ * Parameters:
+ * 0: the name of the class defining the conflicting method
+ * 1: the name of the class defining the getter with which the method conflicts
+ * 2: the name of the conflicting method
*/
static const CompileTimeErrorCode CONFLICTING_GETTER_AND_METHOD =
- const CompileTimeErrorCode('CONFLICTING_GETTER_AND_METHOD',
- "Class '{0}' cannot have both getter '{1}.{2}' and method with the same name");
+ const CompileTimeErrorCode(
+ 'CONFLICTING_GETTER_AND_METHOD',
+ "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.");
/**
* 7.2 Getters: It is a compile-time error if a class has both a getter and a
* method with the same name. This restriction holds regardless of whether the
* getter is defined explicitly or implicitly, or whether the getter or the
* method are inherited or not.
+ *
+ * Parameters:
+ * 0: the name of the class defining the conflicting getter
+ * 1: the name of the class defining the method with which the getter conflicts
+ * 2: the name of the conflicting getter
*/
static const CompileTimeErrorCode CONFLICTING_METHOD_AND_GETTER =
- const CompileTimeErrorCode('CONFLICTING_METHOD_AND_GETTER',
- "Class '{0}' cannot have both method '{1}.{2}' and getter with the same name");
+ const CompileTimeErrorCode(
+ 'CONFLICTING_METHOD_AND_GETTER',
+ "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.");
/**
* 7.6 Constructors: A constructor name always begins with the name of its
* immediately enclosing class, and may optionally be followed by a dot and an
* identifier <i>id</i>. It is a compile-time error if <i>id</i> is the name
* of a member declared in the immediately enclosing class.
+ *
+ * Parameters:
+ * 0: the name of the constructor
*/
static const CompileTimeErrorCode CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD =
- const CompileTimeErrorCode('CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD',
- "'{0}' cannot be used to name a constructor and a field in this class");
+ const CompileTimeErrorCode(
+ 'CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD',
+ "'{0}' can't be used to name both a constructor and a field in this class.",
+ "Try renaming either the constructor or the field.");
/**
* 7.6 Constructors: A constructor name always begins with the name of its
* immediately enclosing class, and may optionally be followed by a dot and an
* identifier <i>id</i>. It is a compile-time error if <i>id</i> is the name
* of a member declared in the immediately enclosing class.
+ *
+ * Parameters:
+ * 0: the name of the constructor
*/
static const CompileTimeErrorCode CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD =
- const CompileTimeErrorCode('CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD',
- "'{0}' cannot be used to name a constructor and a method in this class");
+ const CompileTimeErrorCode(
+ 'CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD',
+ "'{0}' can't be used to name both a constructor and a method in this class.",
+ "Try renaming either the constructor or the field.");
/**
* 7. Classes: It is a compile time error if a generic class declares a type
* variable with the same name as the class or any of its members or
* constructors.
+ *
+ * Parameters:
+ * 0: the name of the type variable
*/
static const CompileTimeErrorCode CONFLICTING_TYPE_VARIABLE_AND_CLASS =
- const CompileTimeErrorCode('CONFLICTING_TYPE_VARIABLE_AND_CLASS',
- "'{0}' cannot be used to name a type variable in a class with the same name");
+ 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.",
+ "Try renaming either the type variable or the class.");
/**
* 7. Classes: It is a compile time error if a generic class declares a type
* variable with the same name as the class or any of its members or
* constructors.
+ *
+ * Parameters:
+ * 0: the name of the type variable
*/
static const CompileTimeErrorCode CONFLICTING_TYPE_VARIABLE_AND_MEMBER =
- const CompileTimeErrorCode('CONFLICTING_TYPE_VARIABLE_AND_MEMBER',
- "'{0}' cannot be used to name a type variable and member in this class");
+ const CompileTimeErrorCode(
+ 'CONFLICTING_TYPE_VARIABLE_AND_MEMBER',
+ "'{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.");
/**
- * 12.11.2 Const: It is a compile-time error if evaluation of a constant
+ * 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_CONSTRUCTOR_THROWS_EXCEPTION =
const CompileTimeErrorCode('CONST_CONSTRUCTOR_THROWS_EXCEPTION',
- "'const' constructors cannot throw exceptions");
+ "Const constructors can't throw exceptions.");
/**
* 10.6.3 Constant Constructors: It is a compile-time error if a constant
* constructor is declared by a class C if any instance variable declared in C
* is initialized with an expression that is not a constant expression.
+ *
+ * Parameters:
+ * 0: the name of the field
*/
static const CompileTimeErrorCode
CONST_CONSTRUCTOR_WITH_FIELD_INITIALIZED_BY_NON_CONST =
const CompileTimeErrorCode(
'CONST_CONSTRUCTOR_WITH_FIELD_INITIALIZED_BY_NON_CONST',
- "Can't define the 'const' constructor because the field '{0}' is initialized with a non-constant value");
+ "Can't define the const constructor because the field '{0}' "
+ "is initialized with a non-constant value.",
+ "Try initializing the field to a constant value, or "
+ "removing the keyword 'const' from the constructor.");
/**
* 7.6.3 Constant Constructors: The superinitializer that appears, explicitly
@@ -460,18 +534,27 @@ class CompileTimeErrorCode extends ErrorCode {
* constructor named ... is declared.
*/
static const CompileTimeErrorCode CONST_CONSTRUCTOR_WITH_MIXIN =
- const CompileTimeErrorCode('CONST_CONSTRUCTOR_WITH_MIXIN',
- "Constant constructor cannot be declared for a class with a mixin");
+ const CompileTimeErrorCode(
+ 'CONST_CONSTRUCTOR_WITH_MIXIN',
+ "Const constructor can't be declared for a class with a mixin.",
+ "Try removing the 'const' keyword, or "
+ "removing the 'with' clause from the class declaration.");
/**
* 7.6.3 Constant Constructors: The superinitializer that appears, explicitly
* or implicitly, in the initializer list of a constant constructor must
* specify a constant constructor of the superclass of the immediately
* enclosing class or a compile-time error occurs.
+ *
+ * Parameters:
+ * 0: the name of the superclass
*/
static const CompileTimeErrorCode CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER =
- const CompileTimeErrorCode('CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER',
- "Constant constructor cannot call non-constant super constructor of '{0}'");
+ const CompileTimeErrorCode(
+ 'CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER',
+ "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.");
/**
* 7.6.3 Constant Constructors: It is a compile-time error if a constant
@@ -480,31 +563,39 @@ class CompileTimeErrorCode extends ErrorCode {
* The above refers to both locally declared and inherited instance variables.
*/
static const CompileTimeErrorCode CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD =
- const CompileTimeErrorCode('CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD',
- "Cannot define the 'const' constructor for a class with non-final fields");
+ const CompileTimeErrorCode(
+ 'CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD',
+ "Can't define a const constructor for a class with non-final fields.",
+ "Try making all of the fields final, or "
+ "removing the keyword 'const' from the constructor.");
/**
* 12.12.2 Const: It is a compile-time error if <i>T</i> is a deferred type.
*/
static const CompileTimeErrorCode CONST_DEFERRED_CLASS =
- const CompileTimeErrorCode('CONST_DEFERRED_CLASS',
- "Deferred classes cannot be created with 'const'");
+ const CompileTimeErrorCode(
+ '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.");
/**
* 6.2 Formal Parameters: It is a compile-time error if a formal parameter is
* declared as a constant variable.
*/
static const CompileTimeErrorCode CONST_FORMAL_PARAMETER =
- const CompileTimeErrorCode(
- 'CONST_FORMAL_PARAMETER', "Parameters cannot be 'const'");
+ const CompileTimeErrorCode('CONST_FORMAL_PARAMETER',
+ "Parameters can't be const.", "Try removing the 'const' keyword.");
/**
* 5 Variables: A constant variable must be initialized to a compile-time
* constant or a compile-time error occurs.
*/
static const CompileTimeErrorCode CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE =
- const CompileTimeErrorCode('CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE',
- "'const' variables must be constant value");
+ const CompileTimeErrorCode(
+ 'CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE',
+ "Const variables must be initialized with a constant value.",
+ "Try changing the initializer to be a constant expression.");
/**
* 5 Variables: A constant variable must be initialized to a compile-time
@@ -517,26 +608,35 @@ 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 cannot be used to initialized a 'const' variable");
+ "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.");
/**
* 7.5 Instance Variables: It is a compile-time error if an instance variable
* is declared to be constant.
*/
static const CompileTimeErrorCode CONST_INSTANCE_FIELD =
- const CompileTimeErrorCode('CONST_INSTANCE_FIELD',
- "Only static fields can be declared as 'const'");
+ const CompileTimeErrorCode(
+ 'CONST_INSTANCE_FIELD',
+ "Only static fields can be declared as const.",
+ "Try declaring the field as final, or adding the keyword 'static'.");
/**
* 12.8 Maps: It is a compile-time error if the key of an entry in a constant
* map literal is an instance of a class that implements the operator
* <i>==</i> unless the key is a string or integer.
+ *
+ * Parameters:
+ * 0: the type of the entry's key
*/
static const CompileTimeErrorCode
CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUALS =
const CompileTimeErrorCode(
'CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUALS',
- "The constant map entry key expression type '{0}' cannot 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.");
/**
* 5 Variables: A constant variable must be initialized to a compile-time
@@ -546,64 +646,66 @@ class CompileTimeErrorCode extends ErrorCode {
* 0: the name of the uninitialized final variable
*/
static const CompileTimeErrorCode CONST_NOT_INITIALIZED =
- const CompileTimeErrorCode('CONST_NOT_INITIALIZED',
- "The const variable '{0}' must be initialized");
+ const CompileTimeErrorCode(
+ 'CONST_NOT_INITIALIZED',
+ "The const variable '{0}' must be initialized.",
+ "Try adding an initialization to the declaration.");
/**
- * 12.11.2 Const: An expression of one of the forms !e, e1 && e2 or e1 || e2,
+ * 16.12.2 Const: An expression of one of the forms !e, e1 && e2 or e1 || e2,
* where e, e1 and e2 are constant expressions that evaluate to a boolean
* 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'");
+ "In constant expressions, operand(s) of this operator must be of type 'bool'.");
/**
- * 12.11.2 Const: An expression of one of the forms e1 == e2 or e1 != e2 where
+ * 16.12.2 Const: An expression of one of the forms e1 == e2 or e1 != e2 where
* e1 and e2 are constant expressions that evaluate to a numeric, string or
* 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'");
+ "In constant expressions, operands of this operator must be of type 'bool', 'num', 'String' or 'null'.");
/**
- * 12.11.2 Const: An expression of one of the forms ~e, e1 ^ e2, e1 & e2,
+ * 16.12.2 Const: An expression of one of the forms ~e, e1 ^ e2, e1 & e2,
* e1 | e2, e1 >> e2 or e1 << e2, where e, e1 and e2 are constant expressions
* 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'");
+ "In constant expressions, operand(s) of this operator must be of type 'int'.");
/**
- * 12.11.2 Const: An expression of one of the forms e, e1 + e2, e1 - e2, e1 *
+ * 16.12.2 Const: An expression of one of the forms e, e1 + e2, e1 - e2, e1 *
* e2, e1 / e2, e1 ~/ e2, e1 > e2, e1 < e2, e1 >= e2, e1 <= e2 or e1 % e2,
* where e, e1 and e2 are constant expressions that evaluate to a numeric
* 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'");
+ "In constant expressions, operand(s) of this operator must be of type 'num'.");
/**
- * 12.11.2 Const: It is a compile-time error if evaluation of a constant
+ * 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_EXCEPTION =
const CompileTimeErrorCode('CONST_EVAL_THROWS_EXCEPTION',
- "Evaluation of this constant expression causes exception");
+ "Evaluation of this constant expression causes an exception.");
/**
- * 12.11.2 Const: It is a compile-time error if evaluation of a constant
+ * 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");
+ "Evaluation of this constant expression throws IntegerDivisionByZeroException.");
/**
- * 12.11.2 Const: If <i>T</i> is a parameterized type <i>S&lt;U<sub>1</sub>,
+ * 16.12.2 Const: If <i>T</i> is a parameterized type <i>S&lt;U<sub>1</sub>,
* &hellip;, U<sub>m</sub>&gt;</i>, let <i>R = S</i>; It is a compile time
* error if <i>S</i> is not a generic type with <i>m</i> type parameters.
*
@@ -616,34 +718,41 @@ class CompileTimeErrorCode extends ErrorCode {
* [StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS].
*/
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");
+ 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.");
/**
- * 12.11.2 Const: If <i>e</i> is of the form <i>const T(a<sub>1</sub>,
+ * 16.12.2 Const: If <i>e</i> is of the form <i>const T(a<sub>1</sub>,
* &hellip;, a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n+1</sub>, &hellip;,
* x<sub>n+k</sub>: a<sub>n+k</sub>)</i> it is a compile-time error if the
* type <i>T</i> does not declare a constant constructor with the same name as
* the declaration of <i>T</i>.
*/
static const CompileTimeErrorCode CONST_WITH_NON_CONST =
- const CompileTimeErrorCode('CONST_WITH_NON_CONST',
- "The constructor being called is not a 'const' constructor");
+ const CompileTimeErrorCode(
+ 'CONST_WITH_NON_CONST',
+ "The constructor being called isn't a const constructor.",
+ "Try using 'new' to call the constructor.");
/**
- * 12.11.2 Const: In all of the above cases, it is a compile-time error if
+ * 16.12.2 Const: In all of the above cases, it is a compile-time error if
* <i>a<sub>i</sub>, 1 &lt;= i &lt;= n + k</i>, is not a compile-time constant
* expression.
*/
static const CompileTimeErrorCode CONST_WITH_NON_CONSTANT_ARGUMENT =
- const CompileTimeErrorCode('CONST_WITH_NON_CONSTANT_ARGUMENT',
- "Arguments of a constant creation must be constant expressions");
+ const CompileTimeErrorCode(
+ 'CONST_WITH_NON_CONSTANT_ARGUMENT',
+ "Arguments of a constant creation must be constant expressions.",
+ "Try making the argument a valid constant, or "
+ "use 'new' to call the constructor.");
/**
- * 12.11.2 Const: It is a compile-time error if <i>T</i> is not a class
+ * 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.
*
- * 12.11.2 Const: If <i>e</i> is of the form <i>const T.id(a<sub>1</sub>,
+ * 16.12.2 Const: If <i>e</i> is of the form <i>const T.id(a<sub>1</sub>,
* &hellip;, a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n+1</sub>, &hellip;
* x<sub>n+k</sub>: a<sub>n+k</sub>)</i> it is a compile-time error if
* <i>T</i> is not a class accessible in the current scope, optionally
@@ -654,18 +763,20 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode CONST_WITH_NON_TYPE =
const CompileTimeErrorCode(
- 'CONST_WITH_NON_TYPE', "The name '{0}' is not a class");
+ 'CONST_WITH_NON_TYPE',
+ "The name '{0}' isn't a class.",
+ "Try correcting the name to match an existing class.");
/**
- * 12.11.2 Const: It is a compile-time error if <i>T</i> includes any type
- * parameters.
+ * 16.12.2 Const: If <i>T</i> is a parameterized type, it is a compile-time
+ * 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',
- "The constant creation cannot use a type parameter");
+ "A constant creation can't use a type parameter as a type argument.");
/**
- * 12.11.2 Const: It is a compile-time error if <i>T.id</i> is not the name of
+ * 16.12.2 Const: It is a compile-time error if <i>T.id</i> is not the name of
* a constant constructor declared by the type <i>T</i>.
*
* Parameters:
@@ -674,10 +785,10 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode CONST_WITH_UNDEFINED_CONSTRUCTOR =
const CompileTimeErrorCode('CONST_WITH_UNDEFINED_CONSTRUCTOR',
- "The class '{0}' does not have a constant constructor '{1}'");
+ "The class '{0}' doesn't have a constant constructor '{1}'.");
/**
- * 12.11.2 Const: It is a compile-time error if <i>T.id</i> is not the name of
+ * 16.12.2 Const: It is a compile-time error if <i>T.id</i> is not the name of
* a constant constructor declared by the type <i>T</i>.
*
* Parameters:
@@ -685,15 +796,17 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT =
const CompileTimeErrorCode('CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT',
- "The class '{0}' does not have a default constant constructor");
+ "The class '{0}' doesn't have a default constant constructor.");
/**
* 15.3.1 Typedef: It is a compile-time error if any default values are
* specified in the signature of a function type alias.
*/
static const CompileTimeErrorCode DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS =
- const CompileTimeErrorCode('DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS',
- "Default values aren't allowed in typedefs");
+ const CompileTimeErrorCode(
+ 'DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS',
+ "Default parameter values aren't allowed in typedefs.",
+ "Try removing the default value.");
/**
* 6.2.1 Required Formals: By means of a function signature that names the
@@ -703,7 +816,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
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");
+ "Default values aren't allowed in function type parameters.");
/**
* 7.6.2 Factories: It is a compile-time error if <i>k</i> explicitly
@@ -713,7 +826,7 @@ 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.");
/**
* 3.1 Scoping: It is a compile-time error if there is more than one entity
@@ -721,7 +834,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode DUPLICATE_CONSTRUCTOR_DEFAULT =
const CompileTimeErrorCode('DUPLICATE_CONSTRUCTOR_DEFAULT',
- "The default constructor is already defined");
+ "The default constructor is already defined.");
/**
* 3.1 Scoping: It is a compile-time error if there is more than one entity
@@ -732,7 +845,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode DUPLICATE_CONSTRUCTOR_NAME =
const CompileTimeErrorCode('DUPLICATE_CONSTRUCTOR_NAME',
- "The constructor with name '{0}' is already defined");
+ "The constructor with name '{0}' is already defined.");
/**
* 3.1 Scoping: It is a compile-time error if there is more than one entity
@@ -749,7 +862,7 @@ 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.");
/**
* 18.3 Parts: It's a compile-time error if the same library contains two part
@@ -777,16 +890,19 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode DUPLICATE_DEFINITION_INHERITANCE =
const CompileTimeErrorCode('DUPLICATE_DEFINITION_INHERITANCE',
- "The name '{0}' is already defined in '{1}'");
+ "The name '{0}' is already defined in '{1}'.");
/**
* 12.14.2 Binding Actuals to Formals: It is a compile-time error if
* <i>q<sub>i</sub> = q<sub>j</sub></i> for any <i>i != j</i> [where
* <i>q<sub>i</sub></i> is the label for a named argument].
+ *
+ * Parameters:
+ * 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");
+ "The argument for the named parameter '{0}' was already specified.");
/**
* SDK implementation libraries can be exported only by other SDK libraries.
@@ -796,7 +912,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode EXPORT_INTERNAL_LIBRARY =
const CompileTimeErrorCode('EXPORT_INTERNAL_LIBRARY',
- "The library '{0}' is internal and cannot be exported");
+ "The library '{0}' is internal and can't be exported.");
/**
* 14.2 Exports: It is a compile-time error if the compilation unit found at
@@ -807,14 +923,14 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode EXPORT_OF_NON_LIBRARY =
const CompileTimeErrorCode('EXPORT_OF_NON_LIBRARY',
- "The exported library '{0}' must not have a part-of directive");
+ "The exported library '{0}' can't have a part-of directive.");
/**
* 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 cannot extend an enum");
+ 'EXTENDS_ENUM', "Classes can't extend an enum.");
/**
* 7.9 Superclasses: It is a compile-time error if the extends clause of a
@@ -826,7 +942,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode EXTENDS_NON_CLASS =
const CompileTimeErrorCode(
- 'EXTENDS_NON_CLASS', "Classes can only extend other classes");
+ 'EXTENDS_NON_CLASS', "Classes can only extend other classes.");
/**
* 12.2 Null: It is a compile-time error for a class to attempt to extend or
@@ -855,7 +971,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode EXTENDS_DISALLOWED_CLASS =
const CompileTimeErrorCode(
- 'EXTENDS_DISALLOWED_CLASS', "Classes cannot extend '{0}'");
+ 'EXTENDS_DISALLOWED_CLASS', "Classes can't extend '{0}'.");
/**
* 7.9 Superclasses: It is a compile-time error if the extends clause of a
@@ -868,7 +984,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode EXTENDS_DEFERRED_CLASS =
const CompileTimeErrorCode('EXTENDS_DEFERRED_CLASS',
- "This class cannot extend the deferred class '{0}'");
+ "This class can't extend the deferred class '{0}'.");
/**
* DEP 37 extends the syntax for assert() to allow a second "message"
@@ -877,13 +993,13 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode EXTRA_ARGUMENT_TO_ASSERT =
const CompileTimeErrorCode('EXTRA_ARGUMENT_TO_ASSERT',
- "Assertions only accept a single argument");
+ "Assertions only accept a single argument.");
/**
* 12.14.2 Binding Actuals to Formals: It is a static warning if <i>m &lt;
* h</i> or if <i>m &gt; n</i>.
*
- * 12.11.2 Const: It is a compile-time error if evaluation of a constant
+ * 16.12.2 Const: It is a compile-time error if evaluation of a constant
* object results in an uncaught exception being thrown.
*
* Parameters:
@@ -892,16 +1008,19 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode EXTRA_POSITIONAL_ARGUMENTS =
const CompileTimeErrorCode('EXTRA_POSITIONAL_ARGUMENTS',
- "{0} positional arguments expected, but {1} found");
+ "{0} positional arguments expected, but {1} found.");
/**
* 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It
* is a compile time error if more than one initializer corresponding to a
* given instance variable appears in <i>k</i>'s list.
+ *
+ * Parameters:
+ * 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}' cannot be initialized twice in the same constructor");
+ "The field '{0}' can't be initialized twice in the same constructor.");
/**
* 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It
@@ -913,7 +1032,7 @@ class CompileTimeErrorCode extends ErrorCode {
FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER =
const CompileTimeErrorCode(
'FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER',
- "Fields cannot be initialized in both the parameter list and the initializers");
+ "Fields can't be initialized in both the parameter list and the initializers.");
/**
* 5 Variables: It is a compile-time error if a final instance variable that
@@ -925,7 +1044,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
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");
+ "'{0}' is a final field and so can only be set once.");
/**
* 7.6.1 Generative Constructors: It is a compile-time error if an
@@ -934,7 +1053,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode FIELD_INITIALIZER_FACTORY_CONSTRUCTOR =
const CompileTimeErrorCode('FIELD_INITIALIZER_FACTORY_CONSTRUCTOR',
- "Initializing formal fields cannot be used in factory constructors");
+ "Initializing formal fields can't be used in factory constructors.");
/**
* 7.6.1 Generative Constructors: It is a compile-time error if an
@@ -943,7 +1062,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR =
const CompileTimeErrorCode('FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR',
- "Initializing formal fields can only be used in constructors");
+ "Initializing formal fields can only be used in constructors.");
/**
* 7.6.1 Generative Constructors: A generative constructor may be redirecting,
@@ -955,7 +1074,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR =
const CompileTimeErrorCode('FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR',
- "The redirecting constructor cannot have a field initializer");
+ "The redirecting constructor can't have a field initializer.");
/**
* 7.2 Getters: It is a compile-time error if a class has both a getter and a
@@ -966,7 +1085,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode GETTER_AND_METHOD_WITH_SAME_NAME =
const CompileTimeErrorCode('GETTER_AND_METHOD_WITH_SAME_NAME',
- "'{0}' cannot be used to name a getter, there is already a method with the same name");
+ "'{0}' can't be used to name a getter, there is already a method with the same name.");
/**
* 7.10 Superinterfaces: It is a compile-time error if the implements clause
@@ -974,13 +1093,13 @@ class CompileTimeErrorCode extends ErrorCode {
* superinterface.
*
* Parameters:
- * 0: the name of the type that cannot be extended
+ * 0: the name of the type that is deferred
*
* See [EXTENDS_DEFERRED_CLASS], and [MIXIN_DEFERRED_CLASS].
*/
static const CompileTimeErrorCode IMPLEMENTS_DEFERRED_CLASS =
const CompileTimeErrorCode('IMPLEMENTS_DEFERRED_CLASS',
- "This class cannot implement the deferred class '{0}'");
+ "This class can't implement the deferred class '{0}'.");
/**
* 12.2 Null: It is a compile-time error for a class to attempt to extend or
@@ -1009,7 +1128,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode IMPLEMENTS_DISALLOWED_CLASS =
const CompileTimeErrorCode(
- 'IMPLEMENTS_DISALLOWED_CLASS', "Classes cannot implement '{0}'");
+ 'IMPLEMENTS_DISALLOWED_CLASS', "Classes can't implement '{0}'.");
/**
* 7.10 Superinterfaces: It is a compile-time error if the implements clause
@@ -1017,7 +1136,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode IMPLEMENTS_DYNAMIC =
const CompileTimeErrorCode(
- 'IMPLEMENTS_DYNAMIC', "Classes cannot implement 'dynamic'");
+ 'IMPLEMENTS_DYNAMIC', "Classes can't implement 'dynamic'.");
/**
* Enum proposal: It is a compile-time error to subclass, mix-in or implement
@@ -1025,7 +1144,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode IMPLEMENTS_ENUM =
const CompileTimeErrorCode(
- 'IMPLEMENTS_ENUM', "Classes cannot implement an enum");
+ 'IMPLEMENTS_ENUM', "Classes can't implement an enum.");
/**
* 7.10 Superinterfaces: It is a compile-time error if the implements clause
@@ -1037,7 +1156,7 @@ 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.");
/**
* 7.10 Superinterfaces: It is a compile-time error if a type <i>T</i> appears
@@ -1048,7 +1167,7 @@ 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.");
/**
* 7.10 Superinterfaces: It is a compile-time error if the superclass of a
@@ -1060,7 +1179,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode IMPLEMENTS_SUPER_CLASS =
const CompileTimeErrorCode('IMPLEMENTS_SUPER_CLASS',
- "'{0}' cannot be used in both 'extends' and 'implements' clauses");
+ "'{0}' can't be used in both 'extends' and 'implements' clauses.");
/**
* 7.6.1 Generative Constructors: Note that <b>this</b> is not in scope on the
@@ -1076,7 +1195,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode IMPLICIT_THIS_REFERENCE_IN_INITIALIZER =
const CompileTimeErrorCode('IMPLICIT_THIS_REFERENCE_IN_INITIALIZER',
- "Only static members can be accessed in initializers");
+ "Only static members can be accessed in initializers.");
/**
* SDK implementation libraries can be imported only by other SDK libraries.
@@ -1086,7 +1205,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode IMPORT_INTERNAL_LIBRARY =
const CompileTimeErrorCode('IMPORT_INTERNAL_LIBRARY',
- "The library '{0}' is internal and cannot be imported");
+ "The library '{0}' is internal and can't be imported.");
/**
* 14.1 Imports: It is a compile-time error if the specified URI of an
@@ -1099,7 +1218,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode IMPORT_OF_NON_LIBRARY =
const CompileTimeErrorCode('IMPORT_OF_NON_LIBRARY',
- "The imported library '{0}' must not have a part-of directive");
+ "The imported library '{0}' can't have a part-of directive.");
/**
* 13.9 Switch: It is a compile-time error if values of the expressions
@@ -1112,7 +1231,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode INCONSISTENT_CASE_EXPRESSION_TYPES =
const CompileTimeErrorCode('INCONSISTENT_CASE_EXPRESSION_TYPES',
- "Case expressions must have the same types, '{0}' is not a '{1}'");
+ "Case expressions must have the same types, '{0}' isn't a '{1}'.");
/**
* 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It
@@ -1128,7 +1247,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode INITIALIZER_FOR_NON_EXISTENT_FIELD =
const CompileTimeErrorCode('INITIALIZER_FOR_NON_EXISTENT_FIELD',
- "'{0}' is not a variable in the enclosing class");
+ "'{0}' isn't a variable in the enclosing class.");
/**
* 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It
@@ -1144,7 +1263,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
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 cannot be static");
+ "'{0}' is a static variable in the enclosing class, variables initialized in a constructor can't be static.");
/**
* 7.6.1 Generative Constructors: An initializing formal has the form
@@ -1160,7 +1279,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD =
const CompileTimeErrorCode('INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD',
- "'{0}' is not a variable in the enclosing class");
+ "'{0}' isn't a variable in the enclosing class.");
/**
* 7.6.1 Generative Constructors: An initializing formal has the form
@@ -1175,7 +1294,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
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 cannot be static");
+ "'{0}' is a static field in the enclosing class, fields initialized in a constructor can't be static.");
/**
* 12.30 Identifier Reference: Otherwise, e is equivalent to the property
@@ -1183,7 +1302,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode INSTANCE_MEMBER_ACCESS_FROM_FACTORY =
const CompileTimeErrorCode('INSTANCE_MEMBER_ACCESS_FROM_FACTORY',
- "Instance members cannot be accessed from a factory constructor");
+ "Instance members can't be accessed from a factory constructor.");
/**
* 12.30 Identifier Reference: Otherwise, e is equivalent to the property
@@ -1191,7 +1310,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode INSTANCE_MEMBER_ACCESS_FROM_STATIC =
const CompileTimeErrorCode('INSTANCE_MEMBER_ACCESS_FROM_STATIC',
- "Instance members cannot be accessed from a static method");
+ "Instance members can't be accessed from a static method.");
/**
* Enum proposal: It is also a compile-time error to explicitly instantiate an
@@ -1199,20 +1318,20 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode INSTANTIATE_ENUM =
const CompileTimeErrorCode(
- 'INSTANTIATE_ENUM', "Enums cannot be instantiated");
+ 'INSTANTIATE_ENUM', "Enums can't be instantiated.");
/**
- * 11 Metadata: Metadata consists of a series of annotations, each of which
+ * 15 Metadata: Metadata consists of a series of annotations, each of which
* begin with the character @, followed by a constant expression that must be
* 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 can be only constant variable or constant constructor invocation");
+ "Annotation must be either a const variable reference or const constructor invocation.");
/**
- * 11 Metadata: Metadata consists of a series of annotations, each of which
+ * 15 Metadata: Metadata consists of a series of annotations, each of which
* begin with the character @, followed by a constant expression that must be
* either a reference to a compile-time constant variable, or a call to a
* constant constructor.
@@ -1222,7 +1341,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode INVALID_ANNOTATION_FROM_DEFERRED_LIBRARY =
const CompileTimeErrorCode('INVALID_ANNOTATION_FROM_DEFERRED_LIBRARY',
- "Constant values from a deferred library cannot be used as annotations");
+ "Constant values from a deferred library can't be used as annotations.");
/**
* 15.31 Identifier Reference: It is a compile-time error if any of the
@@ -1231,7 +1350,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode INVALID_IDENTIFIER_IN_ASYNC =
const CompileTimeErrorCode('INVALID_IDENTIFIER_IN_ASYNC',
- "The identifier '{0}' cannot be used in a function marked with async, async* or sync*");
+ "The identifier '{0}' can't be used in a function marked with 'async', 'async*' or 'sync*'.");
/**
* 9. Functions: It is a compile-time error if an async, async* or sync*
@@ -1239,7 +1358,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode INVALID_MODIFIER_ON_CONSTRUCTOR =
const CompileTimeErrorCode('INVALID_MODIFIER_ON_CONSTRUCTOR',
- "The modifier '{0}' cannot be applied to the body of a constructor");
+ "The modifier '{0}' can't be applied to the body of a constructor.");
/**
* 9. Functions: It is a compile-time error if an async, async* or sync*
@@ -1247,7 +1366,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode INVALID_MODIFIER_ON_SETTER =
const CompileTimeErrorCode('INVALID_MODIFIER_ON_SETTER',
- "The modifier '{0}' cannot be applied to the body of a setter");
+ "The modifier '{0}' can't be applied to the body of a setter.");
/**
* TODO(brianwilkerson) Remove this when we have decided on how to report
@@ -1257,7 +1376,7 @@ class CompileTimeErrorCode extends ErrorCode {
* See TODOs in ConstantVisitor
*/
static const CompileTimeErrorCode INVALID_CONSTANT =
- const CompileTimeErrorCode('INVALID_CONSTANT', "Invalid constant value");
+ const CompileTimeErrorCode('INVALID_CONSTANT', "Invalid constant value.");
/**
* 7.6 Constructors: It is a compile-time error if the name of a constructor
@@ -1265,7 +1384,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode INVALID_CONSTRUCTOR_NAME =
const CompileTimeErrorCode(
- 'INVALID_CONSTRUCTOR_NAME', "Invalid constructor name");
+ 'INVALID_CONSTRUCTOR_NAME', "Invalid constructor name.");
/**
* 7.6.2 Factories: It is a compile-time error if <i>M</i> is not the name of
@@ -1273,7 +1392,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
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");
+ "The name of the immediately enclosing class expected.");
/**
* 12.10 This: It is a compile-time error if this appears in a top-level
@@ -1283,7 +1402,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode INVALID_REFERENCE_TO_THIS =
const CompileTimeErrorCode('INVALID_REFERENCE_TO_THIS',
- "Invalid reference to 'this' expression");
+ "Invalid reference to 'this' expression.");
/**
* 12.6 Lists: It is a compile time error if the type argument of a constant
@@ -1294,7 +1413,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode INVALID_TYPE_ARGUMENT_IN_CONST_LIST =
const CompileTimeErrorCode('INVALID_TYPE_ARGUMENT_IN_CONST_LIST',
- "Constant list literals cannot include a type parameter as a type argument, such as '{0}'");
+ "Constant list literals can't include a type parameter as a type argument, such as '{0}'.");
/**
* 12.7 Maps: It is a compile time error if the type arguments of a constant
@@ -1305,7 +1424,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode INVALID_TYPE_ARGUMENT_IN_CONST_MAP =
const CompileTimeErrorCode('INVALID_TYPE_ARGUMENT_IN_CONST_MAP',
- "Constant map literals cannot include a type parameter as a type argument, such as '{0}'");
+ "Constant map literals can't include a type parameter as a type argument, such as '{0}'.");
/**
* 14.2 Exports: It is a compile-time error if the compilation unit found at
@@ -1323,7 +1442,7 @@ class CompileTimeErrorCode extends ErrorCode {
* See [URI_DOES_NOT_EXIST].
*/
static const CompileTimeErrorCode INVALID_URI =
- const CompileTimeErrorCode('INVALID_URI', "Invalid URI syntax: '{0}'");
+ const CompileTimeErrorCode('INVALID_URI', "Invalid URI syntax: '{0}'.");
/**
* 13.13 Break: It is a compile-time error if no such statement
@@ -1339,7 +1458,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode LABEL_IN_OUTER_SCOPE =
const CompileTimeErrorCode('LABEL_IN_OUTER_SCOPE',
- "Cannot reference label '{0}' declared in an outer method");
+ "Can't reference label '{0}' declared in an outer method.");
/**
* 13.13 Break: It is a compile-time error if no such statement
@@ -1355,7 +1474,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode LABEL_UNDEFINED =
const CompileTimeErrorCode(
- 'LABEL_UNDEFINED', "Cannot reference undefined label '{0}'");
+ 'LABEL_UNDEFINED', "Can't reference undefined label '{0}'.");
/**
* 7 Classes: It is a compile time error if a class <i>C</i> declares a member
@@ -1363,7 +1482,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode MEMBER_WITH_CLASS_NAME =
const CompileTimeErrorCode('MEMBER_WITH_CLASS_NAME',
- "Class members cannot have the same name as the enclosing class");
+ "Class members can't have the same name as the enclosing class.");
/**
* 7.2 Getters: It is a compile-time error if a class has both a getter and a
@@ -1374,21 +1493,21 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode METHOD_AND_GETTER_WITH_SAME_NAME =
const CompileTimeErrorCode('METHOD_AND_GETTER_WITH_SAME_NAME',
- "'{0}' cannot be used to name a method, there is already a getter with the 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");
+ "List literals must be prefixed with 'const' when used as a constant expression.");
/**
* 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");
+ "Map literals must be prefixed with 'const' when used as a constant expression.");
/**
* 9 Mixins: It is a compile-time error if a declared or derived mixin
@@ -1399,7 +1518,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode MIXIN_DECLARES_CONSTRUCTOR =
const CompileTimeErrorCode('MIXIN_DECLARES_CONSTRUCTOR',
- "The class '{0}' cannot be used as a mixin because it declares a 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
@@ -1412,7 +1531,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode MIXIN_DEFERRED_CLASS =
const CompileTimeErrorCode('MIXIN_DEFERRED_CLASS',
- "This class cannot mixin the deferred class '{0}'");
+ "This class can't mixin the deferred class '{0}'.");
/**
* Not yet in the spec, but consistent with VM behavior. It is a
@@ -1436,7 +1555,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode MIXIN_INHERITS_FROM_NOT_OBJECT =
const CompileTimeErrorCode('MIXIN_INHERITS_FROM_NOT_OBJECT',
- "The class '{0}' cannot be used as a mixin because it extends a class other than 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
@@ -1464,14 +1583,14 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode MIXIN_OF_DISALLOWED_CLASS =
const CompileTimeErrorCode(
- 'MIXIN_OF_DISALLOWED_CLASS', "Classes cannot mixin '{0}'");
+ 'MIXIN_OF_DISALLOWED_CLASS', "Classes can't mixin '{0}'.");
/**
* Enum proposal: It is a compile-time error to subclass, mix-in or implement
* an enum.
*/
static const CompileTimeErrorCode MIXIN_OF_ENUM = const CompileTimeErrorCode(
- 'MIXIN_OF_ENUM', "Classes cannot mixin an enum");
+ 'MIXIN_OF_ENUM', "Classes can't mixin an enum.");
/**
* 9.1 Mixin Application: It is a compile-time error if <i>M</i> does not
@@ -1479,7 +1598,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode MIXIN_OF_NON_CLASS =
const CompileTimeErrorCode(
- 'MIXIN_OF_NON_CLASS', "Classes can only mixin other classes");
+ 'MIXIN_OF_NON_CLASS', "Classes can only mixin other classes.");
/**
* 9 Mixins: It is a compile-time error if a declared or derived mixin refers
@@ -1487,7 +1606,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode MIXIN_REFERENCES_SUPER =
const CompileTimeErrorCode('MIXIN_REFERENCES_SUPER',
- "The class '{0}' cannot be used as a mixin because it 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
@@ -1495,7 +1614,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode MIXIN_WITH_NON_CLASS_SUPERCLASS =
const CompileTimeErrorCode('MIXIN_WITH_NON_CLASS_SUPERCLASS',
- "Mixin can only be applied to class");
+ "Mixin can only be applied to class.");
/**
* 7.6.1 Generative Constructors: A generative constructor may be redirecting,
@@ -1504,7 +1623,7 @@ 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");
+ "Constructor may have at most one 'this' redirection.");
/**
* 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor.
@@ -1513,19 +1632,23 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode MULTIPLE_SUPER_INITIALIZERS =
const CompileTimeErrorCode('MULTIPLE_SUPER_INITIALIZERS',
- "Constructor may have at most one 'super' initializer");
+ "Constructor may have at most one 'super' initializer.");
/**
- * 11 Metadata: Metadata consists of a series of annotations, each of which
+ * 15 Metadata: Metadata consists of a series of annotations, each of which
* begin with the character @, followed by a constant expression that must be
* either a reference to a compile-time constant variable, or a call to a
* constant constructor.
*/
static const CompileTimeErrorCode NO_ANNOTATION_CONSTRUCTOR_ARGUMENTS =
const CompileTimeErrorCode('NO_ANNOTATION_CONSTRUCTOR_ARGUMENTS',
- "Annotation creation must have arguments");
+ "Annotation creation must have arguments.");
/**
+ * This error is generated if a constructor declaration has an implicit
+ * invocation of a zero argument super constructor (`super()`), but the
+ * superclass does not define a zero argument constructor.
+ *
* 7.6.1 Generative Constructors: If no superinitializer is provided, an
* implicit superinitializer of the form <b>super</b>() is added at the end of
* <i>k</i>'s initializer list, unless the enclosing class is class
@@ -1534,12 +1657,24 @@ class CompileTimeErrorCode extends ErrorCode {
* 7.6.1 Generative constructors. It is a compile-time error if class <i>S</i>
* does not declare a generative constructor named <i>S</i> (respectively
* <i>S.id</i>)
+ *
+ * Parameters:
+ * 0: the name of the superclass that does not define the implicitly invoked
+ * constructor
*/
static const CompileTimeErrorCode NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT =
- const CompileTimeErrorCode('NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT',
- "The class '{0}' does not have a default constructor");
+ const CompileTimeErrorCode(
+ 'NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT',
+ "The superclass '{0}' doesn't have a zero argument constructor.",
+ "Try declaring a zero argument constructor in '{0}', or "
+ "explicitly invoking a different constructor in '{0}'.");
/**
+ * This error is generated if a class declaration has an implicit default
+ * constructor, which implicitly invokes a zero argument super constructor
+ * (`super()`), but the superclass does not define a zero argument
+ * constructor.
+ *
* 7.6 Constructors: Iff no constructor is specified for a class <i>C</i>, it
* implicitly has a default constructor C() : <b>super<b>() {}, unless
* <i>C</i> is class <i>Object</i>.
@@ -1547,10 +1682,18 @@ class CompileTimeErrorCode extends ErrorCode {
* 7.6.1 Generative constructors. It is a compile-time error if class <i>S</i>
* does not declare a generative constructor named <i>S</i> (respectively
* <i>S.id</i>)
+ *
+ * Parameters:
+ * 0: the name of the superclass that does not define the implicitly invoked
+ * constructor
+ * 1: the name of the subclass that does not contain any explicit constructors
*/
static const CompileTimeErrorCode NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT =
- const CompileTimeErrorCode('NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT',
- "The class '{0}' does not have a default constructor");
+ const CompileTimeErrorCode(
+ '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}'.");
/**
* 13.2 Expression Statements: It is a compile-time error if a non-constant
@@ -1559,7 +1702,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
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 cannot be used as an 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) {
@@ -1574,7 +1717,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode NON_CONSTANT_CASE_EXPRESSION =
const CompileTimeErrorCode(
- 'NON_CONSTANT_CASE_EXPRESSION', "Case expressions must be constant");
+ 'NON_CONSTANT_CASE_EXPRESSION', "Case expressions must be constant.");
/**
* 13.9 Switch: Given a switch statement of the form <i>switch (e) {
@@ -1594,7 +1737,7 @@ 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 cannot be used as a case expression");
+ "Constant values from a deferred library can't be used as a case expression.");
/**
* 6.2.2 Optional Formals: It is a compile-time error if the default value of
@@ -1602,7 +1745,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode NON_CONSTANT_DEFAULT_VALUE =
const CompileTimeErrorCode('NON_CONSTANT_DEFAULT_VALUE',
- "Default values of an optional parameter must be constant");
+ "Default values of an optional parameter must be constant.");
/**
* 6.2.2 Optional Formals: It is a compile-time error if the default value of
@@ -1615,7 +1758,7 @@ 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 cannot be used as a default parameter value");
+ "Constant values from a deferred library can't be used as a default parameter value.");
/**
* 12.6 Lists: It is a compile time error if an element of a constant list
@@ -1623,7 +1766,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode NON_CONSTANT_LIST_ELEMENT =
const CompileTimeErrorCode('NON_CONSTANT_LIST_ELEMENT',
- "'const' lists must have all constant values");
+ "'const' lists must have all constant values.");
/**
* 12.6 Lists: It is a compile time error if an element of a constant list
@@ -1636,7 +1779,7 @@ 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 cannot be used as values in a 'const' list");
+ "Constant values from a deferred library can't be used as values in a 'const' list.");
/**
* 12.7 Maps: It is a compile time error if either a key or a value of an
@@ -1644,7 +1787,7 @@ 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 map must be constant.");
/**
* 12.7 Maps: It is a compile time error if either a key or a value of an
@@ -1655,7 +1798,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
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 cannot be used as keys in a map");
+ "Constant values from a deferred library can't be used as keys in a map.");
/**
* 12.7 Maps: It is a compile time error if either a key or a value of an
@@ -1663,7 +1806,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode NON_CONSTANT_MAP_VALUE =
const CompileTimeErrorCode('NON_CONSTANT_MAP_VALUE',
- "The values in a 'const' map must be constant");
+ "The values in a 'const' map must be constant.");
/**
* 12.7 Maps: It is a compile time error if either a key or a value of an
@@ -1675,10 +1818,10 @@ 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 cannot be used as values in a 'const' map");
+ "Constant values from a deferred library can't be used as values in a 'const' map.");
/**
- * 11 Metadata: Metadata consists of a series of annotations, each of which
+ * 15 Metadata: Metadata consists of a series of annotations, each of which
* begin with the character @, followed by a constant expression that must be
* either a reference to a compile-time constant variable, or a call to a
* constant constructor.
@@ -1688,7 +1831,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 use only 'const' constructor.");
/**
* 7.6.3 Constant Constructors: Any expression that appears within the
@@ -1697,7 +1840,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode NON_CONSTANT_VALUE_IN_INITIALIZER =
const CompileTimeErrorCode('NON_CONSTANT_VALUE_IN_INITIALIZER',
- "Initializer expressions in constant constructors must be constants");
+ "Initializer expressions in constant constructors must be constants.");
/**
* 7.6.3 Constant Constructors: Any expression that appears within the
@@ -1711,13 +1854,13 @@ 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 cannot be used as constant initializers");
+ "Constant values from a deferred library can't be used as constant initializers.");
/**
* 12.14.2 Binding Actuals to Formals: It is a static warning if <i>m < h</i>
* or if <i>m > n</i>.
*
- * 12.11.2 Const: It is a compile-time error if evaluation of a constant
+ * 16.12.2 Const: It is a compile-time error if evaluation of a constant
* object results in an uncaught exception being thrown.
*
* Parameters:
@@ -1726,7 +1869,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode NOT_ENOUGH_REQUIRED_ARGUMENTS =
const CompileTimeErrorCode('NOT_ENOUGH_REQUIRED_ARGUMENTS',
- "{0} required argument(s) expected, but {1} found");
+ "{0} required argument(s) expected, but {1} found.");
/**
* 7.6.1 Generative Constructors: Let <i>C</i> be the class in which the
@@ -1737,14 +1880,15 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode NON_GENERATIVE_CONSTRUCTOR =
const CompileTimeErrorCode('NON_GENERATIVE_CONSTRUCTOR',
- "The generative constructor '{0}' expected, but factory found");
+ "The generative constructor '{0}' expected, but factory found.");
/**
* 7.9 Superclasses: It is a compile-time error to specify an extends clause
* for class Object.
*/
static const CompileTimeErrorCode OBJECT_CANNOT_EXTEND_ANOTHER_CLASS =
- const CompileTimeErrorCode('OBJECT_CANNOT_EXTEND_ANOTHER_CLASS', "");
+ const CompileTimeErrorCode('OBJECT_CANNOT_EXTEND_ANOTHER_CLASS',
+ "The class 'Object' can't extend any other class.");
/**
* 7.1.1 Operators: It is a compile-time error to declare an optional
@@ -1752,7 +1896,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode OPTIONAL_PARAMETER_IN_OPERATOR =
const CompileTimeErrorCode('OPTIONAL_PARAMETER_IN_OPERATOR',
- "Optional parameters are not allowed when defining an operator");
+ "Optional parameters aren't allowed when defining an operator.");
/**
* 14.3 Parts: It is a compile time error if the contents of the URI are not a
@@ -1762,8 +1906,10 @@ class CompileTimeErrorCode extends ErrorCode {
* 0: the uri pointing to a non-library declaration
*/
static const CompileTimeErrorCode PART_OF_NON_PART =
- const CompileTimeErrorCode('PART_OF_NON_PART',
- "The included part '{0}' must have a part-of directive");
+ const CompileTimeErrorCode(
+ 'PART_OF_NON_PART',
+ "The included part '{0}' must have a part-of directive.",
+ "Try adding a part-of directive to '{0}'.");
/**
* 14.1 Imports: It is a compile-time error if the current library declares a
@@ -1771,7 +1917,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
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 cannot be used to name a top-level element");
+ "The name '{0}' is already used as an import prefix and can't be used to name a top-level element.");
/**
* 16.32 Identifier Reference: If d is a prefix p, a compile-time error
@@ -1779,7 +1925,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
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 '.'");
+ "The name '{0}' refers to an import prefix, so it must be followed by '.'.");
/**
* 6.2.2 Optional Formals: It is a compile-time error if the name of a named
@@ -1787,7 +1933,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode PRIVATE_OPTIONAL_PARAMETER =
const CompileTimeErrorCode('PRIVATE_OPTIONAL_PARAMETER',
- "Named optional parameters cannot start with an underscore");
+ "Named optional parameters can't start with an underscore.");
/**
* 12.1 Constants: It is a compile-time error if the value of a compile-time
@@ -1795,7 +1941,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode RECURSIVE_COMPILE_TIME_CONSTANT =
const CompileTimeErrorCode('RECURSIVE_COMPILE_TIME_CONSTANT',
- "Compile-time constant expression depends on itself");
+ "Compile-time constant expression depends on itself.");
/**
* 7.6.1 Generative Constructors: A generative constructor may be redirecting,
@@ -1809,7 +1955,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode RECURSIVE_CONSTRUCTOR_REDIRECT =
const CompileTimeErrorCode('RECURSIVE_CONSTRUCTOR_REDIRECT',
- "Cycle in redirecting generative constructors");
+ "Cycle in redirecting generative constructors.");
/**
* 7.6.2 Factories: It is a compile-time error if a redirecting factory
@@ -1818,7 +1964,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode RECURSIVE_FACTORY_REDIRECT =
const CompileTimeErrorCode('RECURSIVE_FACTORY_REDIRECT',
- "Cycle in redirecting factory constructors");
+ "Cycle in redirecting factory constructors.");
/**
* 7.10 Superinterfaces: It is a compile-time error if the interface of a
@@ -1836,7 +1982,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode RECURSIVE_INTERFACE_INHERITANCE =
const CompileTimeErrorCode('RECURSIVE_INTERFACE_INHERITANCE',
- "'{0}' cannot be a superinterface of itself: {1}");
+ "'{0}' can't be a superinterface of itself: {1}.");
/**
* 7.10 Superinterfaces: It is a compile-time error if the interface of a
@@ -1855,7 +2001,7 @@ class CompileTimeErrorCode extends ErrorCode {
RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_EXTENDS =
const CompileTimeErrorCode(
'RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_EXTENDS',
- "'{0}' cannot extend itself");
+ "'{0}' can't extend itself.");
/**
* 7.10 Superinterfaces: It is a compile-time error if the interface of a
@@ -1874,7 +2020,7 @@ class CompileTimeErrorCode extends ErrorCode {
RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_IMPLEMENTS =
const CompileTimeErrorCode(
'RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_IMPLEMENTS',
- "'{0}' cannot implement itself");
+ "'{0}' can't implement itself.");
/**
* 7.10 Superinterfaces: It is a compile-time error if the interface of a
@@ -1893,7 +2039,7 @@ class CompileTimeErrorCode extends ErrorCode {
RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_WITH =
const CompileTimeErrorCode(
'RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_WITH',
- "'{0}' cannot use itself as a mixin");
+ "'{0}' can't use itself as a mixin.");
/**
* 7.6.2 Factories: It is a compile-time error if <i>k</i> is prefixed with
@@ -1901,7 +2047,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode REDIRECT_TO_MISSING_CONSTRUCTOR =
const CompileTimeErrorCode('REDIRECT_TO_MISSING_CONSTRUCTOR',
- "The constructor '{0}' could not be found in '{1}'");
+ "The constructor '{0}' couldn't be found in '{1}'.");
/**
* 7.6.2 Factories: It is a compile-time error if <i>k</i> is prefixed with
@@ -1909,7 +2055,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode REDIRECT_TO_NON_CLASS =
const CompileTimeErrorCode('REDIRECT_TO_NON_CLASS',
- "The name '{0}' is not a type and cannot be used in a redirected constructor");
+ "The name '{0}' isn't a type and can't be used in a redirected constructor.");
/**
* 7.6.2 Factories: It is a compile-time error if <i>k</i> is prefixed with
@@ -1917,7 +2063,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode REDIRECT_TO_NON_CONST_CONSTRUCTOR =
const CompileTimeErrorCode('REDIRECT_TO_NON_CONST_CONSTRUCTOR',
- "Constant factory constructor cannot delegate to a non-constant constructor");
+ "Constant factory constructor can't delegate to a non-constant constructor.");
/**
* 7.6.1 Generative constructors: A generative constructor may be
@@ -1926,7 +2072,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode REDIRECT_GENERATIVE_TO_MISSING_CONSTRUCTOR =
const CompileTimeErrorCode('REDIRECT_GENERATIVE_TO_MISSING_CONSTRUCTOR',
- "The constructor '{0}' could not be found in '{1}'");
+ "The constructor '{0}' couldn't be found in '{1}'.");
/**
* 7.6.1 Generative constructors: A generative constructor may be
@@ -1937,7 +2083,7 @@ class CompileTimeErrorCode extends ErrorCode {
REDIRECT_GENERATIVE_TO_NON_GENERATIVE_CONSTRUCTOR =
const CompileTimeErrorCode(
'REDIRECT_GENERATIVE_TO_NON_GENERATIVE_CONSTRUCTOR',
- "Generative constructor cannot redirect to a factory constructor");
+ "Generative constructor can't redirect to a factory constructor.");
/**
* 5 Variables: A local variable may only be referenced at a source code
@@ -1946,7 +2092,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode REFERENCED_BEFORE_DECLARATION =
const CompileTimeErrorCode('REFERENCED_BEFORE_DECLARATION',
- "Local variable '{0}' cannot be referenced before it is declared");
+ "Local variable '{0}' can't be referenced before it is declared.");
/**
* 12.8.1 Rethrow: It is a compile-time error if an expression of the form
@@ -1983,7 +2129,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode SHARED_DEFERRED_PREFIX =
const CompileTimeErrorCode('SHARED_DEFERRED_PREFIX',
- "The prefix of a deferred import cannot be used in other import directives");
+ "The prefix of a deferred import can't be used in other import directives.");
/**
* 12.15.4 Super Invocation: A super method invocation <i>i</i> has the form
@@ -1995,8 +2141,8 @@ class CompileTimeErrorCode extends ErrorCode {
* method or variable initializer.
*/
static const CompileTimeErrorCode SUPER_IN_INVALID_CONTEXT =
- const CompileTimeErrorCode(
- 'SUPER_IN_INVALID_CONTEXT', "Invalid context for 'super' invocation");
+ const CompileTimeErrorCode('SUPER_IN_INVALID_CONTEXT',
+ "Invalid context for 'super' invocation.");
/**
* 7.6.1 Generative Constructors: A generative constructor may be redirecting,
@@ -2004,7 +2150,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode SUPER_IN_REDIRECTING_CONSTRUCTOR =
const CompileTimeErrorCode('SUPER_IN_REDIRECTING_CONSTRUCTOR',
- "The redirecting constructor cannot have a 'super' initializer");
+ "The redirecting constructor can't have a 'super' initializer.");
/**
* 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It
@@ -2012,7 +2158,8 @@ class CompileTimeErrorCode extends ErrorCode {
* includes a superinitializer.
*/
static const CompileTimeErrorCode SUPER_INITIALIZER_IN_OBJECT =
- const CompileTimeErrorCode('SUPER_INITIALIZER_IN_OBJECT', "");
+ const CompileTimeErrorCode('SUPER_INITIALIZER_IN_OBJECT',
+ "The class 'Object' can't invoke a constructor from a superclass.");
/**
* 12.11 Instance Creation: It is a static type warning if any of the type
@@ -2035,7 +2182,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode TYPE_ARGUMENT_NOT_MATCHING_BOUNDS =
const CompileTimeErrorCode(
- 'TYPE_ARGUMENT_NOT_MATCHING_BOUNDS', "'{0}' does not extend '{1}'");
+ 'TYPE_ARGUMENT_NOT_MATCHING_BOUNDS', "'{0}' doesn't extend '{1}'.");
/**
* 15.3.1 Typedef: Any self reference, either directly, or recursively via
@@ -2043,14 +2190,14 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode TYPE_ALIAS_CANNOT_REFERENCE_ITSELF =
const CompileTimeErrorCode('TYPE_ALIAS_CANNOT_REFERENCE_ITSELF',
- "Type alias cannot reference itself directly or recursively via another typedef");
+ "Type alias can't reference itself directly or recursively via another typedef.");
/**
- * 12.11.2 Const: It is a compile-time error if <i>T</i> is not a class
+ * 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}'.");
/**
* 7.6.1 Generative Constructors: Let <i>C</i> be the class in which the
@@ -2058,10 +2205,17 @@ class CompileTimeErrorCode extends ErrorCode {
* Let <i>k</i> be a generative constructor. It is a compile-time error if
* class <i>S</i> does not declare a generative constructor named <i>S</i>
* (respectively <i>S.id</i>)
+ *
+ * Parameters:
+ * 0: the name of the superclass that does not define the invoked constructor
+ * 1: the name of the constructor being invoked
*/
static const CompileTimeErrorCode UNDEFINED_CONSTRUCTOR_IN_INITIALIZER =
- const CompileTimeErrorCode('UNDEFINED_CONSTRUCTOR_IN_INITIALIZER',
- "The class '{0}' does not have a generative constructor '{1}'");
+ const CompileTimeErrorCode(
+ '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");
/**
* 7.6.1 Generative Constructors: Let <i>C</i> be the class in which the
@@ -2069,11 +2223,16 @@ class CompileTimeErrorCode extends ErrorCode {
* Let <i>k</i> be a generative constructor. It is a compile-time error if
* class <i>S</i> does not declare a generative constructor named <i>S</i>
* (respectively <i>S.id</i>)
+ *
+ * Parameters:
+ * 0: the name of the superclass that does not define the invoked constructor
*/
static const CompileTimeErrorCode
UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT = const CompileTimeErrorCode(
'UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT',
- "The class '{0}' does not have a default generative constructor");
+ "The class '{0}' doesn't have an unnamed constructor.",
+ "Try defining an unnamed constructor in '{0}', or "
+ "invoking a different constructor");
/**
* 12.14.2 Binding Actuals to Formals: Furthermore, each <i>q<sub>i</sub></i>,
@@ -2081,7 +2240,7 @@ class CompileTimeErrorCode extends ErrorCode {
* {<i>p<sub>n+1</sub></i> ... <i>p<sub>n+k</sub></i>} or a static warning
* occurs.
*
- * 12.11.2 Const: It is a compile-time error if evaluation of a constant
+ * 16.12.2 Const: It is a compile-time error if evaluation of a constant
* object results in an uncaught exception being thrown.
*
* Parameters:
@@ -2089,7 +2248,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode UNDEFINED_NAMED_PARAMETER =
const CompileTimeErrorCode('UNDEFINED_NAMED_PARAMETER',
- "The named parameter '{0}' is not defined");
+ "The named parameter '{0}' isn't defined.");
/**
* 14.2 Exports: It is a compile-time error if the compilation unit found at
@@ -2106,9 +2265,10 @@ 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 does not exist: '{0}'");
+ 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
@@ -2120,8 +2280,10 @@ class CompileTimeErrorCode extends ErrorCode {
* See [INVALID_URI], [URI_DOES_NOT_EXIST].
*/
static const CompileTimeErrorCode URI_HAS_NOT_BEEN_GENERATED =
- const CompileTimeErrorCode('URI_HAS_NOT_BEEN_GENERATED',
- "Target of URI has not been generated: '{0}'");
+ 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.");
/**
* 14.1 Imports: It is a compile-time error if <i>x</i> is not a compile-time
@@ -2136,7 +2298,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode URI_WITH_INTERPOLATION =
const CompileTimeErrorCode(
- 'URI_WITH_INTERPOLATION', "URIs cannot use string interpolation");
+ 'URI_WITH_INTERPOLATION', "URIs can't use string interpolation.");
/**
* 7.1.1 Operators: It is a compile-time error if the arity of the
@@ -2154,7 +2316,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR =
const CompileTimeErrorCode('WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR',
- "Operator '{0}' should declare exactly {1} parameter(s), but {2} found");
+ "Operator '{0}' should declare exactly {1} parameter(s), but {2} found.");
/**
* 7.1.1 Operators: It is a compile time error if the arity of the
@@ -2167,7 +2329,7 @@ class CompileTimeErrorCode extends ErrorCode {
WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR_MINUS =
const CompileTimeErrorCode(
'WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR_MINUS',
- "Operator '-' should declare 0 or 1 parameter, but {0} found");
+ "Operator '-' should declare 0 or 1 parameter, but {0} found.");
/**
* 7.3 Setters: It is a compile-time error if a setter's formal parameter list
@@ -2175,7 +2337,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
static const CompileTimeErrorCode WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER =
const CompileTimeErrorCode('WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER',
- "Setters should declare exactly one required parameter");
+ "Setters should declare exactly one required parameter.");
/**
* ?? Yield: It is a compile-time error if a yield statement appears in a
@@ -2183,7 +2345,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
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*')");
+ "Yield-each statements must be in a generator function (one marked with either 'async*' or 'sync*').");
/**
* ?? Yield: It is a compile-time error if a yield statement appears in a
@@ -2191,7 +2353,7 @@ class CompileTimeErrorCode extends ErrorCode {
*/
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*')");
+ "Yield statements must be in a generator function (one marked with either 'async*' or 'sync*').");
/**
* Initialize a newly created error code to have the given [name]. The message
@@ -2224,8 +2386,7 @@ class HintCode extends ErrorCode {
*/
static const HintCode ABSTRACT_SUPER_MEMBER_REFERENCE = const HintCode(
'ABSTRACT_SUPER_MEMBER_REFERENCE',
- "The {0} '{1}' is always abstract in the supertype.",
- null);
+ "The {0} '{1}' is always abstract in the supertype.");
/**
* This hint is generated anywhere where the
@@ -2238,8 +2399,7 @@ class HintCode extends ErrorCode {
*/
static const HintCode ARGUMENT_TYPE_NOT_ASSIGNABLE = const HintCode(
'ARGUMENT_TYPE_NOT_ASSIGNABLE',
- "The argument type '{0}' cannot be assigned to the parameter type '{1}'.",
- null);
+ "The argument type '{0}' can't be assigned to the parameter type '{1}'.");
/**
* When the target expression uses '?.' operator, it can be `null`, so all the
@@ -2247,14 +2407,15 @@ class HintCode extends ErrorCode {
*/
static const HintCode CAN_BE_NULL_AFTER_NULL_AWARE = const HintCode(
'CAN_BE_NULL_AFTER_NULL_AWARE',
- "The expression uses '?.', so can be 'null'",
- "Replace the '.' with a '?.' in the invocation");
+ "The target expression uses '?.', so its value can be null.",
+ "Replace the '.' with a '?.' in the invocation.");
/**
* 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");
+ 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
@@ -2262,7 +2423,7 @@ 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.");
/**
* Dead code is code that is never reached. This case covers cases where the
@@ -2275,7 +2436,7 @@ 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 since '{0}' is a subtype of '{1}'.");
/**
* Deprecated members should not be invoked or used.
@@ -2283,52 +2444,55 @@ class HintCode extends ErrorCode {
* Parameters:
* 0: the name of the member
*/
- static const HintCode DEPRECATED_MEMBER_USE =
- const HintCode('DEPRECATED_MEMBER_USE', "'{0}' is deprecated");
+ static const HintCode DEPRECATED_MEMBER_USE = const HintCode(
+ 'DEPRECATED_MEMBER_USE',
+ "'{0}' is deprecated and shouldn't be used.",
+ "Try replacing the use of the deprecated member with the replacement.");
/**
* Duplicate imports.
*/
- static const HintCode DUPLICATE_IMPORT =
- const HintCode('DUPLICATE_IMPORT', "Duplicate import");
+ static const HintCode DUPLICATE_IMPORT = const HintCode('DUPLICATE_IMPORT',
+ "Duplicate import.", "Try removing all but one import of the library.");
/**
* Hint to use the ~/ operator.
*/
static const HintCode DIVISION_OPTIMIZATION = const HintCode(
'DIVISION_OPTIMIZATION',
- "The operator x ~/ y is more efficient than (x / y).toInt()");
+ "The operator x ~/ y is more efficient than (x / y).toInt().",
+ "Try re-writing the expression to use the '~/' operator.");
/**
* 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");
+ "When compiled to JS, this test might return true when the left hand side is an int.");
/**
* 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");
+ "When compiled to JS, this test might return true when the left hand side is a double.");
/**
* 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");
+ "When compiled to JS, this test might return false when the left hand side is an int.");
/**
* 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");
+ "When compiled to JS, this test might return false when the left hand side is a double.");
/**
* 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");
+ "The library '{0}' defines a top-level function named 'loadLibrary' which is hidden by deferring this library.");
/**
* This hint is generated anywhere where the
@@ -2341,7 +2505,9 @@ class HintCode extends ErrorCode {
*/
static const HintCode INVALID_ASSIGNMENT = const HintCode(
'INVALID_ASSIGNMENT',
- "A value of type '{0}' cannot be assigned to a variable of type '{1}'");
+ "A value of type '{0}' can't be assigned to a variable of type '{1}'.",
+ "Try changing the type of the variable, or "
+ "casting the right-hand type to '{1}'.");
/**
* This hint is generated anywhere a @factory annotation is associated with
@@ -2369,7 +2535,7 @@ class HintCode extends ErrorCode {
*/
static const HintCode INVALID_FACTORY_METHOD_IMPL = const HintCode(
'INVALID_FACTORY_METHOD_IMPL',
- "Factory method '{0}' does not return a newly allocated object.");
+ "Factory method '{0}' doesn't return a newly allocated object.");
/**
* This hint is generated anywhere where a member annotated with `@protected`
@@ -2381,7 +2547,7 @@ 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
@@ -2424,7 +2590,7 @@ class HintCode extends ErrorCode {
*/
static const HintCode MISSING_RETURN = const HintCode(
'MISSING_RETURN',
- "This function declares a return type of '{0}', but does not end with a return statement",
+ "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'");
/**
@@ -2437,7 +2603,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
@@ -2445,36 +2611,36 @@ 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 is not 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,",
+ "Replace 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 does not override an inherited getter");
+ "Getter doesn't override an inherited getter.");
/**
* 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 does not override an inherited getter or setter");
+ "Field doesn't override an inherited getter or setter.");
/**
* 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 does not override an inherited method");
+ "Method doesn't override an inherited method.");
/**
* 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 does not override an inherited setter");
+ "Setter doesn't override an inherited setter.");
/**
* Hint for classes that override equals, but not hashCode.
@@ -2484,20 +2650,23 @@ 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'.");
/**
* Type checks of the type `x is! Null` should be done with `x != null`.
*/
static const HintCode TYPE_CHECK_IS_NOT_NULL = const HintCode(
'TYPE_CHECK_IS_NOT_NULL',
- "Tests for non-null should be done with '!= null'");
+ "Tests for non-null should be done with '!= null'.",
+ "Try replacing the 'is! Null' check with '!= null'.");
/**
* Type checks of the type `x is Null` should be done with `x == null`.
*/
static const HintCode TYPE_CHECK_IS_NULL = const HintCode(
- 'TYPE_CHECK_IS_NULL', "Tests for null should be done with '== null'");
+ 'TYPE_CHECK_IS_NULL',
+ "Tests for null should be done with '== null'.",
+ "Try replacing the 'is Null' check with '== null'.");
/**
* This hint is generated anywhere where the
@@ -2509,15 +2678,17 @@ class HintCode extends ErrorCode {
* 0: the name of the getter
* 1: the name of the enclosing type where the getter is being looked for
*/
- static const HintCode UNDEFINED_GETTER = const HintCode('UNDEFINED_GETTER',
- "The getter '{0}' is not defined for the class '{1}'.", null);
+ static const HintCode UNDEFINED_GETTER = const HintCode(
+ 'UNDEFINED_GETTER',
+ "The getter '{0}' isn't defined for the class '{1}'.",
+ "Try defining a getter or field named '{0}', or invoke a different getter.");
/**
* An undefined name hidden in an import or export directive.
*/
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}'.");
/**
* This hint is generated anywhere where the
@@ -2529,7 +2700,7 @@ class HintCode extends ErrorCode {
* 1: the resolved type name that the method lookup is happening on
*/
static const HintCode UNDEFINED_METHOD = const HintCode('UNDEFINED_METHOD',
- "The method '{0}' is not defined for the class '{1}'.", null);
+ "The method '{0}' isn't defined for the class '{1}'.");
/**
* This hint is generated anywhere where the
@@ -2542,8 +2713,7 @@ class HintCode extends ErrorCode {
*/
static const HintCode UNDEFINED_OPERATOR = const HintCode(
'UNDEFINED_OPERATOR',
- "The operator '{0}' is not defined for the class '{1}'.",
- null);
+ "The operator '{0}' isn't defined for the class '{1}'.");
/**
* This hint is generated anywhere where the
@@ -2555,80 +2725,92 @@ class HintCode extends ErrorCode {
* 0: the name of the setter
* 1: the name of the enclosing type where the setter is being looked for
*/
- static const HintCode UNDEFINED_SETTER = const HintCode('UNDEFINED_SETTER',
- "The setter '{0}' is not defined for the class '{1}'.", null);
+ static const HintCode UNDEFINED_SETTER = const HintCode(
+ 'UNDEFINED_SETTER',
+ "The setter '{0}' isn't defined for the class '{1}'.",
+ "Try defining a setter or field named '{0}', or invoke a different setter.");
/**
* An undefined name shown in an import or export directive.
*/
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}'.");
/**
* Unnecessary cast.
*/
- static const HintCode UNNECESSARY_CAST =
- const HintCode('UNNECESSARY_CAST', "Unnecessary cast");
+ static const HintCode UNNECESSARY_CAST = const HintCode(
+ 'UNNECESSARY_CAST', "Unnecessary cast.", "Try removing the cast.");
/**
* Unnecessary `noSuchMethod` declaration.
*/
static const HintCode UNNECESSARY_NO_SUCH_METHOD = const HintCode(
- 'UNNECESSARY_NO_SUCH_METHOD', "Unnecessary 'noSuchMethod' declaration");
+ 'UNNECESSARY_NO_SUCH_METHOD',
+ "Unnecessary 'noSuchMethod' declaration.",
+ "Try removing the declaration of 'noSuchMethod'.");
/**
* Unnecessary type checks, the result is always true.
*/
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.");
/**
* Unnecessary type checks, the result is always false.
*/
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.");
/**
* See [Modifier.IS_USED_IN_LIBRARY].
*/
static const HintCode UNUSED_ELEMENT =
- const HintCode('UNUSED_ELEMENT', "The {0} '{1}' is not used");
+ const HintCode('UNUSED_ELEMENT', "The {0} '{1}' isn't used.");
/**
* Unused fields are fields which are never read.
*/
static const HintCode UNUSED_FIELD = const HintCode(
- 'UNUSED_FIELD', "The value of the field '{0}' is not used");
+ 'UNUSED_FIELD',
+ "The value of the field '{0}' isn't used.",
+ "Try removing the field, or using it.");
/**
* Unused imports are imports which are never used.
*/
- static const HintCode UNUSED_IMPORT =
- const HintCode('UNUSED_IMPORT', "Unused import");
+ static const HintCode UNUSED_IMPORT = const HintCode(
+ 'UNUSED_IMPORT', "Unused import.", "Try removing the import directive.");
/**
* Unused catch exception variables.
*/
static const HintCode UNUSED_CATCH_CLAUSE = const HintCode(
'UNUSED_CATCH_CLAUSE',
- "The exception variable '{0}' is not used, so the 'catch' clause can be removed");
+ "The exception variable '{0}' isn't used, so the 'catch' clause can be removed.",
+ // TODO(brianwilkerson) Split this error code so that we can differentiate
+ // between removing the catch clause and replacing the catch clause with
+ // an on clause.
+ "Try removing the catch clause.");
/**
* Unused catch stack trace variables.
*/
static const HintCode UNUSED_CATCH_STACK = const HintCode(
'UNUSED_CATCH_STACK',
- "The stack trace variable '{0}' is not used and can be removed");
+ "The stack trace variable '{0}' isn't used and can be removed.",
+ "Try removing the stack trace variable, or using it.");
/**
* Unused local variables are local variables which are never read.
*/
static const HintCode UNUSED_LOCAL_VARIABLE = const HintCode(
'UNUSED_LOCAL_VARIABLE',
- "The value of the local variable '{0}' is not used");
+ "The value of the local variable '{0}' isn't used.",
+ "Try removing the variable, or using it.");
/**
* Unused shown names are names shown on imports which are never used.
@@ -2645,7 +2827,7 @@ class HintCode extends ErrorCode {
*/
static const HintCode USE_OF_VOID_RESULT = const HintCode(
'USE_OF_VOID_RESULT',
- "The result of '{0}' is being used, even though it is declared to be 'void'");
+ "The result of '{0}' is being used, even though it is declared to be 'void'.");
/**
* It is a bad practice for a source file in a package "lib" directory
@@ -2656,7 +2838,7 @@ class HintCode extends ErrorCode {
*/
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 should not reference a file outside that hierarchy");
+ "A file in the 'lib' directory hierarchy shouldn't reference a file outside that hierarchy.");
/**
* It is a bad practice for a source file ouside a package "lib" directory
@@ -2666,8 +2848,10 @@ class HintCode extends ErrorCode {
* directory.
*/
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 should not reference a file inside that hierarchy. Use a package: reference instead.");
+ 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.");
/**
* It is a bad practice for a package import to reference anything outside the
@@ -2677,7 +2861,7 @@ class HintCode extends ErrorCode {
*/
static const HintCode PACKAGE_IMPORT_CONTAINS_DOT_DOT = const HintCode(
'PACKAGE_IMPORT_CONTAINS_DOT_DOT',
- "A package import should not contain '..'");
+ "A package import shouldn't contain '..'.");
/**
* Initialize a newly created error code to have the given [name]. The message
@@ -2742,7 +2926,7 @@ class HtmlWarningCode extends ErrorCode {
* 0: the URI that is invalid
*/
static const HtmlWarningCode INVALID_URI =
- const HtmlWarningCode('INVALID_URI', "Invalid URI syntax: '{0}'");
+ const HtmlWarningCode('INVALID_URI', "Invalid URI syntax: '{0}'.");
/**
* An error code indicating that the value of the 'src' attribute of a Dart
@@ -2752,7 +2936,7 @@ class HtmlWarningCode extends ErrorCode {
* 0: the URI pointing to a non-existent file
*/
static const HtmlWarningCode URI_DOES_NOT_EXIST = const HtmlWarningCode(
- 'URI_DOES_NOT_EXIST', "Target of URI does not exist: '{0}'");
+ 'URI_DOES_NOT_EXIST', "Target of URI doesn't exist: '{0}'.");
/**
* Initialize a newly created error code to have the given [name]. The message
@@ -2804,7 +2988,7 @@ class StaticTypeWarningCode extends ErrorCode {
*/
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");
+ "List literal requires exactly one type arguments or none, but {0} found.");
/**
* 12.8 Maps: A fresh instance (7.6.1) <i>m</i>, of size <i>n</i>, whose class
@@ -2815,7 +2999,7 @@ class StaticTypeWarningCode extends ErrorCode {
*/
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");
+ "Map literal requires exactly two type arguments or none, but {0} found.");
/**
* 9 Functions: It is a static warning if the declared return type of a
@@ -2823,15 +3007,18 @@ class StaticTypeWarningCode extends ErrorCode {
*/
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'");
+ "Functions marked 'async*' must have a return type assignable to 'Stream'.");
/**
* 9 Functions: It is a static warning if the declared return type of a
* function marked async may not be assigned to Future.
*/
static const StaticTypeWarningCode ILLEGAL_ASYNC_RETURN_TYPE =
- const StaticTypeWarningCode('ILLEGAL_ASYNC_RETURN_TYPE',
- "Functions marked 'async' must have a return type assignable to 'Future'");
+ const StaticTypeWarningCode(
+ 'ILLEGAL_ASYNC_RETURN_TYPE',
+ "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.");
/**
* 9 Functions: It is a static warning if the declared return type of a
@@ -2839,17 +3026,7 @@ class StaticTypeWarningCode extends ErrorCode {
*/
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'");
-
- /**
- * 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i>.
- * It is a static type warning if <i>T</i> does not have an accessible
- * instance setter named <i>v=</i>.
- *
- * See [UNDEFINED_SETTER].
- */
- static const StaticTypeWarningCode INACCESSIBLE_SETTER =
- const StaticTypeWarningCode('INACCESSIBLE_SETTER', "");
+ "Functions marked 'sync*' must have a return type assignable to 'Iterable'.");
/**
* 8.1.1 Inheritance and Overriding: However, if the above rules would cause
@@ -2881,7 +3058,7 @@ class StaticTypeWarningCode extends ErrorCode {
*/
static const StaticTypeWarningCode INCONSISTENT_METHOD_INHERITANCE =
const StaticTypeWarningCode('INCONSISTENT_METHOD_INHERITANCE',
- "'{0}' is inherited by at least two interfaces inconsistently, from {1}");
+ "'{0}' is inherited by at least two interfaces inconsistently, from {1}.");
/**
* 12.15.1 Ordinary Invocation: It is a static type warning if <i>T</i> does
@@ -2889,12 +3066,16 @@ class StaticTypeWarningCode extends ErrorCode {
*
* Parameters:
* 0: the name of the static member
+ * 1: the kind of the static member (field, getter, setter, or method)
+ * 2: the name of the defining class
*
* See [UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER].
*/
static const StaticTypeWarningCode INSTANCE_ACCESS_TO_STATIC_MEMBER =
- const StaticTypeWarningCode('INSTANCE_ACCESS_TO_STATIC_MEMBER',
- "Static member '{0}' cannot be accessed using instance access");
+ const StaticTypeWarningCode(
+ 'INSTANCE_ACCESS_TO_STATIC_MEMBER',
+ "Static {1} '{0}' can't be accessed through an instance.",
+ "Try using the class '{2}' to access the {1}.");
/**
* 12.18 Assignment: It is a static type warning if the static type of
@@ -2914,8 +3095,11 @@ class StaticTypeWarningCode extends ErrorCode {
* 1: the name of the left hand side type
*/
static const StaticTypeWarningCode INVALID_ASSIGNMENT =
- const StaticTypeWarningCode('INVALID_ASSIGNMENT',
- "A value of type '{0}' cannot be assigned to a variable of type '{1}'");
+ const StaticTypeWarningCode(
+ 'INVALID_ASSIGNMENT',
+ "A value of type '{0}' can't be assigned to a variable of type '{1}'.",
+ "Try changing the type of the variable, or "
+ "casting the right-hand type to '{1}'.");
/**
* 12.15.1 Ordinary Invocation: An ordinary method invocation <i>i</i> has the
@@ -2943,7 +3127,12 @@ class StaticTypeWarningCode extends ErrorCode {
*/
static const StaticTypeWarningCode INVOCATION_OF_NON_FUNCTION =
const StaticTypeWarningCode(
- 'INVOCATION_OF_NON_FUNCTION', "'{0}' is not a method");
+ 'INVOCATION_OF_NON_FUNCTION',
+ "'{0}' isn't a function.",
+ // TODO(brianwilkerson) Split this error code so that we can provide
+ // better error and correction messages.
+ "Try correcting the name to match an existing function, or "
+ "define a method or function named '{0}'.");
/**
* 12.14.4 Function Expression Invocation: A function expression invocation
@@ -2956,7 +3145,7 @@ class StaticTypeWarningCode extends ErrorCode {
*/
static const StaticTypeWarningCode INVOCATION_OF_NON_FUNCTION_EXPRESSION =
const StaticTypeWarningCode('INVOCATION_OF_NON_FUNCTION_EXPRESSION',
- "Cannot invoke a non-function");
+ "The expression doesn't evaluate to a function, so it can't invoked.");
/**
* 12.20 Conditional: It is a static type warning if the type of
@@ -2973,15 +3162,19 @@ class StaticTypeWarningCode extends ErrorCode {
*/
static const StaticTypeWarningCode NON_BOOL_CONDITION =
const StaticTypeWarningCode(
- 'NON_BOOL_CONDITION', "Conditions must have a static type of 'bool'");
+ 'NON_BOOL_CONDITION',
+ "Conditions must have a static type of 'bool'.",
+ "Try changing the condition.");
/**
* 13.15 Assert: It is a static type warning if the type of <i>e</i> may not
* be assigned to either bool or () &rarr; bool
*/
static const StaticTypeWarningCode NON_BOOL_EXPRESSION =
- const StaticTypeWarningCode('NON_BOOL_EXPRESSION',
- "Assertions must be on either a 'bool' or '() -> bool'");
+ const StaticTypeWarningCode(
+ 'NON_BOOL_EXPRESSION',
+ "Assertions must be on either a 'bool' or '() -> bool'.",
+ "Try changing the expression.");
/**
* 12.28 Unary Expressions: The expression !<i>e</i> is equivalent to the
@@ -2991,8 +3184,10 @@ class StaticTypeWarningCode extends ErrorCode {
* <i>e<sub>1</sub></i> may not be assigned to bool.
*/
static const StaticTypeWarningCode NON_BOOL_NEGATION_EXPRESSION =
- const StaticTypeWarningCode('NON_BOOL_NEGATION_EXPRESSION',
- "Negation argument must have a static type of 'bool'");
+ const StaticTypeWarningCode(
+ 'NON_BOOL_NEGATION_EXPRESSION',
+ "Negation argument must have a static type of 'bool'.",
+ "Try changing the argument to the '!' operator.");
/**
* 12.21 Logical Boolean Expressions: It is a static type warning if the
@@ -3004,19 +3199,22 @@ class StaticTypeWarningCode extends ErrorCode {
*/
static const StaticTypeWarningCode NON_BOOL_OPERAND =
const StaticTypeWarningCode('NON_BOOL_OPERAND',
- "The operands of the '{0}' operator must be assignable to 'bool'");
+ "The operands of the '{0}' operator must be assignable to 'bool'.");
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");
+ "Variable '{0}' of non-nullable type '{1}' must be initialized.");
/**
* 15.8 Parameterized Types: It is a static type warning if <i>A<sub>i</sub>,
* 1 &lt;= i &lt;= n</i> does not denote a type in the enclosing lexical scope.
*/
static const StaticTypeWarningCode NON_TYPE_AS_TYPE_ARGUMENT =
- const StaticTypeWarningCode('NON_TYPE_AS_TYPE_ARGUMENT',
- "The name '{0}' is not a type and cannot be used as a parameterized type");
+ const StaticTypeWarningCode(
+ 'NON_TYPE_AS_TYPE_ARGUMENT',
+ "The name '{0}' isn't a type so it can't be used as a type argument.",
+ "Try correcting the name to an existing type, or"
+ "defining a type named '{0}'.");
/**
* 13.11 Return: It is a static type warning if the type of <i>e</i> may not
@@ -3029,10 +3227,8 @@ class StaticTypeWarningCode extends ErrorCode {
* 2: the name of the method
*/
static const StaticTypeWarningCode RETURN_OF_INVALID_TYPE =
- const StaticTypeWarningCode(
- 'RETURN_OF_INVALID_TYPE',
- "The return type '{0}' is not a '{1}', as defined by the method '{2}'.",
- null);
+ const StaticTypeWarningCode('RETURN_OF_INVALID_TYPE',
+ "The return type '{0}' isn't a '{1}', as defined by the method '{2}'.");
/**
* 12.11 Instance Creation: It is a static type warning if any of the type
@@ -3064,7 +3260,7 @@ class StaticTypeWarningCode extends ErrorCode {
*/
static const StaticTypeWarningCode TYPE_ARGUMENT_NOT_MATCHING_BOUNDS =
const StaticTypeWarningCode(
- 'TYPE_ARGUMENT_NOT_MATCHING_BOUNDS', "'{0}' does not extend '{1}'");
+ 'TYPE_ARGUMENT_NOT_MATCHING_BOUNDS', "'{0}' doesn't extend '{1}'.");
/**
* 10 Generics: It is a static type warning if a type parameter is a supertype
@@ -3077,7 +3273,7 @@ class StaticTypeWarningCode extends ErrorCode {
*/
static const StaticTypeWarningCode TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND =
const StaticTypeWarningCode('TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND',
- "'{0}' cannot be a supertype of its upper bound");
+ "'{0}' can't be a supertype of its upper bound.");
/**
* 12.17 Getter Invocation: It is a static warning if there is no class
@@ -3089,8 +3285,11 @@ class StaticTypeWarningCode extends ErrorCode {
* 1: the name of the enumeration used to access the constant
*/
static const StaticTypeWarningCode UNDEFINED_ENUM_CONSTANT =
- const StaticTypeWarningCode('UNDEFINED_ENUM_CONSTANT',
- "There is no constant named '{0}' in '{1}'.", null);
+ const StaticTypeWarningCode(
+ 'UNDEFINED_ENUM_CONSTANT',
+ "There is no constant named '{0}' in '{1}'.",
+ "Try correcting the name to the name of an existing constant, or"
+ "defining a constant named '{0}'.");
/**
* 12.15.3 Unqualified Invocation: If there exists a lexically visible
@@ -3106,7 +3305,11 @@ class StaticTypeWarningCode extends ErrorCode {
*/
static const StaticTypeWarningCode UNDEFINED_FUNCTION =
const StaticTypeWarningCode(
- 'UNDEFINED_FUNCTION', "The function '{0}' is not defined.", null);
+ 'UNDEFINED_FUNCTION',
+ "The function '{0}' isn't defined.",
+ "Try importing the library that defines '{0}', "
+ "correcting the name to the name of an existing function, or"
+ "defining a funtion named '{0}'.");
/**
* 12.17 Getter Invocation: Let <i>T</i> be the static type of <i>e</i>. It is
@@ -3117,8 +3320,12 @@ class StaticTypeWarningCode extends ErrorCode {
* 1: the name of the enclosing type where the getter is being looked for
*/
static const StaticTypeWarningCode UNDEFINED_GETTER =
- const StaticTypeWarningCode('UNDEFINED_GETTER',
- "The getter '{0}' is not defined for the class '{1}'.", null);
+ const StaticTypeWarningCode(
+ 'UNDEFINED_GETTER',
+ "The getter '{0}' isn't defined for the class '{1}'.",
+ "Try importing the library that defines '{0}', "
+ "correcting the name to the name of an existing getter, or"
+ "defining a getter or field named '{0}'.");
/**
* 12.15.1 Ordinary Invocation: Let <i>T</i> be the static type of <i>o</i>.
@@ -3130,8 +3337,11 @@ class StaticTypeWarningCode extends ErrorCode {
* 1: the resolved type name that the method lookup is happening on
*/
static const StaticTypeWarningCode UNDEFINED_METHOD =
- const StaticTypeWarningCode('UNDEFINED_METHOD',
- "The method '{0}' is not defined for the class '{1}'.", null);
+ const StaticTypeWarningCode(
+ '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}'.");
/**
* 12.15.1 Ordinary Invocation: Let <i>T</i> be the static type of <i>o</i>.
@@ -3145,8 +3355,9 @@ class StaticTypeWarningCode extends ErrorCode {
static const StaticTypeWarningCode UNDEFINED_METHOD_WITH_CONSTRUCTOR =
const StaticTypeWarningCode(
'UNDEFINED_METHOD_WITH_CONSTRUCTOR',
- "The method '{0}' is not defined for the class '{1}', but a constructor with that name is defined.",
- "Try adding 'new' or 'const' to invoke the constuctor, or change the method name.");
+ "The method '{0}' isn't defined for the class '{1}', but a constructor with that name is defined.",
+ "Try adding 'new' or 'const' to invoke the constuctor, or "
+ "correcting the name to the name of an existing method.");
/**
* 12.18 Assignment: Evaluation of an assignment of the form
@@ -3169,8 +3380,10 @@ class StaticTypeWarningCode extends ErrorCode {
* 1: the name of the enclosing type where the operator is being looked for
*/
static const StaticTypeWarningCode UNDEFINED_OPERATOR =
- const StaticTypeWarningCode('UNDEFINED_OPERATOR',
- "The operator '{0}' is not defined for the class '{1}'.", null);
+ const StaticTypeWarningCode(
+ 'UNDEFINED_OPERATOR',
+ "The operator '{0}' isn't defined for the class '{1}'.",
+ "Try defining the operator '{0}'.");
/**
* 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i>.
@@ -3180,12 +3393,14 @@ class StaticTypeWarningCode extends ErrorCode {
* Parameters:
* 0: the name of the setter
* 1: the name of the enclosing type where the setter is being looked for
- *
- * See [INACCESSIBLE_SETTER].
*/
static const StaticTypeWarningCode UNDEFINED_SETTER =
- const StaticTypeWarningCode('UNDEFINED_SETTER',
- "The setter '{0}' is not defined for the class '{1}'.", null);
+ const StaticTypeWarningCode(
+ 'UNDEFINED_SETTER',
+ "The setter '{0}' isn't defined for the class '{1}'.",
+ "Try importing the library that defines '{0}', "
+ "correcting the name to the name of an existing setter, or"
+ "defining a setter or field named '{0}'.");
/**
* 12.17 Getter Invocation: Let <i>T</i> be the static type of <i>e</i>. It is
@@ -3196,8 +3411,11 @@ class StaticTypeWarningCode extends ErrorCode {
* 1: the name of the enclosing type where the getter is being looked for
*/
static const StaticTypeWarningCode UNDEFINED_SUPER_GETTER =
- const StaticTypeWarningCode('UNDEFINED_SUPER_GETTER',
- "The getter '{0}' is not defined in a superclass of '{1}'.", null);
+ const StaticTypeWarningCode(
+ 'UNDEFINED_SUPER_GETTER',
+ "The getter '{0}' isn't defined in a superclass of '{1}'.",
+ "Try correcting the name to the name of an existing getter, or"
+ "defining a getter or field named '{0}' in a superclass.");
/**
* 12.15.4 Super Invocation: A super method invocation <i>i</i> has the form
@@ -3211,8 +3429,11 @@ class StaticTypeWarningCode extends ErrorCode {
* 1: the resolved type name that the method lookup is happening on
*/
static const StaticTypeWarningCode UNDEFINED_SUPER_METHOD =
- const StaticTypeWarningCode('UNDEFINED_SUPER_METHOD',
- "The method '{0}' is not defined in a superclass of '{1}'.", null);
+ const StaticTypeWarningCode(
+ 'UNDEFINED_SUPER_METHOD',
+ "The method '{0}' isn't defined in a superclass of '{1}'.",
+ "Try correcting the name to the name of an existing method, or"
+ "defining a method named '{0}' in a superclass.");
/**
* 12.18 Assignment: Evaluation of an assignment of the form
@@ -3235,8 +3456,10 @@ class StaticTypeWarningCode extends ErrorCode {
* 1: the name of the enclosing type where the operator is being looked for
*/
static const StaticTypeWarningCode UNDEFINED_SUPER_OPERATOR =
- const StaticTypeWarningCode('UNDEFINED_SUPER_OPERATOR',
- "The operator '{0}' is not defined in a superclass of '{1}'.", null);
+ const StaticTypeWarningCode(
+ 'UNDEFINED_SUPER_OPERATOR',
+ "The operator '{0}' isn't defined in a superclass of '{1}'.",
+ "Try defining the operator '{0}' in a superclass.");
/**
* 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i>.
@@ -3246,12 +3469,13 @@ class StaticTypeWarningCode extends ErrorCode {
* Parameters:
* 0: the name of the setter
* 1: the name of the enclosing type where the setter is being looked for
- *
- * See [INACCESSIBLE_SETTER].
*/
static const StaticTypeWarningCode UNDEFINED_SUPER_SETTER =
- const StaticTypeWarningCode('UNDEFINED_SUPER_SETTER',
- "The setter '{0}' is not defined in a superclass of '{1}'.", null);
+ const StaticTypeWarningCode(
+ 'UNDEFINED_SUPER_SETTER',
+ "The setter '{0}' isn't defined in a superclass of '{1}'.",
+ "Try correcting the name to the name of an existing setter, or"
+ "defining a setter or field named '{0}' in a superclass.");
/**
* 12.15.1 Ordinary Invocation: It is a static type warning if <i>T</i> does
@@ -3260,12 +3484,16 @@ class StaticTypeWarningCode extends ErrorCode {
* This is a specialization of [INSTANCE_ACCESS_TO_STATIC_MEMBER] that is used
* when we are able to find the name defined in a supertype. It exists to
* provide a more informative error message.
+ *
+ * Parameters:
+ * 0: the name of the defining type
*/
static const StaticTypeWarningCode
UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER =
const StaticTypeWarningCode(
'UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER',
- "Static members from supertypes must be qualified by the name of the defining type");
+ "Static members from supertypes must be qualified by the name of the defining type.",
+ "Try adding '{0}.' before the name.");
/**
* 15.8 Parameterized Types: It is a static type warning if <i>G</i> is not a
@@ -3281,7 +3509,7 @@ class StaticTypeWarningCode extends ErrorCode {
*/
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");
+ "The type '{0}' is declared with {1} type parameters, but {2} type arguments were given.");
/**
* 17.16.1 Yield: Let T be the static type of e [the expression to the right
@@ -3303,7 +3531,7 @@ class StaticTypeWarningCode extends ErrorCode {
*/
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}'");
+ "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,
@@ -3315,7 +3543,7 @@ class StaticTypeWarningCode extends ErrorCode {
*/
static const StaticTypeWarningCode FOR_IN_OF_INVALID_TYPE =
const StaticTypeWarningCode('FOR_IN_OF_INVALID_TYPE',
- "The type '{0}' used in the 'for' loop must implement {1}");
+ "The type '{0}' used in the 'for' loop must implement {1}.");
/**
* 17.6.2 For-in. It the iterable expression does not implement Iterable with
@@ -3329,7 +3557,7 @@ class StaticTypeWarningCode extends ErrorCode {
*/
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}'");
+ "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
@@ -3370,9 +3598,9 @@ class StaticWarningCode extends ErrorCode {
*/
static const StaticWarningCode AMBIGUOUS_IMPORT = const StaticWarningCode(
'AMBIGUOUS_IMPORT',
- "The name '{0}' is defined in the libraries {1}",
- "Consider using 'as prefix' for one of the import directives "
- "or hiding the name from all but one of the imports.");
+ "The name '{0}' is defined in the libraries {1}.",
+ "Try using 'as prefix' for one of the import directives, or "
+ "hiding the name from all but one of the imports.");
/**
* 12.11.1 New: It is a static warning if the static type of <i>a<sub>i</sub>,
@@ -3380,7 +3608,7 @@ class StaticWarningCode extends ErrorCode {
* corresponding formal parameter of the constructor <i>T.id</i> (respectively
* <i>T</i>).
*
- * 12.11.2 Const: It is a static warning if the static type of
+ * 16.12.2 Const: It is a static warning if the static type of
* <i>a<sub>i</sub>, 1 &lt;= i &lt;= n+ k</i> may not be assigned to the type
* of the corresponding formal parameter of the constructor <i>T.id</i>
* (respectively <i>T</i>).
@@ -3404,10 +3632,8 @@ class StaticWarningCode extends ErrorCode {
* 1: the name of the expected type
*/
static const StaticWarningCode ARGUMENT_TYPE_NOT_ASSIGNABLE =
- const StaticWarningCode(
- 'ARGUMENT_TYPE_NOT_ASSIGNABLE',
- "The argument type '{0}' cannot be assigned to the parameter type '{1}'.",
- null);
+ const StaticWarningCode('ARGUMENT_TYPE_NOT_ASSIGNABLE',
+ "The argument type '{0}' can't be assigned to the parameter type '{1}'.");
/**
* 5 Variables: Attempting to assign to a final variable elsewhere will cause
@@ -3417,7 +3643,7 @@ class StaticWarningCode extends ErrorCode {
* A constant variable is always implicitly final.
*/
static const StaticWarningCode ASSIGNMENT_TO_CONST = const StaticWarningCode(
- 'ASSIGNMENT_TO_CONST', "Constant variables cannot be assigned a value");
+ 'ASSIGNMENT_TO_CONST', "Constant variables can't be assigned a value.");
/**
* 5 Variables: Attempting to assign to a final variable elsewhere will cause
@@ -3425,7 +3651,9 @@ class StaticWarningCode extends ErrorCode {
* assignment will also give rise to a static warning for the same reason.
*/
static const StaticWarningCode ASSIGNMENT_TO_FINAL = const StaticWarningCode(
- 'ASSIGNMENT_TO_FINAL', "'{0}' cannot be used as a setter, it is final");
+ 'ASSIGNMENT_TO_FINAL',
+ "'{0}' can't be used as a setter because it is final.",
+ "Try finding a different setter, or making '{0}' non-final.");
/**
* 5 Variables: Attempting to assign to a final variable elsewhere will cause
@@ -3434,7 +3662,7 @@ class StaticWarningCode extends ErrorCode {
*/
static const StaticWarningCode ASSIGNMENT_TO_FINAL_NO_SETTER =
const StaticWarningCode('ASSIGNMENT_TO_FINAL_NO_SETTER',
- "No setter named '{0}' in class '{1}'");
+ "No setter named '{0}' in class '{1}'.");
/**
* 12.18 Assignment: It is as static warning if an assignment of the form
@@ -3445,7 +3673,7 @@ class StaticWarningCode extends ErrorCode {
*/
static const StaticWarningCode ASSIGNMENT_TO_FUNCTION =
const StaticWarningCode(
- 'ASSIGNMENT_TO_FUNCTION', "Functions cannot be assigned a value");
+ 'ASSIGNMENT_TO_FUNCTION', "Functions can't be assigned a value.");
/**
* 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i>
@@ -3453,7 +3681,7 @@ class StaticWarningCode extends ErrorCode {
* instance setter named <i>v=</i>.
*/
static const StaticWarningCode ASSIGNMENT_TO_METHOD = const StaticWarningCode(
- 'ASSIGNMENT_TO_METHOD', "Methods cannot be assigned a value");
+ 'ASSIGNMENT_TO_METHOD', "Methods can't be assigned a value.");
/**
* 12.18 Assignment: It is as static warning if an assignment of the form
@@ -3463,7 +3691,7 @@ class StaticWarningCode extends ErrorCode {
* name <i>v=</i> in the lexical scope enclosing the assignment.
*/
static const StaticWarningCode ASSIGNMENT_TO_TYPE = const StaticWarningCode(
- 'ASSIGNMENT_TO_TYPE', "Types cannot be assigned a value");
+ 'ASSIGNMENT_TO_TYPE', "Types can't be assigned a value.");
/**
* 13.9 Switch: It is a static warning if the last statement of the statement
@@ -3471,8 +3699,10 @@ class StaticWarningCode extends ErrorCode {
* statement.
*/
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'");
+ const StaticWarningCode(
+ 'CASE_BLOCK_NOT_TERMINATED',
+ "The last statement of the 'case' should be 'break', 'continue', 'return' or 'throw'.",
+ "Try adding one of the required statements.");
/**
* 12.32 Type Cast: It is a static warning if <i>T</i> does not denote a type
@@ -3480,15 +3710,23 @@ class StaticWarningCode extends ErrorCode {
*/
static const StaticWarningCode CAST_TO_NON_TYPE = const StaticWarningCode(
'CAST_TO_NON_TYPE',
- "The name '{0}' is not a type and cannot be used in an 'as' expression");
+ "The name '{0}' isn't a type, so it can't be used in an 'as' expression.",
+ "Try changing the name to the name of an existing type, or "
+ "creating a type with the name '{0}'.");
/**
* 7.4 Abstract Instance Members: It is a static warning if an abstract member
* is declared or inherited in a concrete class.
+ *
+ * Parameters:
+ * 0: the name of the abstract method
+ * 1: the name of the enclosing class
*/
static const StaticWarningCode CONCRETE_CLASS_WITH_ABSTRACT_MEMBER =
- const StaticWarningCode('CONCRETE_CLASS_WITH_ABSTRACT_MEMBER',
- "'{0}' must have a method body because '{1}' is not abstract");
+ const StaticWarningCode(
+ 'CONCRETE_CLASS_WITH_ABSTRACT_MEMBER',
+ "'{0}' must have a method body because '{1}' isn't abstract.",
+ "Try making '{1}' abstract, or adding a body to '{0}'.");
/**
* 14.1 Imports: If a name <i>N</i> is referenced by a library <i>L</i> and
@@ -3505,7 +3743,7 @@ class StaticWarningCode extends ErrorCode {
*/
static const StaticWarningCode CONFLICTING_DART_IMPORT =
const StaticWarningCode('CONFLICTING_DART_IMPORT',
- "Element '{0}' from SDK library '{1}' is implicitly hidden by '{2}'");
+ "Element '{0}' from SDK library '{1}' is implicitly hidden by '{2}'.");
/**
* 7.2 Getters: It is a static warning if a class <i>C</i> declares an
@@ -3519,7 +3757,7 @@ 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.");
/**
* 7.1 Instance Methods: It is a static warning if a class <i>C</i> declares
@@ -3527,7 +3765,7 @@ class StaticWarningCode extends ErrorCode {
*/
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}'");
+ "Class '{0}' declares instance method '{1}', but also has a setter with the same name from '{2}'.");
/**
* 7.1 Instance Methods: It is a static warning if a class <i>C</i> declares
@@ -3535,7 +3773,7 @@ class StaticWarningCode extends ErrorCode {
*/
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");
+ "Class '{0}' declares the setter '{1}', but also has an instance method in the same class.");
/**
* 7.3 Setters: It is a static warning if a class <i>C</i> declares an
@@ -3549,7 +3787,7 @@ 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 static member with the same name.");
/**
* 7.2 Getters: It is a static warning if a class declares a static getter
@@ -3557,7 +3795,7 @@ class StaticWarningCode extends ErrorCode {
*/
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");
+ "Class '{0}' declares non-static setter with the same name.");
/**
* 7.3 Setters: It is a static warning if a class declares a static setter
@@ -3565,24 +3803,24 @@ class StaticWarningCode extends ErrorCode {
*/
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");
+ "Class '{0}' declares non-static member with the same name.");
/**
- * 12.11.2 Const: Given an instance creation expression of the form <i>const
+ * 16.12.2 Const: Given an instance creation expression of the form <i>const
* q(a<sub>1</sub>, &hellip; a<sub>n</sub>)</i> it is a static warning if
* <i>q</i> is the constructor of an abstract class but <i>q</i> is not a
* factory constructor.
*/
static const StaticWarningCode CONST_WITH_ABSTRACT_CLASS =
const StaticWarningCode('CONST_WITH_ABSTRACT_CLASS',
- "Abstract classes cannot be created with a 'const' expression");
+ "Abstract classes can't be created with a 'const' expression.");
/**
* 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 cannot be equal");
+ 'EQUAL_KEYS_IN_MAP', "Keys in a map can't be equal.");
/**
* 14.2 Exports: It is a static warning to export two different libraries with
@@ -3595,7 +3833,7 @@ class StaticWarningCode extends ErrorCode {
*/
static const StaticWarningCode EXPORT_DUPLICATED_LIBRARY_NAMED =
const StaticWarningCode('EXPORT_DUPLICATED_LIBRARY_NAMED',
- "The exported libraries '{0}' and '{1}' cannot have the same name '{2}'");
+ "The exported libraries '{0}' and '{1}' can't have the same name '{2}'.");
/**
* 12.14.2 Binding Actuals to Formals: It is a static warning if <i>m &lt;
@@ -3608,8 +3846,11 @@ class StaticWarningCode extends ErrorCode {
* See [NOT_ENOUGH_REQUIRED_ARGUMENTS].
*/
static const StaticWarningCode EXTRA_POSITIONAL_ARGUMENTS =
- const StaticWarningCode('EXTRA_POSITIONAL_ARGUMENTS',
- "{0} positional arguments expected, but {1} found");
+ const StaticWarningCode(
+ 'EXTRA_POSITIONAL_ARGUMENTS',
+ "{0} positional arguments expected, but {1} found.",
+ "Try removing the extra positional arguments, or "
+ "defining additional parameters.");
/**
* 5. Variables: It is a static warning if a final instance variable that has
@@ -3620,7 +3861,7 @@ class StaticWarningCode extends ErrorCode {
FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION =
const StaticWarningCode(
'FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION',
- "Values cannot be set in the constructor if they are final, and have already been set");
+ "Values can't be set in the constructor if they are final and have already been set.");
/**
* 5. Variables: It is a static warning if a final instance variable that has
@@ -3634,7 +3875,7 @@ 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 cannot 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.");
/**
* 7.6.1 Generative Constructors: Execution of an initializer of the form
@@ -3655,7 +3896,7 @@ class StaticWarningCode extends ErrorCode {
*/
static const StaticWarningCode FIELD_INITIALIZER_NOT_ASSIGNABLE =
const StaticWarningCode('FIELD_INITIALIZER_NOT_ASSIGNABLE',
- "The initializer type '{0}' cannot be assigned to the field type '{1}'");
+ "The initializer type '{0}' can't be assigned to the field type '{1}'.");
/**
* 7.6.1 Generative Constructors: An initializing formal has the form
@@ -3668,7 +3909,7 @@ class StaticWarningCode extends ErrorCode {
*/
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}'");
+ "The parameter type '{0}' is incompatable with the field type '{1}'.");
/**
* 5 Variables: It is a static warning if a library, static or local variable
@@ -3679,8 +3920,14 @@ class StaticWarningCode extends ErrorCode {
* 0: the name of the uninitialized final variable
*/
static const StaticWarningCode FINAL_NOT_INITIALIZED =
- const StaticWarningCode('FINAL_NOT_INITIALIZED',
- "The final variable '{0}' must be initialized", null, false);
+ const StaticWarningCode(
+ 'FINAL_NOT_INITIALIZED',
+ "The final variable '{0}' must be initialized.",
+ // TODO(brianwilkerson) Split this error code so that we can suggest
+ // initializing fields in constructors (FINAL_FIELD_NOT_INITIALIZED
+ // and FINAL_VARIABLE_NOT_INITIALIZED).
+ "Try initializing the variable.",
+ false);
/**
* 7.6.1 Generative Constructors: Each final instance variable <i>f</i>
@@ -3695,8 +3942,11 @@ class StaticWarningCode extends ErrorCode {
* 0: the name of the uninitialized final variable
*/
static const StaticWarningCode FINAL_NOT_INITIALIZED_CONSTRUCTOR_1 =
- const StaticWarningCode('FINAL_NOT_INITIALIZED_CONSTRUCTOR_1',
- "The final variable '{0}' must be initialized", null, false);
+ const StaticWarningCode(
+ 'FINAL_NOT_INITIALIZED_CONSTRUCTOR_1',
+ "The final variable '{0}' must be initialized.",
+ "Try adding an initializer for the field.",
+ false);
/**
* 7.6.1 Generative Constructors: Each final instance variable <i>f</i>
@@ -3714,8 +3964,8 @@ class StaticWarningCode extends ErrorCode {
static const StaticWarningCode FINAL_NOT_INITIALIZED_CONSTRUCTOR_2 =
const StaticWarningCode(
'FINAL_NOT_INITIALIZED_CONSTRUCTOR_2',
- "The final variables '{0}' and '{1}' must be initialized",
- null,
+ "The final variables '{0}' and '{1}' must be initialized.",
+ "Try adding initializers for the fields.",
false);
/**
@@ -3735,8 +3985,8 @@ class StaticWarningCode extends ErrorCode {
static const StaticWarningCode FINAL_NOT_INITIALIZED_CONSTRUCTOR_3_PLUS =
const StaticWarningCode(
'FINAL_NOT_INITIALIZED_CONSTRUCTOR_3',
- "The final variables '{0}', '{1}' and '{2}' more must be initialized",
- null,
+ "The final variables '{0}', '{1}' and '{2}' more must be initialized.",
+ "Try adding initializers for the fields.",
false);
/**
@@ -3745,7 +3995,8 @@ class StaticWarningCode extends ErrorCode {
*/
static const StaticWarningCode FUNCTION_WITHOUT_CALL = const StaticWarningCode(
'FUNCTION_WITHOUT_CALL',
- "Concrete classes that implement Function must implement the method call()");
+ "Concrete classes that implement 'Function' must implement the method 'call'.",
+ "Try implementing a 'call' method, or don't implement 'Function'.");
/**
* 14.1 Imports: It is a static warning to import two different libraries with
@@ -3758,7 +4009,7 @@ class StaticWarningCode extends ErrorCode {
*/
static const StaticWarningCode IMPORT_DUPLICATED_LIBRARY_NAMED =
const StaticWarningCode('IMPORT_DUPLICATED_LIBRARY_NAMED',
- "The imported libraries '{0}' and '{1}' cannot have the same name '{2}'");
+ "The imported libraries '{0}' and '{1}' can't have the same name '{2}'.");
/**
* 14.1 Imports: It is a static warning if the specified URI of a deferred
@@ -3771,7 +4022,7 @@ class StaticWarningCode extends ErrorCode {
*/
static const StaticWarningCode IMPORT_OF_NON_LIBRARY =
const StaticWarningCode('IMPORT_OF_NON_LIBRARY',
- "The imported library '{0}' must not have a part-of directive");
+ "The imported library '{0}' can't have a part-of directive.");
/**
* 8.1.1 Inheritance and Overriding: However, if the above rules would cause
@@ -3788,7 +4039,7 @@ 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.");
/**
* 7.1 Instance Methods: It is a static warning if a class <i>C</i> declares
@@ -3803,7 +4054,7 @@ 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}'.");
/**
* 7.2 Getters: It is a static warning if a getter <i>m1</i> overrides a
@@ -3820,7 +4071,7 @@ class StaticWarningCode extends ErrorCode {
*/
static const StaticWarningCode INVALID_GETTER_OVERRIDE_RETURN_TYPE =
const StaticWarningCode('INVALID_GETTER_OVERRIDE_RETURN_TYPE',
- "The return type '{0}' is not assignable to '{1}' as required by the getter it is overriding from '{2}'");
+ "The return type '{0}' isn't assignable to '{1}' as required by the getter it is overriding from '{2}'.");
/**
* 7.1 Instance Methods: It is a static warning if an instance method
@@ -3835,7 +4086,7 @@ class StaticWarningCode extends ErrorCode {
*/
static const StaticWarningCode INVALID_METHOD_OVERRIDE_NAMED_PARAM_TYPE =
const StaticWarningCode('INVALID_METHOD_OVERRIDE_NAMED_PARAM_TYPE',
- "The parameter type '{0}' is not assignable to '{1}' as required by the method it is overriding from '{2}'");
+ "The parameter type '{0}' isn't assignable to '{1}' as required by the method it is overriding from '{2}'.");
/**
* Generic Method DEP: number of type parameters must match.
@@ -3848,7 +4099,7 @@ class StaticWarningCode extends ErrorCode {
*/
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}'");
+ "The method has {0} type parameters, but it is overriding a method with {1} type parameters from '{2}'.");
/**
* Generic Method DEP: bounds of type parameters must be compatible.
@@ -3863,7 +4114,7 @@ class StaticWarningCode extends ErrorCode {
*/
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}'");
+ "The type parameter '{0}' extends '{1}', but that is stricter than '{2}' extends '{3}' in the overridden method from '{4}'.");
/**
* 7.1 Instance Methods: It is a static warning if an instance method
@@ -3879,7 +4130,7 @@ class StaticWarningCode extends ErrorCode {
*/
static const StaticWarningCode INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE =
const StaticWarningCode('INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE',
- "The parameter type '{0}' is not assignable to '{1}' as required by the method it is overriding from '{2}'");
+ "The parameter type '{0}' isn't assignable to '{1}' as required by the method it is overriding from '{2}'.");
/**
* 7.1 Instance Methods: It is a static warning if an instance method
@@ -3894,7 +4145,7 @@ class StaticWarningCode extends ErrorCode {
*/
static const StaticWarningCode INVALID_METHOD_OVERRIDE_OPTIONAL_PARAM_TYPE =
const StaticWarningCode('INVALID_METHOD_OVERRIDE_OPTIONAL_PARAM_TYPE',
- "The parameter type '{0}' is not assignable to '{1}' as required by the method it is overriding from '{2}'");
+ "The parameter type '{0}' isn't assignable to '{1}' as required by the method it is overriding from '{2}'.");
/**
* 7.1 Instance Methods: It is a static warning if an instance method
@@ -3911,7 +4162,7 @@ class StaticWarningCode extends ErrorCode {
*/
static const StaticWarningCode INVALID_METHOD_OVERRIDE_RETURN_TYPE =
const StaticWarningCode('INVALID_METHOD_OVERRIDE_RETURN_TYPE',
- "The return type '{0}' is not assignable to '{1}' as required by the method it is overriding from '{2}'");
+ "The return type '{0}' isn't assignable to '{1}' as required by the method it is overriding from '{2}'.");
/**
* 7.1 Instance Methods: It is a static warning if an instance method
@@ -3923,7 +4174,7 @@ class StaticWarningCode extends ErrorCode {
static const StaticWarningCode
INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_NAMED = const StaticWarningCode(
'INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_NAMED',
- "Parameters cannot 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.");
/**
* 7.1 Instance Methods: It is a static warning if an instance method
@@ -3936,7 +4187,7 @@ class StaticWarningCode extends ErrorCode {
INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_POSITIONAL =
const StaticWarningCode(
'INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_POSITIONAL',
- "Parameters cannot 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.");
/**
* 7.1 Instance Methods: It is a static warning if an instance method
@@ -3950,7 +4201,7 @@ class StaticWarningCode extends ErrorCode {
*/
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}'");
+ "Missing the named parameter '{0}' to match the overridden method from '{1}' from '{2}'.");
/**
* 7.1 Instance Methods: It is a static warning if an instance method
@@ -3964,7 +4215,7 @@ class StaticWarningCode extends ErrorCode {
*/
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}'");
+ "Must have at least {0} parameters to match the overridden method '{1}' from '{2}'.");
/**
* 7.1 Instance Methods: It is a static warning if an instance method
@@ -3978,7 +4229,7 @@ class StaticWarningCode extends ErrorCode {
*/
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}'");
+ "Must have {0} required parameters or less to match the overridden method '{1}' from '{2}'.");
/**
* 7.3 Setters: It is a static warning if a setter <i>m1</i> overrides a
@@ -3995,7 +4246,7 @@ class StaticWarningCode extends ErrorCode {
*/
static const StaticWarningCode INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE =
const StaticWarningCode('INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE',
- "The parameter type '{0}' is not assignable to '{1}' as required by the setter it is overriding from '{2}'");
+ "The parameter type '{0}' isn't assignable to '{1}' as required by the setter it is overriding from '{2}'.");
/**
* 12.6 Lists: A run-time list literal &lt;<i>E</i>&gt; [<i>e<sub>1</sub></i>
@@ -4012,7 +4263,7 @@ class StaticWarningCode extends ErrorCode {
*/
static const StaticWarningCode LIST_ELEMENT_TYPE_NOT_ASSIGNABLE =
const StaticWarningCode('LIST_ELEMENT_TYPE_NOT_ASSIGNABLE',
- "The element type '{0}' cannot be assigned to the list type '{1}'");
+ "The element type '{0}' can't be assigned to the list type '{1}'.");
/**
* 12.7 Map: A run-time map literal &lt;<i>K</i>, <i>V</i>&gt;
@@ -4031,7 +4282,7 @@ class StaticWarningCode extends ErrorCode {
*/
static const StaticWarningCode MAP_KEY_TYPE_NOT_ASSIGNABLE =
const StaticWarningCode('MAP_KEY_TYPE_NOT_ASSIGNABLE',
- "The element type '{0}' cannot be assigned to the map key type '{1}'");
+ "The element type '{0}' can't be assigned to the map key type '{1}'.");
/**
* 12.7 Map: A run-time map literal &lt;<i>K</i>, <i>V</i>&gt;
@@ -4050,7 +4301,7 @@ class StaticWarningCode extends ErrorCode {
*/
static const StaticWarningCode MAP_VALUE_TYPE_NOT_ASSIGNABLE =
const StaticWarningCode('MAP_VALUE_TYPE_NOT_ASSIGNABLE',
- "The element type '{0}' cannot be assigned to the map value type '{1}'");
+ "The element type '{0}' can't be assigned to the map value type '{1}'.");
/**
* 7.3 Setters: It is a static warning if a class has a setter named <i>v=</i>
@@ -4060,7 +4311,7 @@ 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 is not assignable to its getter (of type '{2}')",
+ "The parameter type for setter '{0}' is '{1}' which isn't assignable to its getter (of type '{2}').",
null,
false);
@@ -4073,7 +4324,7 @@ 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 is not assignable to its getter (of type '{2}'), from superclass '{3}'",
+ "The parameter type for setter '{0}' is '{1}' which isn't assignable to its getter (of type '{2}'), from superclass '{3}'.",
null,
false);
@@ -4093,7 +4344,7 @@ class StaticWarningCode extends ErrorCode {
static const StaticWarningCode MISSING_ENUM_CONSTANT_IN_SWITCH =
const StaticWarningCode(
'MISSING_ENUM_CONSTANT_IN_SWITCH',
- "Missing case clause for '{0}'",
+ "Missing case clause for '{0}'.",
"Add a case clause for the missing constant or add a default clause.",
false);
@@ -4104,7 +4355,7 @@ class StaticWarningCode extends ErrorCode {
*/
static const StaticWarningCode MIXED_RETURN_TYPES = const StaticWarningCode(
'MIXED_RETURN_TYPES',
- "Methods and functions cannot use return both with and without values",
+ "Methods and functions can't use return both with and without values.",
null,
false);
@@ -4114,7 +4365,7 @@ class StaticWarningCode extends ErrorCode {
*/
static const StaticWarningCode NEW_WITH_ABSTRACT_CLASS =
const StaticWarningCode('NEW_WITH_ABSTRACT_CLASS',
- "Abstract classes cannot be created with a 'new' expression");
+ "Abstract classes can't be created with a 'new' expression.");
/**
* 15.8 Parameterized Types: Any use of a malbounded type gives rise to a
@@ -4130,7 +4381,7 @@ class StaticWarningCode extends ErrorCode {
*/
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");
+ "The type '{0}' is declared with {1} type parameters, but {2} type arguments were given.");
/**
* 12.11.1 New: It is a static warning if <i>T</i> is not a class accessible
@@ -4140,7 +4391,7 @@ 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}' is not a class");
+ 'NEW_WITH_NON_TYPE', "The name '{0}' isn't a class.");
/**
* 12.11.1 New: If <i>T</i> is a class or parameterized type accessible in the
@@ -4156,8 +4407,11 @@ class StaticWarningCode extends ErrorCode {
* declare a constructor with the same name as the declaration of <i>T</i>.
*/
static const StaticWarningCode NEW_WITH_UNDEFINED_CONSTRUCTOR =
- const StaticWarningCode('NEW_WITH_UNDEFINED_CONSTRUCTOR',
- "The class '{0}' does not have a constructor '{1}'");
+ const StaticWarningCode(
+ 'NEW_WITH_UNDEFINED_CONSTRUCTOR',
+ "The class '{0}' doesn't have a constructor named '{1}'.",
+ "Try invoking a different constructor, or "
+ "define a constructor named '{1}'.");
/**
* 12.11.1 New: If <i>T</i> is a class or parameterized type accessible in the
@@ -4173,7 +4427,7 @@ class StaticWarningCode extends ErrorCode {
*/
static const StaticWarningCode NEW_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT =
const StaticWarningCode('NEW_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT',
- "The class '{0}' does not have a default constructor");
+ "The class '{0}' doesn't have a default constructor.");
/**
* 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract
@@ -4200,7 +4454,8 @@ class StaticWarningCode extends ErrorCode {
NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FIVE_PLUS =
const StaticWarningCode(
'NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FIVE_PLUS',
- "Missing concrete implementation of {0}, {1}, {2}, {3} and {4} more");
+ "Missing concrete implementations of {0}, {1}, {2}, {3} and {4} more.",
+ "Try implementing the missing methods, or make the class abstract.");
/**
* 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract
@@ -4226,7 +4481,8 @@ class StaticWarningCode extends ErrorCode {
NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FOUR =
const StaticWarningCode(
'NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FOUR',
- "Missing concrete implementation of {0}, {1}, {2} and {3}");
+ "Missing concrete implementations of {0}, {1}, {2} and {3}.",
+ "Try implementing the missing methods, or make the class abstract.");
/**
* 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract
@@ -4248,7 +4504,8 @@ class StaticWarningCode extends ErrorCode {
static const StaticWarningCode
NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE = const StaticWarningCode(
'NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE',
- "Missing concrete implementation of {0}");
+ "Missing concrete implementation of {0}.",
+ "Try implementing the missing method, or make the class abstract.");
/**
* 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract
@@ -4273,7 +4530,8 @@ class StaticWarningCode extends ErrorCode {
NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_THREE =
const StaticWarningCode(
'NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_THREE',
- "Missing concrete implementation of {0}, {1} and {2}");
+ "Missing concrete implementations of {0}, {1} and {2}.",
+ "Try implementing the missing methods, or make the class abstract.");
/**
* 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract
@@ -4296,7 +4554,8 @@ class StaticWarningCode extends ErrorCode {
static const StaticWarningCode
NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_TWO = const StaticWarningCode(
'NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_TWO',
- "Missing concrete implementation of {0} and {1}");
+ "Missing concrete implementations of {0} and {1}.",
+ "Try implementing the missing methods, or make the class abstract.");
/**
* 13.11 Try: An on-catch clause of the form <i>on T catch (p<sub>1</sub>,
@@ -4310,23 +4569,30 @@ class StaticWarningCode extends ErrorCode {
*/
static const StaticWarningCode NON_TYPE_IN_CATCH_CLAUSE =
const StaticWarningCode('NON_TYPE_IN_CATCH_CLAUSE',
- "The name '{0}' is not a type and cannot be used in an on-catch clause");
+ "The name '{0}' isn't a type and can't be used in an on-catch clause.");
/**
* 7.1.1 Operators: It is a static warning if the return type of the
* user-declared operator []= is explicitly declared and not void.
*/
static const StaticWarningCode NON_VOID_RETURN_FOR_OPERATOR =
- const StaticWarningCode('NON_VOID_RETURN_FOR_OPERATOR',
- "The return type of the operator []= must be 'void'", null, false);
+ const StaticWarningCode(
+ 'NON_VOID_RETURN_FOR_OPERATOR',
+ "The return type of the operator []= must be 'void'.",
+ "Try changing the return type to 'void'.",
+ false);
/**
* 7.3 Setters: It is a static warning if a setter declares a return type
* other than void.
*/
static const StaticWarningCode NON_VOID_RETURN_FOR_SETTER =
- const StaticWarningCode('NON_VOID_RETURN_FOR_SETTER',
- "The return type of the setter must be 'void'", null, false);
+ const StaticWarningCode(
+ 'NON_VOID_RETURN_FOR_SETTER',
+ "The return type of the setter must be 'void' or absent.",
+ "Try removing the return type, or "
+ "define a method rather than a setter.",
+ false);
/**
* 15.1 Static Types: A type <i>T</i> is malformed iff:
@@ -4344,7 +4610,7 @@ class StaticWarningCode extends ErrorCode {
* 0: the name that is not a type
*/
static const StaticWarningCode NOT_A_TYPE =
- const StaticWarningCode('NOT_A_TYPE', "{0} is not a type");
+ const StaticWarningCode('NOT_A_TYPE', "{0} isn't a type.");
/**
* 12.14.2 Binding Actuals to Formals: It is a static warning if <i>m &lt;
@@ -4357,8 +4623,10 @@ class StaticWarningCode extends ErrorCode {
* See [EXTRA_POSITIONAL_ARGUMENTS].
*/
static const StaticWarningCode NOT_ENOUGH_REQUIRED_ARGUMENTS =
- const StaticWarningCode('NOT_ENOUGH_REQUIRED_ARGUMENTS',
- "{0} required argument(s) expected, but {1} found");
+ const StaticWarningCode(
+ 'NOT_ENOUGH_REQUIRED_ARGUMENTS',
+ "{0} required argument(s) expected, but {1} found.",
+ "Try adding the additional required arguments.");
/**
* 14.3 Parts: It is a static warning if the referenced part declaration
@@ -4371,7 +4639,7 @@ class StaticWarningCode extends ErrorCode {
*/
static const StaticWarningCode PART_OF_DIFFERENT_LIBRARY =
const StaticWarningCode('PART_OF_DIFFERENT_LIBRARY',
- "Expected this library to be part of '{0}', not '{1}'");
+ "Expected this library to be part of '{0}', not '{1}'.");
/**
* 7.6.2 Factories: It is a static warning if the function type of <i>k'</i>
@@ -4383,7 +4651,7 @@ class StaticWarningCode extends ErrorCode {
*/
static const StaticWarningCode REDIRECT_TO_INVALID_FUNCTION_TYPE =
const StaticWarningCode('REDIRECT_TO_INVALID_FUNCTION_TYPE',
- "The redirected constructor '{0}' has incompatible parameters with '{1}'");
+ "The redirected constructor '{0}' has incompatible parameters with '{1}'.");
/**
* 7.6.2 Factories: It is a static warning if the function type of <i>k'</i>
@@ -4395,7 +4663,7 @@ class StaticWarningCode extends ErrorCode {
*/
static const StaticWarningCode REDIRECT_TO_INVALID_RETURN_TYPE =
const StaticWarningCode('REDIRECT_TO_INVALID_RETURN_TYPE',
- "The return type '{0}' of the redirected constructor is not assignable to '{1}'");
+ "The return type '{0}' of the redirected constructor isn't assignable to '{1}'.");
/**
* 7.6.2 Factories: It is a static warning if type does not denote a class
@@ -4405,7 +4673,7 @@ class StaticWarningCode extends ErrorCode {
*/
static const StaticWarningCode REDIRECT_TO_MISSING_CONSTRUCTOR =
const StaticWarningCode('REDIRECT_TO_MISSING_CONSTRUCTOR',
- "The constructor '{0}' could not be found in '{1}'");
+ "The constructor '{0}' couldn't be found in '{1}'.");
/**
* 7.6.2 Factories: It is a static warning if type does not denote a class
@@ -4415,7 +4683,7 @@ class StaticWarningCode extends ErrorCode {
*/
static const StaticWarningCode REDIRECT_TO_NON_CLASS = const StaticWarningCode(
'REDIRECT_TO_NON_CLASS',
- "The name '{0}' is not a type and cannot be used in a redirected constructor");
+ "The name '{0}' isn't a type and can't be used in a redirected constructor.");
/**
* 13.12 Return: Let <i>f</i> be the function immediately enclosing a return
@@ -4426,7 +4694,7 @@ class StaticWarningCode extends ErrorCode {
*/
static const StaticWarningCode RETURN_WITHOUT_VALUE = const StaticWarningCode(
'RETURN_WITHOUT_VALUE',
- "Missing return value after 'return'",
+ "Missing return value after 'return'.",
null,
false);
@@ -4439,7 +4707,7 @@ class StaticWarningCode extends ErrorCode {
*/
static const StaticWarningCode STATIC_ACCESS_TO_INSTANCE_MEMBER =
const StaticWarningCode('STATIC_ACCESS_TO_INSTANCE_MEMBER',
- "Instance member '{0}' cannot be accessed using static access");
+ "Instance member '{0}' can't be accessed using static access.");
/**
* 13.9 Switch: It is a static warning if the type of <i>e</i> may not be
@@ -4447,7 +4715,7 @@ class StaticWarningCode extends ErrorCode {
*/
static const StaticWarningCode SWITCH_EXPRESSION_NOT_ASSIGNABLE =
const StaticWarningCode('SWITCH_EXPRESSION_NOT_ASSIGNABLE',
- "Type '{0}' of the switch expression is not assignable to the type '{1}' of case expressions");
+ "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
@@ -4459,23 +4727,26 @@ class StaticWarningCode extends ErrorCode {
*/
static const StaticWarningCode TYPE_ANNOTATION_DEFERRED_CLASS =
const StaticWarningCode('TYPE_ANNOTATION_DEFERRED_CLASS',
- "The deferred type '{0}' cannot be used in a declaration, cast or type test");
+ "The deferred type '{0}' can't be used in a declaration, cast or type test.");
/**
* 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}' is not a type and cannot be used in an 'is' expression");
+ 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.");
/**
* 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_UNDEFINED_NAME =
- const StaticWarningCode('TYPE_TEST_WITH_UNDEFINED_NAME',
- "The name '{0}' is not defined and cannot be used in an 'is' expression");
+ const StaticWarningCode(
+ 'TYPE_TEST_WITH_UNDEFINED_NAME',
+ "The name '{0}' isn't defined, so it can't be used in an 'is' expression.",
+ "Try changing the name to the name of an existing type, or "
+ "creating a type with the name '{0}'.");
/**
* 10 Generics: However, a type parameter is considered to be a malformed type
@@ -4486,8 +4757,11 @@ class StaticWarningCode extends ErrorCode {
* checker and the runtime.
*/
static const StaticWarningCode TYPE_PARAMETER_REFERENCED_BY_STATIC =
- const StaticWarningCode('TYPE_PARAMETER_REFERENCED_BY_STATIC',
- "Static members cannot reference type parameters of the class");
+ const StaticWarningCode(
+ 'TYPE_PARAMETER_REFERENCED_BY_STATIC',
+ "Static members can't reference type parameters of the class.",
+ "Try removing the reference to the type parameter, or "
+ "making the member an instance member.");
/**
* 12.16.3 Static Invocation: A static method invocation <i>i</i> has the form
@@ -4498,15 +4772,18 @@ class StaticWarningCode extends ErrorCode {
* Parameters:
* 0: the name of the undefined class
*/
- static const StaticWarningCode UNDEFINED_CLASS =
- const StaticWarningCode('UNDEFINED_CLASS', "Undefined class '{0}'");
+ static const StaticWarningCode UNDEFINED_CLASS = const StaticWarningCode(
+ 'UNDEFINED_CLASS',
+ "Undefined class '{0}'.",
+ "Try changing the name to the name of an existing class, or "
+ "creating a class with the name '{0}'.");
/**
* Same as [UNDEFINED_CLASS], but to catch using "boolean" instead of "bool".
*/
static const StaticWarningCode UNDEFINED_CLASS_BOOLEAN =
const StaticWarningCode('UNDEFINED_CLASS_BOOLEAN',
- "Undefined class 'boolean'; did you mean 'bool'?");
+ "Undefined class 'boolean'.", "Try using the type 'bool'.");
/**
* 12.17 Getter Invocation: It is a static warning if there is no class
@@ -4519,8 +4796,8 @@ class StaticWarningCode extends ErrorCode {
*/
static const StaticWarningCode UNDEFINED_GETTER = const StaticWarningCode(
'UNDEFINED_GETTER',
- "The getter '{0}' is not defined for the class '{1}'.",
- null);
+ "The getter '{0}' isn't defined for the class '{1}'.",
+ "Try defining a getter or field named '{0}', or invoke a different getter.");
/**
* 12.30 Identifier Reference: It is as static warning if an identifier
@@ -4532,15 +4809,22 @@ class StaticWarningCode extends ErrorCode {
* Parameters:
* 0: the name of the identifier
*/
- static const StaticWarningCode UNDEFINED_IDENTIFIER =
- const StaticWarningCode('UNDEFINED_IDENTIFIER', "Undefined name '{0}'");
+ static const StaticWarningCode UNDEFINED_IDENTIFIER = const StaticWarningCode(
+ 'UNDEFINED_IDENTIFIER',
+ "Undefined name '{0}'.",
+ "Try correcting the name to one that is defined, or "
+ "defining the name.");
/**
* If the identifier is 'await', be helpful about it.
*/
static const StaticWarningCode UNDEFINED_IDENTIFIER_AWAIT =
- const StaticWarningCode('UNDEFINED_IDENTIFIER_AWAIT',
- "Undefined name 'await'; did you mean to add the 'async' marker to '{0}'?");
+ const StaticWarningCode(
+ 'UNDEFINED_IDENTIFIER_AWAIT',
+ "Undefined name 'await'.",
+ "Try correcting the name to one that is defined, "
+ "defining the name, or "
+ "adding 'async' to the enclosing function body.");
/**
* 12.14.2 Binding Actuals to Formals: Furthermore, each <i>q<sub>i</sub></i>,
@@ -4553,7 +4837,7 @@ class StaticWarningCode extends ErrorCode {
*/
static const StaticWarningCode UNDEFINED_NAMED_PARAMETER =
const StaticWarningCode('UNDEFINED_NAMED_PARAMETER',
- "The named parameter '{0}' is not defined");
+ "The named parameter '{0}' isn't defined.");
/**
* 12.18 Assignment: It is as static warning if an assignment of the form
@@ -4572,8 +4856,8 @@ class StaticWarningCode extends ErrorCode {
*/
static const StaticWarningCode UNDEFINED_SETTER = const StaticWarningCode(
'UNDEFINED_SETTER',
- "The setter '{0}' is not defined for the class '{1}'.",
- null);
+ "The setter '{0}' isn't defined for the class '{1}'.",
+ "Try defining a setter or field named '{0}', or invoke a different setter.");
/**
* 12.16.3 Static Invocation: It is a static warning if <i>C</i> does not
@@ -4585,7 +4869,7 @@ class StaticWarningCode extends ErrorCode {
*/
static const StaticWarningCode UNDEFINED_STATIC_METHOD_OR_GETTER =
const StaticWarningCode('UNDEFINED_STATIC_METHOD_OR_GETTER',
- "The static method, getter or setter '{0}' is not defined for the class '{1}'");
+ "The static method, getter or setter '{0}' isn't defined for the class '{1}'.");
/**
* 12.17 Getter Invocation: It is a static warning if there is no class
@@ -4598,7 +4882,7 @@ class StaticWarningCode extends ErrorCode {
*/
static const StaticWarningCode UNDEFINED_SUPER_GETTER =
const StaticWarningCode('UNDEFINED_SUPER_GETTER',
- "The getter '{0}' is not defined in a superclass of '{1}'.", null);
+ "The getter '{0}' isn't defined in a superclass of '{1}'.");
/**
* 12.18 Assignment: It is as static warning if an assignment of the form
@@ -4617,14 +4901,17 @@ class StaticWarningCode extends ErrorCode {
*/
static const StaticWarningCode UNDEFINED_SUPER_SETTER =
const StaticWarningCode('UNDEFINED_SUPER_SETTER',
- "The setter '{0}' is not defined in a superclass of '{1}'.", null);
+ "The setter '{0}' isn't defined in a superclass of '{1}'.");
/**
* 7.2 Getters: It is a static warning if the return type of a getter is void.
*/
static const StaticWarningCode VOID_RETURN_FOR_GETTER =
- const StaticWarningCode('VOID_RETURN_FOR_GETTER',
- "The return type of the getter must not be 'void'", null, false);
+ const StaticWarningCode(
+ 'VOID_RETURN_FOR_GETTER',
+ "The return type of a getter can't be 'void'.",
+ "Try providing a return type for the getter.",
+ false);
/**
* A flag indicating whether this warning is an error when running with strong
@@ -4659,19 +4946,13 @@ class StaticWarningCode extends ErrorCode {
*/
class StrongModeCode extends ErrorCode {
static const String _implicitCastMessage =
- 'Unsound implicit cast from {0} to {1}';
+ "Unsound implicit cast from '{0}' to '{1}'.";
- static const String _unsafeBlockClosureInferenceMessage =
- 'Unsafe use of block closure in a type-inferred variable outside a '
- 'function body. Workaround: add a type annotation for `{0}`. See '
- 'dartbug.com/26947';
-
- static const String _typeCheckMessage =
- 'Type check failed: {0} is not of type {1}';
+ static const String _implicitCastCorrection =
+ "Try adding an explicit cast to '{1}'.";
static const String _invalidOverrideMessage =
- 'The type of {0}.{1} ({2}) is not a '
- 'subtype of {3}.{1} ({4}).';
+ "The type of '{0}.{1}' ('{2}') isn't a subtype of '{3}.{1}' ('{4}').";
/**
* This is appended to the end of an error message about implicit dynamic.
@@ -4680,35 +4961,52 @@ class StrongModeCode extends ErrorCode {
* result of turning on a particular option, and they are free to turn it
* back off.
*/
- static const String _implicitDynamicTip =
- ". Either add an explicit type like 'dynamic'"
- ", or enable implicit-dynamic in your Analyzer options.";
+ static const String _implicitDynamicCorrection =
+ "Try adding an explicit type like 'dynamic', or "
+ "enable implicit-dynamic in your analysis options file.";
- static const String _inferredTypeMessage = '{0} has inferred type {1}';
+ static const String _inferredTypeMessage = "'{0}' has inferred type '{1}'.";
static const StrongModeCode DOWN_CAST_COMPOSITE = const StrongModeCode(
- ErrorType.STATIC_WARNING, 'DOWN_CAST_COMPOSITE', _implicitCastMessage);
+ ErrorType.STATIC_WARNING,
+ 'DOWN_CAST_COMPOSITE',
+ _implicitCastMessage,
+ _implicitCastCorrection);
static const StrongModeCode DOWN_CAST_IMPLICIT = const StrongModeCode(
- ErrorType.HINT, 'DOWN_CAST_IMPLICIT', _implicitCastMessage);
+ ErrorType.HINT,
+ 'DOWN_CAST_IMPLICIT',
+ _implicitCastMessage,
+ _implicitCastCorrection);
static const StrongModeCode DOWN_CAST_IMPLICIT_ASSIGN = const StrongModeCode(
- ErrorType.HINT, 'DOWN_CAST_IMPLICIT_ASSIGN', _implicitCastMessage);
+ ErrorType.HINT,
+ 'DOWN_CAST_IMPLICIT_ASSIGN',
+ _implicitCastMessage,
+ _implicitCastCorrection);
static const StrongModeCode DYNAMIC_CAST = const StrongModeCode(
- ErrorType.HINT, 'DYNAMIC_CAST', _implicitCastMessage);
+ ErrorType.HINT,
+ 'DYNAMIC_CAST',
+ _implicitCastMessage,
+ _implicitCastCorrection);
static const StrongModeCode ASSIGNMENT_CAST = const StrongModeCode(
- ErrorType.HINT, 'ASSIGNMENT_CAST', _implicitCastMessage);
+ ErrorType.HINT,
+ 'ASSIGNMENT_CAST',
+ _implicitCastMessage,
+ _implicitCastCorrection);
static const StrongModeCode INVALID_PARAMETER_DECLARATION =
- const StrongModeCode(ErrorType.COMPILE_TIME_ERROR,
- 'INVALID_PARAMETER_DECLARATION', _typeCheckMessage);
+ const StrongModeCode(
+ ErrorType.COMPILE_TIME_ERROR,
+ 'INVALID_PARAMETER_DECLARATION',
+ "Type check failed: '{0}' isn't of type '{1}'.");
static const StrongModeCode COULD_NOT_INFER = const StrongModeCode(
ErrorType.COMPILE_TIME_ERROR,
'COULD_NOT_INFER',
- "Could not infer type parameter {0}, {1} must be of type {2}.");
+ "Couldn't infer type parameter '{0}'; '{1}' must be of type '{2}'.");
static const StrongModeCode INFERRED_TYPE = const StrongModeCode(
ErrorType.HINT, 'INFERRED_TYPE', _inferredTypeMessage);
@@ -4725,107 +5023,111 @@ class StrongModeCode extends ErrorCode {
static const StrongModeCode STATIC_TYPE_ERROR = const StrongModeCode(
ErrorType.COMPILE_TIME_ERROR,
'STATIC_TYPE_ERROR',
- 'Type check failed: {0} ({1}) is not 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,
'INVALID_SUPER_INVOCATION',
"super call must be last in an initializer "
- "list (see https://goo.gl/EY6hDP): {0}");
+ "list (see https://goo.gl/EY6hDP): '{0}'.");
static const StrongModeCode NON_GROUND_TYPE_CHECK_INFO = const StrongModeCode(
ErrorType.HINT,
'NON_GROUND_TYPE_CHECK_INFO',
- "Runtime check on non-ground type {0} may throw StrongModeError");
+ "Runtime check on non-ground type '{0}' may throw StrongModeError.");
static const StrongModeCode DYNAMIC_INVOKE = const StrongModeCode(
- ErrorType.HINT, 'DYNAMIC_INVOKE', '{0} requires a dynamic invoke');
+ ErrorType.HINT, 'DYNAMIC_INVOKE', "'{0}' requires a dynamic invoke.");
static const StrongModeCode INVALID_METHOD_OVERRIDE = const StrongModeCode(
ErrorType.COMPILE_TIME_ERROR,
'INVALID_METHOD_OVERRIDE',
- 'Invalid override. $_invalidOverrideMessage');
+ "Invalid override. $_invalidOverrideMessage");
static const StrongModeCode INVALID_METHOD_OVERRIDE_FROM_BASE =
const StrongModeCode(
ErrorType.COMPILE_TIME_ERROR,
'INVALID_METHOD_OVERRIDE_FROM_BASE',
- 'Base class introduces an invalid override. '
- '$_invalidOverrideMessage');
+ "Base class introduces an invalid override. $_invalidOverrideMessage");
static const StrongModeCode INVALID_METHOD_OVERRIDE_FROM_MIXIN =
const StrongModeCode(
ErrorType.COMPILE_TIME_ERROR,
'INVALID_METHOD_OVERRIDE_FROM_MIXIN',
- 'Mixin introduces an invalid override. $_invalidOverrideMessage');
+ "Mixin introduces an invalid override. $_invalidOverrideMessage");
static const StrongModeCode INVALID_FIELD_OVERRIDE = const StrongModeCode(
ErrorType.COMPILE_TIME_ERROR,
'INVALID_FIELD_OVERRIDE',
- 'Field declaration {3}.{1} cannot be '
- 'overridden in {0}.');
+ "Field declaration '{3}.{1}' can't be overridden in '{0}'.");
static const StrongModeCode IMPLICIT_DYNAMIC_PARAMETER = const StrongModeCode(
ErrorType.COMPILE_TIME_ERROR,
'IMPLICIT_DYNAMIC_PARAMETER',
- "Missing parameter type for '{0}'$_implicitDynamicTip");
+ "Missing parameter type for '{0}'.",
+ _implicitDynamicCorrection);
static const StrongModeCode IMPLICIT_DYNAMIC_RETURN = const StrongModeCode(
ErrorType.COMPILE_TIME_ERROR,
'IMPLICIT_DYNAMIC_RETURN',
- "Missing return type for '{0}'$_implicitDynamicTip");
+ "Missing return type for '{0}'.",
+ _implicitDynamicCorrection);
static const StrongModeCode IMPLICIT_DYNAMIC_VARIABLE = const StrongModeCode(
ErrorType.COMPILE_TIME_ERROR,
'IMPLICIT_DYNAMIC_VARIABLE',
- "Missing variable type for '{0}'$_implicitDynamicTip");
+ "Missing variable type for '{0}'.",
+ _implicitDynamicCorrection);
static const StrongModeCode IMPLICIT_DYNAMIC_FIELD = const StrongModeCode(
ErrorType.COMPILE_TIME_ERROR,
'IMPLICIT_DYNAMIC_FIELD',
- "Missing field type for '{0}'$_implicitDynamicTip");
+ "Missing field type for '{0}'.",
+ _implicitDynamicCorrection);
static const StrongModeCode IMPLICIT_DYNAMIC_TYPE = const StrongModeCode(
ErrorType.COMPILE_TIME_ERROR,
'IMPLICIT_DYNAMIC_TYPE',
- "Missing type arguments for generic type '{0}'"
- "$_implicitDynamicTip");
+ "Missing type arguments for generic type '{0}'.",
+ _implicitDynamicCorrection);
static const StrongModeCode IMPLICIT_DYNAMIC_LIST_LITERAL =
const StrongModeCode(
ErrorType.COMPILE_TIME_ERROR,
'IMPLICIT_DYNAMIC_LIST_LITERAL',
- "Missing type argument for list literal$_implicitDynamicTip");
+ "Missing type argument for list literal.",
+ _implicitDynamicCorrection);
static const StrongModeCode IMPLICIT_DYNAMIC_MAP_LITERAL =
const StrongModeCode(
ErrorType.COMPILE_TIME_ERROR,
'IMPLICIT_DYNAMIC_MAP_LITERAL',
- 'Missing type arguments for map literal$_implicitDynamicTip');
+ "Missing type arguments for map literal.",
+ _implicitDynamicCorrection);
static const StrongModeCode IMPLICIT_DYNAMIC_FUNCTION = const StrongModeCode(
ErrorType.COMPILE_TIME_ERROR,
'IMPLICIT_DYNAMIC_FUNCTION',
- "Missing type arguments for generic function '{0}<{1}>'"
- "$_implicitDynamicTip");
+ "Missing type arguments for generic function '{0}<{1}>'.",
+ _implicitDynamicCorrection);
static const StrongModeCode IMPLICIT_DYNAMIC_METHOD = const StrongModeCode(
ErrorType.COMPILE_TIME_ERROR,
'IMPLICIT_DYNAMIC_METHOD',
- "Missing type arguments for generic method '{0}<{1}>'"
- "$_implicitDynamicTip");
+ "Missing type arguments for generic method '{0}<{1}>'.",
+ _implicitDynamicCorrection);
static const StrongModeCode IMPLICIT_DYNAMIC_INVOKE = const StrongModeCode(
ErrorType.COMPILE_TIME_ERROR,
'IMPLICIT_DYNAMIC_INVOKE',
- "Missing type arguments for calling generic function type '{0}'"
- "$_implicitDynamicTip");
-
- static const StrongModeCode UNSAFE_BLOCK_CLOSURE_INFERENCE =
- const StrongModeCode(
- ErrorType.STATIC_WARNING,
- 'UNSAFE_BLOCK_CLOSURE_INFERENCE',
- _unsafeBlockClosureInferenceMessage);
+ "Missing type arguments for calling generic function type '{0}'.",
+ _implicitDynamicCorrection);
+
+ static const StrongModeCode UNSAFE_BLOCK_CLOSURE_INFERENCE = const StrongModeCode(
+ ErrorType.STATIC_WARNING,
+ 'UNSAFE_BLOCK_CLOSURE_INFERENCE',
+ "Unsafe use of a block closure in a type-inferred variable outside a function body.",
+ "Try adding a type annotation for '{0}'. See dartbug.com/26947.");
@override
final ErrorType type;
« 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