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

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

Issue 644283002: Type check field assignments during constant evaluation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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/generated/error.dart
diff --git a/pkg/analyzer/lib/src/generated/error.dart b/pkg/analyzer/lib/src/generated/error.dart
index 321b9d19f03b8aebad76c74bf6fbbec64ac9148d..5fb234de1eb8476b8daf6c9fe8a2ff15677731fe 100644
--- a/pkg/analyzer/lib/src/generated/error.dart
+++ b/pkg/analyzer/lib/src/generated/error.dart
@@ -402,10 +402,20 @@ class CheckedModeCompileTimeErrorCode extends Enum<CheckedModeCompileTimeErrorCo
* 12.11.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.con1(
+ 'CONST_CONSTRUCTOR_FIELD_TYPE_MISMATCH',
+ 0,
+ "The object type '{0}' cannot 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 object results in an
+ * uncaught exception being thrown.
+ */
static const CheckedModeCompileTimeErrorCode CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH =
const CheckedModeCompileTimeErrorCode.con1(
'CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH',
- 0,
+ 1,
"The object type '{0}' cannot be assigned to a parameter of type '{1}'");
/**
@@ -419,7 +429,7 @@ class CheckedModeCompileTimeErrorCode extends Enum<CheckedModeCompileTimeErrorCo
* @param initializerType the name of the type of the initializer expression
* @param fieldType the name of the type of the field
*/
- static const CheckedModeCompileTimeErrorCode CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE = const CheckedModeCompileTimeErrorCode.con1('CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE', 1, "The initializer type '{0}' cannot be assigned to the field type '{1}'");
+ static const CheckedModeCompileTimeErrorCode CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE = const CheckedModeCompileTimeErrorCode.con1('CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE', 2, "The initializer type '{0}' cannot 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> ...
@@ -433,7 +443,7 @@ class CheckedModeCompileTimeErrorCode extends Enum<CheckedModeCompileTimeErrorCo
* It is a static warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<sub>j</sub>, 1 &lt;=
* j &lt;= m</i>.
*/
- static const CheckedModeCompileTimeErrorCode LIST_ELEMENT_TYPE_NOT_ASSIGNABLE = const CheckedModeCompileTimeErrorCode.con1('LIST_ELEMENT_TYPE_NOT_ASSIGNABLE', 2, "The element type '{0}' cannot be assigned to the list type '{1}'");
+ static const CheckedModeCompileTimeErrorCode LIST_ELEMENT_TYPE_NOT_ASSIGNABLE = const CheckedModeCompileTimeErrorCode.con1('LIST_ELEMENT_TYPE_NOT_ASSIGNABLE', 3, "The element type '{0}' cannot be assigned to the list type '{1}'");
/**
* 12.7 Map: A run-time map literal &lt;<i>K</i>, <i>V</i>&gt; [<i>k<sub>1</sub></i> :
@@ -447,7 +457,7 @@ class CheckedModeCompileTimeErrorCode extends Enum<CheckedModeCompileTimeErrorCo
* It is a static warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<sub>j</sub>, 1 &lt;=
* j &lt;= m</i>.
*/
- static const CheckedModeCompileTimeErrorCode MAP_KEY_TYPE_NOT_ASSIGNABLE = const CheckedModeCompileTimeErrorCode.con1('MAP_KEY_TYPE_NOT_ASSIGNABLE', 3, "The element type '{0}' cannot be assigned to the map key type '{1}'");
+ static const CheckedModeCompileTimeErrorCode MAP_KEY_TYPE_NOT_ASSIGNABLE = const CheckedModeCompileTimeErrorCode.con1('MAP_KEY_TYPE_NOT_ASSIGNABLE', 4, "The element type '{0}' cannot be assigned to the map key type '{1}'");
/**
* 12.7 Map: A run-time map literal &lt;<i>K</i>, <i>V</i>&gt; [<i>k<sub>1</sub></i> :
@@ -461,7 +471,7 @@ class CheckedModeCompileTimeErrorCode extends Enum<CheckedModeCompileTimeErrorCo
* It is a static warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<sub>j</sub>, 1 &lt;=
* j &lt;= m</i>.
*/
- static const CheckedModeCompileTimeErrorCode MAP_VALUE_TYPE_NOT_ASSIGNABLE = const CheckedModeCompileTimeErrorCode.con1('MAP_VALUE_TYPE_NOT_ASSIGNABLE', 4, "The element type '{0}' cannot be assigned to the map value type '{1}'");
+ static const CheckedModeCompileTimeErrorCode MAP_VALUE_TYPE_NOT_ASSIGNABLE = const CheckedModeCompileTimeErrorCode.con1('MAP_VALUE_TYPE_NOT_ASSIGNABLE', 5, "The element type '{0}' cannot be assigned to the map value type '{1}'");
/**
* 12.11.2 Const: It is a compile-time error if evaluation of a constant object results in an
@@ -470,10 +480,11 @@ class CheckedModeCompileTimeErrorCode extends Enum<CheckedModeCompileTimeErrorCo
static const CheckedModeCompileTimeErrorCode VARIABLE_TYPE_MISMATCH =
const CheckedModeCompileTimeErrorCode.con1(
'VARIABLE_TYPE_MISMATCH',
- 5,
+ 6,
"The object type '{0}' cannot be assigned to a variable of type '{1}'");
static const List<CheckedModeCompileTimeErrorCode> values = const [
+ CONST_CONSTRUCTOR_FIELD_TYPE_MISMATCH,
CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH,
CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE,
LIST_ELEMENT_TYPE_NOT_ASSIGNABLE,

Powered by Google App Engine
This is Rietveld 408576698