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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library engine.error; 8 library engine.error;
9 9
10 import 'dart:collection'; 10 import 'dart:collection';
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 // clear to the user that the error is coming from constant evaluation (and 395 // clear to the user that the error is coming from constant evaluation (and
396 // hence the constant needs to be a subtype of the annotated type) as opposed 396 // hence the constant needs to be a subtype of the annotated type) as opposed
397 // to static type analysis (which only requires that the two types be 397 // to static type analysis (which only requires that the two types be
398 // assignable). Also consider populating the "correction" field for these 398 // assignable). Also consider populating the "correction" field for these
399 // errors. 399 // errors.
400 400
401 /** 401 /**
402 * 12.11.2 Const: It is a compile-time error if evaluation of a constant objec t results in an 402 * 12.11.2 Const: It is a compile-time error if evaluation of a constant objec t results in an
403 * uncaught exception being thrown. 403 * uncaught exception being thrown.
404 */ 404 */
405 static const CheckedModeCompileTimeErrorCode CONST_CONSTRUCTOR_FIELD_TYPE_MISM ATCH =
406 const CheckedModeCompileTimeErrorCode.con1(
407 'CONST_CONSTRUCTOR_FIELD_TYPE_MISMATCH',
408 0,
409 "The object type '{0}' cannot be assigned to the field '{1}', which ha s type '{2}'");
410
411 /**
412 * 12.11.2 Const: It is a compile-time error if evaluation of a constant objec t results in an
413 * uncaught exception being thrown.
414 */
405 static const CheckedModeCompileTimeErrorCode CONST_CONSTRUCTOR_PARAM_TYPE_MISM ATCH = 415 static const CheckedModeCompileTimeErrorCode CONST_CONSTRUCTOR_PARAM_TYPE_MISM ATCH =
406 const CheckedModeCompileTimeErrorCode.con1( 416 const CheckedModeCompileTimeErrorCode.con1(
407 'CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH', 417 'CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH',
408 0, 418 1,
409 "The object type '{0}' cannot be assigned to a parameter of type '{1}' "); 419 "The object type '{0}' cannot be assigned to a parameter of type '{1}' ");
410 420
411 /** 421 /**
412 * 7.6.1 Generative Constructors: In checked mode, it is a dynamic type error if o is not 422 * 7.6.1 Generative Constructors: In checked mode, it is a dynamic type error if o is not
413 * <b>null</b> and the interface of the class of <i>o</i> is not a subtype of the static type of 423 * <b>null</b> and the interface of the class of <i>o</i> is not a subtype of the static type of
414 * the field <i>v</i>. 424 * the field <i>v</i>.
415 * 425 *
416 * 12.11.2 Const: It is a compile-time error if evaluation of a constant objec t results in an 426 * 12.11.2 Const: It is a compile-time error if evaluation of a constant objec t results in an
417 * uncaught exception being thrown. 427 * uncaught exception being thrown.
418 * 428 *
419 * @param initializerType the name of the type of the initializer expression 429 * @param initializerType the name of the type of the initializer expression
420 * @param fieldType the name of the type of the field 430 * @param fieldType the name of the type of the field
421 */ 431 */
422 static const CheckedModeCompileTimeErrorCode CONST_FIELD_INITIALIZER_NOT_ASSIG NABLE = const CheckedModeCompileTimeErrorCode.con1('CONST_FIELD_INITIALIZER_NOT_ ASSIGNABLE', 1, "The initializer type '{0}' cannot be assigned to the field type '{1}'"); 432 static const CheckedModeCompileTimeErrorCode CONST_FIELD_INITIALIZER_NOT_ASSIG NABLE = const CheckedModeCompileTimeErrorCode.con1('CONST_FIELD_INITIALIZER_NOT_ ASSIGNABLE', 2, "The initializer type '{0}' cannot be assigned to the field type '{1}'");
423 433
424 /** 434 /**
425 * 12.6 Lists: A run-time list literal &lt;<i>E</i>&gt; [<i>e<sub>1</sub></i> ... 435 * 12.6 Lists: A run-time list literal &lt;<i>E</i>&gt; [<i>e<sub>1</sub></i> ...
426 * <i>e<sub>n</sub></i>] is evaluated as follows: 436 * <i>e<sub>n</sub></i>] is evaluated as follows:
427 * * The operator []= is invoked on <i>a</i> with first argument <i>i</i> and second argument 437 * * The operator []= is invoked on <i>a</i> with first argument <i>i</i> and second argument
428 * <i>o<sub>i+1</sub></i><i>, 1 &lt;= i &lt;= n</i> 438 * <i>o<sub>i+1</sub></i><i>, 1 &lt;= i &lt;= n</i>
429 * 439 *
430 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static type of 440 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static type of
431 * <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of <i>p<sub>i</s ub>, 1 &lt;= i &lt;= 441 * <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of <i>p<sub>i</s ub>, 1 &lt;= i &lt;=
432 * n+k</i> and let <i>S<sub>q</sub></i> be the type of the named parameter <i> q</i> of <i>f</i>. 442 * n+k</i> and let <i>S<sub>q</sub></i> be the type of the named parameter <i> q</i> of <i>f</i>.
433 * It is a static warning if <i>T<sub>j</sub></i> may not be assigned to <i>S< sub>j</sub>, 1 &lt;= 443 * It is a static warning if <i>T<sub>j</sub></i> may not be assigned to <i>S< sub>j</sub>, 1 &lt;=
434 * j &lt;= m</i>. 444 * j &lt;= m</i>.
435 */ 445 */
436 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}'"); 446 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}'");
437 447
438 /** 448 /**
439 * 12.7 Map: A run-time map literal &lt;<i>K</i>, <i>V</i>&gt; [<i>k<sub>1</su b></i> : 449 * 12.7 Map: A run-time map literal &lt;<i>K</i>, <i>V</i>&gt; [<i>k<sub>1</su b></i> :
440 * <i>e<sub>1</sub></i> ... <i>k<sub>n</sub></i> : <i>e<sub>n</sub></i>] is ev aluated as follows: 450 * <i>e<sub>1</sub></i> ... <i>k<sub>n</sub></i> : <i>e<sub>n</sub></i>] is ev aluated as follows:
441 * * The operator []= is invoked on <i>m</i> with first argument <i>k<sub>i</s ub></i> and second 451 * * The operator []= is invoked on <i>m</i> with first argument <i>k<sub>i</s ub></i> and second
442 * argument <i>e<sub>i</sub></i><i>, 1 &lt;= i &lt;= n</i> 452 * argument <i>e<sub>i</sub></i><i>, 1 &lt;= i &lt;= n</i>
443 * 453 *
444 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static type of 454 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static type of
445 * <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of <i>p<sub>i</s ub>, 1 &lt;= i &lt;= 455 * <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of <i>p<sub>i</s ub>, 1 &lt;= i &lt;=
446 * n+k</i> and let <i>S<sub>q</sub></i> be the type of the named parameter <i> q</i> of <i>f</i>. 456 * n+k</i> and let <i>S<sub>q</sub></i> be the type of the named parameter <i> q</i> of <i>f</i>.
447 * It is a static warning if <i>T<sub>j</sub></i> may not be assigned to <i>S< sub>j</sub>, 1 &lt;= 457 * It is a static warning if <i>T<sub>j</sub></i> may not be assigned to <i>S< sub>j</sub>, 1 &lt;=
448 * j &lt;= m</i>. 458 * j &lt;= m</i>.
449 */ 459 */
450 static const CheckedModeCompileTimeErrorCode MAP_KEY_TYPE_NOT_ASSIGNABLE = con st CheckedModeCompileTimeErrorCode.con1('MAP_KEY_TYPE_NOT_ASSIGNABLE', 3, "The e lement type '{0}' cannot be assigned to the map key type '{1}'"); 460 static const CheckedModeCompileTimeErrorCode MAP_KEY_TYPE_NOT_ASSIGNABLE = con st CheckedModeCompileTimeErrorCode.con1('MAP_KEY_TYPE_NOT_ASSIGNABLE', 4, "The e lement type '{0}' cannot be assigned to the map key type '{1}'");
451 461
452 /** 462 /**
453 * 12.7 Map: A run-time map literal &lt;<i>K</i>, <i>V</i>&gt; [<i>k<sub>1</su b></i> : 463 * 12.7 Map: A run-time map literal &lt;<i>K</i>, <i>V</i>&gt; [<i>k<sub>1</su b></i> :
454 * <i>e<sub>1</sub></i> ... <i>k<sub>n</sub></i> : <i>e<sub>n</sub></i>] is ev aluated as follows: 464 * <i>e<sub>1</sub></i> ... <i>k<sub>n</sub></i> : <i>e<sub>n</sub></i>] is ev aluated as follows:
455 * * The operator []= is invoked on <i>m</i> with first argument <i>k<sub>i</s ub></i> and second 465 * * The operator []= is invoked on <i>m</i> with first argument <i>k<sub>i</s ub></i> and second
456 * argument <i>e<sub>i</sub></i><i>, 1 &lt;= i &lt;= n</i> 466 * argument <i>e<sub>i</sub></i><i>, 1 &lt;= i &lt;= n</i>
457 * 467 *
458 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static type of 468 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static type of
459 * <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of <i>p<sub>i</s ub>, 1 &lt;= i &lt;= 469 * <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of <i>p<sub>i</s ub>, 1 &lt;= i &lt;=
460 * n+k</i> and let <i>S<sub>q</sub></i> be the type of the named parameter <i> q</i> of <i>f</i>. 470 * n+k</i> and let <i>S<sub>q</sub></i> be the type of the named parameter <i> q</i> of <i>f</i>.
461 * It is a static warning if <i>T<sub>j</sub></i> may not be assigned to <i>S< sub>j</sub>, 1 &lt;= 471 * It is a static warning if <i>T<sub>j</sub></i> may not be assigned to <i>S< sub>j</sub>, 1 &lt;=
462 * j &lt;= m</i>. 472 * j &lt;= m</i>.
463 */ 473 */
464 static const CheckedModeCompileTimeErrorCode MAP_VALUE_TYPE_NOT_ASSIGNABLE = c onst CheckedModeCompileTimeErrorCode.con1('MAP_VALUE_TYPE_NOT_ASSIGNABLE', 4, "T he element type '{0}' cannot be assigned to the map value type '{1}'"); 474 static const CheckedModeCompileTimeErrorCode MAP_VALUE_TYPE_NOT_ASSIGNABLE = c onst CheckedModeCompileTimeErrorCode.con1('MAP_VALUE_TYPE_NOT_ASSIGNABLE', 5, "T he element type '{0}' cannot be assigned to the map value type '{1}'");
465 475
466 /** 476 /**
467 * 12.11.2 Const: It is a compile-time error if evaluation of a constant objec t results in an 477 * 12.11.2 Const: It is a compile-time error if evaluation of a constant objec t results in an
468 * uncaught exception being thrown. 478 * uncaught exception being thrown.
469 */ 479 */
470 static const CheckedModeCompileTimeErrorCode VARIABLE_TYPE_MISMATCH = 480 static const CheckedModeCompileTimeErrorCode VARIABLE_TYPE_MISMATCH =
471 const CheckedModeCompileTimeErrorCode.con1( 481 const CheckedModeCompileTimeErrorCode.con1(
472 'VARIABLE_TYPE_MISMATCH', 482 'VARIABLE_TYPE_MISMATCH',
473 5, 483 6,
474 "The object type '{0}' cannot be assigned to a variable of type '{1}'" ); 484 "The object type '{0}' cannot be assigned to a variable of type '{1}'" );
475 485
476 static const List<CheckedModeCompileTimeErrorCode> values = const [ 486 static const List<CheckedModeCompileTimeErrorCode> values = const [
487 CONST_CONSTRUCTOR_FIELD_TYPE_MISMATCH,
477 CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH, 488 CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH,
478 CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE, 489 CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE,
479 LIST_ELEMENT_TYPE_NOT_ASSIGNABLE, 490 LIST_ELEMENT_TYPE_NOT_ASSIGNABLE,
480 MAP_KEY_TYPE_NOT_ASSIGNABLE, 491 MAP_KEY_TYPE_NOT_ASSIGNABLE,
481 MAP_VALUE_TYPE_NOT_ASSIGNABLE, 492 MAP_VALUE_TYPE_NOT_ASSIGNABLE,
482 VARIABLE_TYPE_MISMATCH]; 493 VARIABLE_TYPE_MISMATCH];
483 494
484 /** 495 /**
485 * The template used to create the message to be displayed for this error. 496 * The template used to create the message to be displayed for this error.
486 */ 497 */
(...skipping 3714 matching lines...) Expand 10 before | Expand all | Expand 10 after
4201 4212
4202 @override 4213 @override
4203 String get message => "{0}"; 4214 String get message => "{0}";
4204 4215
4205 @override 4216 @override
4206 ErrorType get type => ErrorType.TODO; 4217 ErrorType get type => ErrorType.TODO;
4207 4218
4208 @override 4219 @override
4209 String get uniqueName => "${runtimeType.toString()}.${name}"; 4220 String get uniqueName => "${runtimeType.toString()}.${name}";
4210 } 4221 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698