OLD | NEW |
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 library engine.error; | 5 library engine.error; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 | 8 |
9 import 'ast.dart' show AstNode; | 9 import 'ast.dart' show AstNode; |
10 import 'element.dart'; | 10 import 'element.dart'; |
(...skipping 10 matching lines...) Expand all Loading... |
21 class AnalysisError { | 21 class AnalysisError { |
22 /** | 22 /** |
23 * An empty array of errors used when no errors are expected. | 23 * An empty array of errors used when no errors are expected. |
24 */ | 24 */ |
25 static const List<AnalysisError> NO_ERRORS = const <AnalysisError>[]; | 25 static const List<AnalysisError> NO_ERRORS = const <AnalysisError>[]; |
26 | 26 |
27 /** | 27 /** |
28 * A [Comparator] that sorts by the name of the file that the [AnalysisError]
was | 28 * A [Comparator] that sorts by the name of the file that the [AnalysisError]
was |
29 * found. | 29 * found. |
30 */ | 30 */ |
31 static Comparator<AnalysisError> FILE_COMPARATOR = | 31 static Comparator<AnalysisError> FILE_COMPARATOR = (AnalysisError o1, |
32 (AnalysisError o1, AnalysisError o2) => | 32 AnalysisError o2) => o1.source.shortName.compareTo(o2.source.shortName); |
33 o1.source.shortName.compareTo(o2.source.shortName); | |
34 | 33 |
35 /** | 34 /** |
36 * A [Comparator] that sorts error codes first by their severity (errors first
, warnings | 35 * A [Comparator] that sorts error codes first by their severity (errors first
, warnings |
37 * second), and then by the the error code type. | 36 * second), and then by the the error code type. |
38 */ | 37 */ |
39 static Comparator<AnalysisError> ERROR_CODE_COMPARATOR = | 38 static Comparator<AnalysisError> ERROR_CODE_COMPARATOR = (AnalysisError o1, |
40 (AnalysisError o1, AnalysisError o2) { | 39 AnalysisError o2) { |
41 ErrorCode errorCode1 = o1.errorCode; | 40 ErrorCode errorCode1 = o1.errorCode; |
42 ErrorCode errorCode2 = o2.errorCode; | 41 ErrorCode errorCode2 = o2.errorCode; |
43 ErrorSeverity errorSeverity1 = errorCode1.errorSeverity; | 42 ErrorSeverity errorSeverity1 = errorCode1.errorSeverity; |
44 ErrorSeverity errorSeverity2 = errorCode2.errorSeverity; | 43 ErrorSeverity errorSeverity2 = errorCode2.errorSeverity; |
45 ErrorType errorType1 = errorCode1.type; | 44 ErrorType errorType1 = errorCode1.type; |
46 ErrorType errorType2 = errorCode2.type; | 45 ErrorType errorType2 = errorCode2.type; |
47 if (errorSeverity1 == errorSeverity2) { | 46 if (errorSeverity1 == errorSeverity2) { |
48 return errorType1.compareTo(errorType2); | 47 return errorType1.compareTo(errorType2); |
49 } else { | 48 } else { |
50 return errorSeverity2.compareTo(errorSeverity1); | 49 return errorSeverity2.compareTo(errorSeverity1); |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 new HashMap<ErrorProperty, Object>(); | 244 new HashMap<ErrorProperty, Object>(); |
246 | 245 |
247 /** | 246 /** |
248 * Initialize a newly created analysis error for the specified source. The err
or has no location | 247 * Initialize a newly created analysis error for the specified source. The err
or has no location |
249 * information. | 248 * information. |
250 * | 249 * |
251 * @param source the source for which the exception occurred | 250 * @param source the source for which the exception occurred |
252 * @param errorCode the error code to be associated with this error | 251 * @param errorCode the error code to be associated with this error |
253 * @param arguments the arguments used to build the error message | 252 * @param arguments the arguments used to build the error message |
254 */ | 253 */ |
255 AnalysisErrorWithProperties.con1(Source source, ErrorCode errorCode, | 254 AnalysisErrorWithProperties.con1( |
256 List<Object> arguments) | 255 Source source, ErrorCode errorCode, List<Object> arguments) |
257 : super.con1(source, errorCode, arguments); | 256 : super.con1(source, errorCode, arguments); |
258 | 257 |
259 /** | 258 /** |
260 * Initialize a newly created analysis error for the specified source at the g
iven location. | 259 * Initialize a newly created analysis error for the specified source at the g
iven location. |
261 * | 260 * |
262 * @param source the source for which the exception occurred | 261 * @param source the source for which the exception occurred |
263 * @param offset the offset of the location of the error | 262 * @param offset the offset of the location of the error |
264 * @param length the length of the location of the error | 263 * @param length the length of the location of the error |
265 * @param errorCode the error code to be associated with this error | 264 * @param errorCode the error code to be associated with this error |
266 * @param arguments the arguments used to build the error message | 265 * @param arguments the arguments used to build the error message |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 // clear to the user that the error is coming from constant evaluation (and | 319 // clear to the user that the error is coming from constant evaluation (and |
321 // hence the constant needs to be a subtype of the annotated type) as opposed | 320 // hence the constant needs to be a subtype of the annotated type) as opposed |
322 // to static type analysis (which only requires that the two types be | 321 // to static type analysis (which only requires that the two types be |
323 // assignable). Also consider populating the "correction" field for these | 322 // assignable). Also consider populating the "correction" field for these |
324 // errors. | 323 // errors. |
325 | 324 |
326 /** | 325 /** |
327 * 12.11.2 Const: It is a compile-time error if evaluation of a constant | 326 * 12.11.2 Const: It is a compile-time error if evaluation of a constant |
328 * object results in an uncaught exception being thrown. | 327 * object results in an uncaught exception being thrown. |
329 */ | 328 */ |
330 static const CheckedModeCompileTimeErrorCode | 329 static const CheckedModeCompileTimeErrorCode CONST_CONSTRUCTOR_FIELD_TYPE_MISM
ATCH = |
331 CONST_CONSTRUCTOR_FIELD_TYPE_MISMATCH = | |
332 const CheckedModeCompileTimeErrorCode( | 330 const CheckedModeCompileTimeErrorCode( |
333 'CONST_CONSTRUCTOR_FIELD_TYPE_MISMATCH', | 331 'CONST_CONSTRUCTOR_FIELD_TYPE_MISMATCH', |
334 "The object type '{0}' cannot be assigned to the field '{1}', which ha
s type '{2}'"); | 332 "The object type '{0}' cannot be assigned to the field '{1}', which ha
s type '{2}'"); |
335 | 333 |
336 /** | 334 /** |
337 * 12.11.2 Const: It is a compile-time error if evaluation of a constant | 335 * 12.11.2 Const: It is a compile-time error if evaluation of a constant |
338 * object results in an uncaught exception being thrown. | 336 * object results in an uncaught exception being thrown. |
339 */ | 337 */ |
340 static const CheckedModeCompileTimeErrorCode | 338 static const CheckedModeCompileTimeErrorCode CONST_CONSTRUCTOR_PARAM_TYPE_MISM
ATCH = |
341 CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH = | |
342 const CheckedModeCompileTimeErrorCode( | 339 const CheckedModeCompileTimeErrorCode( |
343 'CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH', | 340 'CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH', |
344 "The object type '{0}' cannot be assigned to a parameter of type '{1}'
"); | 341 "The object type '{0}' cannot be assigned to a parameter of type '{1}'
"); |
345 | 342 |
346 /** | 343 /** |
347 * 7.6.1 Generative Constructors: In checked mode, it is a dynamic type error | 344 * 7.6.1 Generative Constructors: In checked mode, it is a dynamic type error |
348 * if o is not <b>null</b> and the interface of the class of <i>o</i> is not a | 345 * if o is not <b>null</b> and the interface of the class of <i>o</i> is not a |
349 * subtype of the static type of the field <i>v</i>. | 346 * subtype of the static type of the field <i>v</i>. |
350 * | 347 * |
351 * 12.11.2 Const: It is a compile-time error if evaluation of a constant | 348 * 12.11.2 Const: It is a compile-time error if evaluation of a constant |
352 * object results in an uncaught exception being thrown. | 349 * object results in an uncaught exception being thrown. |
353 * | 350 * |
354 * @param initializerType the name of the type of the initializer expression | 351 * @param initializerType the name of the type of the initializer expression |
355 * @param fieldType the name of the type of the field | 352 * @param fieldType the name of the type of the field |
356 */ | 353 */ |
357 static const CheckedModeCompileTimeErrorCode | 354 static const CheckedModeCompileTimeErrorCode CONST_FIELD_INITIALIZER_NOT_ASSIG
NABLE = |
358 CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE = | |
359 const CheckedModeCompileTimeErrorCode( | 355 const CheckedModeCompileTimeErrorCode( |
360 'CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE', | 356 'CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE', |
361 "The initializer type '{0}' cannot be assigned to the field type '{1}'
"); | 357 "The initializer type '{0}' cannot be assigned to the field type '{1}'
"); |
362 | 358 |
363 /** | 359 /** |
364 * 12.6 Lists: A run-time list literal <<i>E</i>> [<i>e<sub>1</sub></i> | 360 * 12.6 Lists: A run-time list literal <<i>E</i>> [<i>e<sub>1</sub></i> |
365 * ... <i>e<sub>n</sub></i>] is evaluated as follows: | 361 * ... <i>e<sub>n</sub></i>] is evaluated as follows: |
366 * * The operator []= is invoked on <i>a</i> with first argument <i>i</i> and | 362 * * The operator []= is invoked on <i>a</i> with first argument <i>i</i> and |
367 * second argument <i>o<sub>i+1</sub></i><i>, 1 <= i <= n</i> | 363 * second argument <i>o<sub>i+1</sub></i><i>, 1 <= i <= n</i> |
368 * | 364 * |
369 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static | 365 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static |
370 * type of <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of | 366 * type of <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of |
371 * <i>p<sub>i</sub>, 1 <= i <= n+k</i> and let <i>S<sub>q</sub></i> be | 367 * <i>p<sub>i</sub>, 1 <= i <= n+k</i> and let <i>S<sub>q</sub></i> be |
372 * the type of the named parameter <i>q</i> of <i>f</i>. It is a static | 368 * the type of the named parameter <i>q</i> of <i>f</i>. It is a static |
373 * warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<sub>j</sub>, | 369 * warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<sub>j</sub>, |
374 * 1 <= j <= m</i>. | 370 * 1 <= j <= m</i>. |
375 */ | 371 */ |
376 static const CheckedModeCompileTimeErrorCode LIST_ELEMENT_TYPE_NOT_ASSIGNABLE | 372 static const CheckedModeCompileTimeErrorCode LIST_ELEMENT_TYPE_NOT_ASSIGNABLE
= |
377 = | 373 const CheckedModeCompileTimeErrorCode('LIST_ELEMENT_TYPE_NOT_ASSIGNABLE', |
378 const CheckedModeCompileTimeErrorCode( | |
379 'LIST_ELEMENT_TYPE_NOT_ASSIGNABLE', | |
380 "The element type '{0}' cannot be assigned to the list type '{1}'"); | 374 "The element type '{0}' cannot be assigned to the list type '{1}'"); |
381 | 375 |
382 /** | 376 /** |
383 * 12.7 Map: A run-time map literal <<i>K</i>, <i>V</i>> | 377 * 12.7 Map: A run-time map literal <<i>K</i>, <i>V</i>> |
384 * [<i>k<sub>1</sub></i> : <i>e<sub>1</sub></i> ... <i>k<sub>n</sub></i> : | 378 * [<i>k<sub>1</sub></i> : <i>e<sub>1</sub></i> ... <i>k<sub>n</sub></i> : |
385 * <i>e<sub>n</sub></i>] is evaluated as follows: | 379 * <i>e<sub>n</sub></i>] is evaluated as follows: |
386 * * The operator []= is invoked on <i>m</i> with first argument | 380 * * The operator []= is invoked on <i>m</i> with first argument |
387 * <i>k<sub>i</sub></i> and second argument <i>e<sub>i</sub></i><i>, 1 <= | 381 * <i>k<sub>i</sub></i> and second argument <i>e<sub>i</sub></i><i>, 1 <= |
388 * i <= n</i> | 382 * i <= n</i> |
389 * | 383 * |
390 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static | 384 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static |
391 * type of <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of | 385 * type of <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of |
392 * <i>p<sub>i</sub>, 1 <= i <= n+k</i> and let <i>S<sub>q</sub></i> be | 386 * <i>p<sub>i</sub>, 1 <= i <= n+k</i> and let <i>S<sub>q</sub></i> be |
393 * the type of the named parameter <i>q</i> of <i>f</i>. It is a static | 387 * the type of the named parameter <i>q</i> of <i>f</i>. It is a static |
394 * warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<sub>j</sub>, 1 | 388 * warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<sub>j</sub>, 1 |
395 * <= j <= m</i>. | 389 * <= j <= m</i>. |
396 */ | 390 */ |
397 static const CheckedModeCompileTimeErrorCode MAP_KEY_TYPE_NOT_ASSIGNABLE = | 391 static const CheckedModeCompileTimeErrorCode MAP_KEY_TYPE_NOT_ASSIGNABLE = |
398 const CheckedModeCompileTimeErrorCode( | 392 const CheckedModeCompileTimeErrorCode('MAP_KEY_TYPE_NOT_ASSIGNABLE', |
399 'MAP_KEY_TYPE_NOT_ASSIGNABLE', | |
400 "The element type '{0}' cannot be assigned to the map key type '{1}'")
; | 393 "The element type '{0}' cannot be assigned to the map key type '{1}'")
; |
401 | 394 |
402 /** | 395 /** |
403 * 12.7 Map: A run-time map literal <<i>K</i>, <i>V</i>> | 396 * 12.7 Map: A run-time map literal <<i>K</i>, <i>V</i>> |
404 * [<i>k<sub>1</sub></i> : <i>e<sub>1</sub></i> ... <i>k<sub>n</sub></i> : | 397 * [<i>k<sub>1</sub></i> : <i>e<sub>1</sub></i> ... <i>k<sub>n</sub></i> : |
405 * <i>e<sub>n</sub></i>] is evaluated as follows: | 398 * <i>e<sub>n</sub></i>] is evaluated as follows: |
406 * * The operator []= is invoked on <i>m</i> with first argument | 399 * * The operator []= is invoked on <i>m</i> with first argument |
407 * <i>k<sub>i</sub></i> and second argument <i>e<sub>i</sub></i><i>, 1 <= | 400 * <i>k<sub>i</sub></i> and second argument <i>e<sub>i</sub></i><i>, 1 <= |
408 * i <= n</i> | 401 * i <= n</i> |
409 * | 402 * |
410 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static | 403 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static |
411 * type of <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of | 404 * type of <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of |
412 * <i>p<sub>i</sub>, 1 <= i <= n+k</i> and let <i>S<sub>q</sub></i> be | 405 * <i>p<sub>i</sub>, 1 <= i <= n+k</i> and let <i>S<sub>q</sub></i> be |
413 * the type of the named parameter <i>q</i> of <i>f</i>. It is a static | 406 * the type of the named parameter <i>q</i> of <i>f</i>. It is a static |
414 * warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<sub>j</sub>, 1 | 407 * warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<sub>j</sub>, 1 |
415 * <= j <= m</i>. | 408 * <= j <= m</i>. |
416 */ | 409 */ |
417 static const CheckedModeCompileTimeErrorCode MAP_VALUE_TYPE_NOT_ASSIGNABLE = | 410 static const CheckedModeCompileTimeErrorCode MAP_VALUE_TYPE_NOT_ASSIGNABLE = |
418 const CheckedModeCompileTimeErrorCode( | 411 const CheckedModeCompileTimeErrorCode('MAP_VALUE_TYPE_NOT_ASSIGNABLE', |
419 'MAP_VALUE_TYPE_NOT_ASSIGNABLE', | |
420 "The element type '{0}' cannot be assigned to the map value type '{1}'
"); | 412 "The element type '{0}' cannot be assigned to the map value type '{1}'
"); |
421 | 413 |
422 /** | 414 /** |
423 * 12.11.2 Const: It is a compile-time error if evaluation of a constant | 415 * 12.11.2 Const: It is a compile-time error if evaluation of a constant |
424 * object results in an uncaught exception being thrown. | 416 * object results in an uncaught exception being thrown. |
425 */ | 417 */ |
426 static const CheckedModeCompileTimeErrorCode VARIABLE_TYPE_MISMATCH = | 418 static const CheckedModeCompileTimeErrorCode VARIABLE_TYPE_MISMATCH = |
427 const CheckedModeCompileTimeErrorCode( | 419 const CheckedModeCompileTimeErrorCode('VARIABLE_TYPE_MISMATCH', |
428 'VARIABLE_TYPE_MISMATCH', | |
429 "The object type '{0}' cannot be assigned to a variable of type '{1}'"
); | 420 "The object type '{0}' cannot be assigned to a variable of type '{1}'"
); |
430 | 421 |
431 /** | 422 /** |
432 * Initialize a newly created error code to have the given [name]. The message | 423 * Initialize a newly created error code to have the given [name]. The message |
433 * associated with the error will be created from the given [message] | 424 * associated with the error will be created from the given [message] |
434 * template. The correction associated with the error will be created from the | 425 * template. The correction associated with the error will be created from the |
435 * given [correction] template. | 426 * given [correction] template. |
436 */ | 427 */ |
437 const CheckedModeCompileTimeErrorCode(String name, String message, | 428 const CheckedModeCompileTimeErrorCode(String name, String message, |
438 [String correction]) | 429 [String correction]) |
(...skipping 13 matching lines...) Expand all Loading... |
452 * error code to indicate the problem that caused the error to be generated and | 443 * error code to indicate the problem that caused the error to be generated and |
453 * for the error message to explain what is wrong and, when appropriate, how the | 444 * for the error message to explain what is wrong and, when appropriate, how the |
454 * problem can be corrected. | 445 * problem can be corrected. |
455 */ | 446 */ |
456 class CompileTimeErrorCode extends ErrorCode { | 447 class CompileTimeErrorCode extends ErrorCode { |
457 /** | 448 /** |
458 * Enum proposal: It is also a compile-time error to explicitly instantiate an | 449 * Enum proposal: It is also a compile-time error to explicitly instantiate an |
459 * enum via 'new' or 'const' or to access its private fields. | 450 * enum via 'new' or 'const' or to access its private fields. |
460 */ | 451 */ |
461 static const CompileTimeErrorCode ACCESS_PRIVATE_ENUM_FIELD = | 452 static const CompileTimeErrorCode ACCESS_PRIVATE_ENUM_FIELD = |
462 const CompileTimeErrorCode( | 453 const CompileTimeErrorCode('ACCESS_PRIVATE_ENUM_FIELD', |
463 'ACCESS_PRIVATE_ENUM_FIELD', | |
464 "The private fields of an enum cannot be accessed, even within the sam
e library"); | 454 "The private fields of an enum cannot be accessed, even within the sam
e library"); |
465 | 455 |
466 /** | 456 /** |
467 * 14.2 Exports: It is a compile-time error if a name <i>N</i> is re-exported | 457 * 14.2 Exports: It is a compile-time error if a name <i>N</i> is re-exported |
468 * by a library <i>L</i> and <i>N</i> is introduced into the export namespace | 458 * by a library <i>L</i> and <i>N</i> is introduced into the export namespace |
469 * of <i>L</i> by more than one export, unless each all exports refer to same | 459 * of <i>L</i> by more than one export, unless each all exports refer to same |
470 * declaration for the name N. | 460 * declaration for the name N. |
471 * | 461 * |
472 * @param ambiguousElementName the name of the ambiguous element | 462 * @param ambiguousElementName the name of the ambiguous element |
473 * @param firstLibraryName the name of the first library that the type is | 463 * @param firstLibraryName the name of the first library that the type is |
474 * found | 464 * found |
475 * @param secondLibraryName the name of the second library that the type is | 465 * @param secondLibraryName the name of the second library that the type is |
476 * found | 466 * found |
477 */ | 467 */ |
478 static const CompileTimeErrorCode AMBIGUOUS_EXPORT = | 468 static const CompileTimeErrorCode AMBIGUOUS_EXPORT = |
479 const CompileTimeErrorCode( | 469 const CompileTimeErrorCode('AMBIGUOUS_EXPORT', |
480 'AMBIGUOUS_EXPORT', | |
481 "The name '{0}' is defined in the libraries '{1}' and '{2}'"); | 470 "The name '{0}' is defined in the libraries '{1}' and '{2}'"); |
482 | 471 |
483 /** | 472 /** |
484 * 12.33 Argument Definition Test: It is a compile time error if <i>v</i> does | 473 * 12.33 Argument Definition Test: It is a compile time error if <i>v</i> does |
485 * not denote a formal parameter. | 474 * not denote a formal parameter. |
486 * | 475 * |
487 * @param the name of the identifier in the argument definition test that is | 476 * @param the name of the identifier in the argument definition test that is |
488 * not a parameter | 477 * not a parameter |
489 */ | 478 */ |
490 static const CompileTimeErrorCode ARGUMENT_DEFINITION_TEST_NON_PARAMETER = | 479 static const CompileTimeErrorCode ARGUMENT_DEFINITION_TEST_NON_PARAMETER = |
491 const CompileTimeErrorCode( | 480 const CompileTimeErrorCode( |
492 'ARGUMENT_DEFINITION_TEST_NON_PARAMETER', | 481 'ARGUMENT_DEFINITION_TEST_NON_PARAMETER', "'{0}' is not a parameter"); |
493 "'{0}' is not a parameter"); | |
494 | 482 |
495 /** | 483 /** |
496 * ?? Asynchronous For-in: It is a compile-time error if an asynchronous | 484 * ?? Asynchronous For-in: It is a compile-time error if an asynchronous |
497 * for-in statement appears inside a synchronous function. | 485 * for-in statement appears inside a synchronous function. |
498 */ | 486 */ |
499 static const CompileTimeErrorCode ASYNC_FOR_IN_WRONG_CONTEXT = | 487 static const CompileTimeErrorCode ASYNC_FOR_IN_WRONG_CONTEXT = |
500 const CompileTimeErrorCode( | 488 const CompileTimeErrorCode('ASYNC_FOR_IN_WRONG_CONTEXT', |
501 'ASYNC_FOR_IN_WRONG_CONTEXT', | |
502 "The asynchronous for-in can only be used in a function marked with as
ync or async*"); | 489 "The asynchronous for-in can only be used in a function marked with as
ync or async*"); |
503 | 490 |
504 /** | 491 /** |
505 * ??: It is a compile-time error if the function immediately enclosing a is | 492 * ??: It is a compile-time error if the function immediately enclosing a is |
506 * not declared asynchronous. | 493 * not declared asynchronous. |
507 */ | 494 */ |
508 static const CompileTimeErrorCode AWAIT_IN_WRONG_CONTEXT = | 495 static const CompileTimeErrorCode AWAIT_IN_WRONG_CONTEXT = |
509 const CompileTimeErrorCode( | 496 const CompileTimeErrorCode('AWAIT_IN_WRONG_CONTEXT', |
510 'AWAIT_IN_WRONG_CONTEXT', | |
511 "The await expression can only be used in a function marked as async o
r async*"); | 497 "The await expression can only be used in a function marked as async o
r async*"); |
512 | 498 |
513 /** | 499 /** |
514 * 12.30 Identifier Reference: It is a compile-time error to use a built-in | 500 * 12.30 Identifier Reference: It is a compile-time error to use a built-in |
515 * identifier other than dynamic as a type annotation. | 501 * identifier other than dynamic as a type annotation. |
516 */ | 502 */ |
517 static const CompileTimeErrorCode BUILT_IN_IDENTIFIER_AS_TYPE = | 503 static const CompileTimeErrorCode BUILT_IN_IDENTIFIER_AS_TYPE = |
518 const CompileTimeErrorCode( | 504 const CompileTimeErrorCode('BUILT_IN_IDENTIFIER_AS_TYPE', |
519 'BUILT_IN_IDENTIFIER_AS_TYPE', | |
520 "The built-in identifier '{0}' cannot be as a type"); | 505 "The built-in identifier '{0}' cannot be as a type"); |
521 | 506 |
522 /** | 507 /** |
523 * 12.30 Identifier Reference: It is a compile-time error if a built-in | 508 * 12.30 Identifier Reference: It is a compile-time error if a built-in |
524 * identifier is used as the declared name of a class, type parameter or type | 509 * identifier is used as the declared name of a class, type parameter or type |
525 * alias. | 510 * alias. |
526 */ | 511 */ |
527 static const CompileTimeErrorCode BUILT_IN_IDENTIFIER_AS_TYPE_NAME = | 512 static const CompileTimeErrorCode BUILT_IN_IDENTIFIER_AS_TYPE_NAME = |
528 const CompileTimeErrorCode( | 513 const CompileTimeErrorCode('BUILT_IN_IDENTIFIER_AS_TYPE_NAME', |
529 'BUILT_IN_IDENTIFIER_AS_TYPE_NAME', | |
530 "The built-in identifier '{0}' cannot be used as a type name"); | 514 "The built-in identifier '{0}' cannot be used as a type name"); |
531 | 515 |
532 /** | 516 /** |
533 * 12.30 Identifier Reference: It is a compile-time error if a built-in | 517 * 12.30 Identifier Reference: It is a compile-time error if a built-in |
534 * identifier is used as the declared name of a class, type parameter or type | 518 * identifier is used as the declared name of a class, type parameter or type |
535 * alias. | 519 * alias. |
536 */ | 520 */ |
537 static const CompileTimeErrorCode BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME = | 521 static const CompileTimeErrorCode BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME = |
538 const CompileTimeErrorCode( | 522 const CompileTimeErrorCode('BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME', |
539 'BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME', | |
540 "The built-in identifier '{0}' cannot be used as a type alias name"); | 523 "The built-in identifier '{0}' cannot be used as a type alias name"); |
541 | 524 |
542 /** | 525 /** |
543 * 12.30 Identifier Reference: It is a compile-time error if a built-in | 526 * 12.30 Identifier Reference: It is a compile-time error if a built-in |
544 * identifier is used as the declared name of a class, type parameter or type | 527 * identifier is used as the declared name of a class, type parameter or type |
545 * alias. | 528 * alias. |
546 */ | 529 */ |
547 static const CompileTimeErrorCode BUILT_IN_IDENTIFIER_AS_TYPE_PARAMETER_NAME = | 530 static const CompileTimeErrorCode BUILT_IN_IDENTIFIER_AS_TYPE_PARAMETER_NAME = |
548 const CompileTimeErrorCode( | 531 const CompileTimeErrorCode('BUILT_IN_IDENTIFIER_AS_TYPE_PARAMETER_NAME', |
549 'BUILT_IN_IDENTIFIER_AS_TYPE_PARAMETER_NAME', | |
550 "The built-in identifier '{0}' cannot be used as a type parameter name
"); | 532 "The built-in identifier '{0}' cannot be used as a type parameter name
"); |
551 | 533 |
552 /** | 534 /** |
553 * 13.9 Switch: It is a compile-time error if the class <i>C</i> implements | 535 * 13.9 Switch: It is a compile-time error if the class <i>C</i> implements |
554 * the operator <i>==</i>. | 536 * the operator <i>==</i>. |
555 */ | 537 */ |
556 static const CompileTimeErrorCode CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS = | 538 static const CompileTimeErrorCode CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS = |
557 const CompileTimeErrorCode( | 539 const CompileTimeErrorCode('CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS', |
558 'CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS', | |
559 "The switch case expression type '{0}' cannot override the == operator
"); | 540 "The switch case expression type '{0}' cannot override the == operator
"); |
560 | 541 |
561 /** | 542 /** |
562 * 12.1 Constants: It is a compile-time error if evaluation of a compile-time | 543 * 12.1 Constants: It is a compile-time error if evaluation of a compile-time |
563 * constant would raise | 544 * constant would raise |
564 * an exception. | 545 * an exception. |
565 */ | 546 */ |
566 static const CompileTimeErrorCode COMPILE_TIME_CONSTANT_RAISES_EXCEPTION = | 547 static const CompileTimeErrorCode COMPILE_TIME_CONSTANT_RAISES_EXCEPTION = |
567 const CompileTimeErrorCode('COMPILE_TIME_CONSTANT_RAISES_EXCEPTION', ""); | 548 const CompileTimeErrorCode('COMPILE_TIME_CONSTANT_RAISES_EXCEPTION', ""); |
568 | 549 |
569 /** | 550 /** |
570 * 7.2 Getters: It is a compile-time error if a class has both a getter and a | 551 * 7.2 Getters: It is a compile-time error if a class has both a getter and a |
571 * method with the same name. This restriction holds regardless of whether the | 552 * method with the same name. This restriction holds regardless of whether the |
572 * getter is defined explicitly or implicitly, or whether the getter or the | 553 * getter is defined explicitly or implicitly, or whether the getter or the |
573 * method are inherited or not. | 554 * method are inherited or not. |
574 */ | 555 */ |
575 static const CompileTimeErrorCode CONFLICTING_GETTER_AND_METHOD = | 556 static const CompileTimeErrorCode CONFLICTING_GETTER_AND_METHOD = |
576 const CompileTimeErrorCode( | 557 const CompileTimeErrorCode('CONFLICTING_GETTER_AND_METHOD', |
577 'CONFLICTING_GETTER_AND_METHOD', | |
578 "Class '{0}' cannot have both getter '{1}.{2}' and method with the sam
e name"); | 558 "Class '{0}' cannot have both getter '{1}.{2}' and method with the sam
e name"); |
579 | 559 |
580 /** | 560 /** |
581 * 7.2 Getters: It is a compile-time error if a class has both a getter and a | 561 * 7.2 Getters: It is a compile-time error if a class has both a getter and a |
582 * method with the same name. This restriction holds regardless of whether the | 562 * method with the same name. This restriction holds regardless of whether the |
583 * getter is defined explicitly or implicitly, or whether the getter or the | 563 * getter is defined explicitly or implicitly, or whether the getter or the |
584 * method are inherited or not. | 564 * method are inherited or not. |
585 */ | 565 */ |
586 static const CompileTimeErrorCode CONFLICTING_METHOD_AND_GETTER = | 566 static const CompileTimeErrorCode CONFLICTING_METHOD_AND_GETTER = |
587 const CompileTimeErrorCode( | 567 const CompileTimeErrorCode('CONFLICTING_METHOD_AND_GETTER', |
588 'CONFLICTING_METHOD_AND_GETTER', | |
589 "Class '{0}' cannot have both method '{1}.{2}' and getter with the sam
e name"); | 568 "Class '{0}' cannot have both method '{1}.{2}' and getter with the sam
e name"); |
590 | 569 |
591 /** | 570 /** |
592 * 7.6 Constructors: A constructor name always begins with the name of its | 571 * 7.6 Constructors: A constructor name always begins with the name of its |
593 * immediately enclosing class, and may optionally be followed by a dot and an | 572 * immediately enclosing class, and may optionally be followed by a dot and an |
594 * identifier <i>id</i>. It is a compile-time error if <i>id</i> is the name | 573 * identifier <i>id</i>. It is a compile-time error if <i>id</i> is the name |
595 * of a member declared in the immediately enclosing class. | 574 * of a member declared in the immediately enclosing class. |
596 */ | 575 */ |
597 static const CompileTimeErrorCode CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD = | 576 static const CompileTimeErrorCode CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD = |
598 const CompileTimeErrorCode( | 577 const CompileTimeErrorCode('CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD', |
599 'CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD', | |
600 "'{0}' cannot be used to name a constructor and a field in this class"
); | 578 "'{0}' cannot be used to name a constructor and a field in this class"
); |
601 | 579 |
602 /** | 580 /** |
603 * 7.6 Constructors: A constructor name always begins with the name of its | 581 * 7.6 Constructors: A constructor name always begins with the name of its |
604 * immediately enclosing class, and may optionally be followed by a dot and an | 582 * immediately enclosing class, and may optionally be followed by a dot and an |
605 * identifier <i>id</i>. It is a compile-time error if <i>id</i> is the name | 583 * identifier <i>id</i>. It is a compile-time error if <i>id</i> is the name |
606 * of a member declared in the immediately enclosing class. | 584 * of a member declared in the immediately enclosing class. |
607 */ | 585 */ |
608 static const CompileTimeErrorCode CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD = | 586 static const CompileTimeErrorCode CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD = |
609 const CompileTimeErrorCode( | 587 const CompileTimeErrorCode('CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD', |
610 'CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD', | |
611 "'{0}' cannot be used to name a constructor and a method in this class
"); | 588 "'{0}' cannot be used to name a constructor and a method in this class
"); |
612 | 589 |
613 /** | 590 /** |
614 * 7. Classes: It is a compile time error if a generic class declares a type | 591 * 7. Classes: It is a compile time error if a generic class declares a type |
615 * variable with the same name as the class or any of its members or | 592 * variable with the same name as the class or any of its members or |
616 * constructors. | 593 * constructors. |
617 */ | 594 */ |
618 static const CompileTimeErrorCode CONFLICTING_TYPE_VARIABLE_AND_CLASS = | 595 static const CompileTimeErrorCode CONFLICTING_TYPE_VARIABLE_AND_CLASS = |
619 const CompileTimeErrorCode( | 596 const CompileTimeErrorCode('CONFLICTING_TYPE_VARIABLE_AND_CLASS', |
620 'CONFLICTING_TYPE_VARIABLE_AND_CLASS', | |
621 "'{0}' cannot be used to name a type varaible in a class with the same
name"); | 597 "'{0}' cannot be used to name a type varaible in a class with the same
name"); |
622 | 598 |
623 /** | 599 /** |
624 * 7. Classes: It is a compile time error if a generic class declares a type | 600 * 7. Classes: It is a compile time error if a generic class declares a type |
625 * variable with the same name as the class or any of its members or | 601 * variable with the same name as the class or any of its members or |
626 * constructors. | 602 * constructors. |
627 */ | 603 */ |
628 static const CompileTimeErrorCode CONFLICTING_TYPE_VARIABLE_AND_MEMBER = | 604 static const CompileTimeErrorCode CONFLICTING_TYPE_VARIABLE_AND_MEMBER = |
629 const CompileTimeErrorCode( | 605 const CompileTimeErrorCode('CONFLICTING_TYPE_VARIABLE_AND_MEMBER', |
630 'CONFLICTING_TYPE_VARIABLE_AND_MEMBER', | |
631 "'{0}' cannot be used to name a type varaible and member in this class
"); | 606 "'{0}' cannot be used to name a type varaible and member in this class
"); |
632 | 607 |
633 /** | 608 /** |
634 * 12.11.2 Const: It is a compile-time error if evaluation of a constant | 609 * 12.11.2 Const: It is a compile-time error if evaluation of a constant |
635 * object results in an uncaught exception being thrown. | 610 * object results in an uncaught exception being thrown. |
636 */ | 611 */ |
637 static const CompileTimeErrorCode CONST_CONSTRUCTOR_THROWS_EXCEPTION = | 612 static const CompileTimeErrorCode CONST_CONSTRUCTOR_THROWS_EXCEPTION = |
638 const CompileTimeErrorCode( | 613 const CompileTimeErrorCode('CONST_CONSTRUCTOR_THROWS_EXCEPTION', |
639 'CONST_CONSTRUCTOR_THROWS_EXCEPTION', | |
640 "'const' constructors cannot throw exceptions"); | 614 "'const' constructors cannot throw exceptions"); |
641 | 615 |
642 /** | 616 /** |
643 * 10.6.3 Constant Constructors: It is a compile-time error if a constant | 617 * 10.6.3 Constant Constructors: It is a compile-time error if a constant |
644 * constructor is declared by a class C if any instance variable declared in C | 618 * constructor is declared by a class C if any instance variable declared in C |
645 * is initialized with an expression that is not a constant expression. | 619 * is initialized with an expression that is not a constant expression. |
646 */ | 620 */ |
647 static const CompileTimeErrorCode | 621 static const CompileTimeErrorCode CONST_CONSTRUCTOR_WITH_FIELD_INITIALIZED_BY_
NON_CONST = |
648 CONST_CONSTRUCTOR_WITH_FIELD_INITIALIZED_BY_NON_CONST = | |
649 const CompileTimeErrorCode( | 622 const CompileTimeErrorCode( |
650 'CONST_CONSTRUCTOR_WITH_FIELD_INITIALIZED_BY_NON_CONST', | 623 'CONST_CONSTRUCTOR_WITH_FIELD_INITIALIZED_BY_NON_CONST', |
651 "Can't define the 'const' constructor because the field '{0}' is initi
alized with a non-constant value"); | 624 "Can't define the 'const' constructor because the field '{0}' is initi
alized with a non-constant value"); |
652 | 625 |
653 /** | 626 /** |
654 * 7.6.3 Constant Constructors: The superinitializer that appears, explicitly | 627 * 7.6.3 Constant Constructors: The superinitializer that appears, explicitly |
655 * or implicitly, in the initializer list of a constant constructor must | 628 * or implicitly, in the initializer list of a constant constructor must |
656 * specify a constant constructor of the superclass of the immediately | 629 * specify a constant constructor of the superclass of the immediately |
657 * enclosing class or a compile-time error occurs. | 630 * enclosing class or a compile-time error occurs. |
658 * | 631 * |
659 * 9 Mixins: For each generative constructor named ... an implicitly declared | 632 * 9 Mixins: For each generative constructor named ... an implicitly declared |
660 * constructor named ... is declared. | 633 * constructor named ... is declared. |
661 */ | 634 */ |
662 static const CompileTimeErrorCode CONST_CONSTRUCTOR_WITH_MIXIN = | 635 static const CompileTimeErrorCode CONST_CONSTRUCTOR_WITH_MIXIN = |
663 const CompileTimeErrorCode( | 636 const CompileTimeErrorCode('CONST_CONSTRUCTOR_WITH_MIXIN', |
664 'CONST_CONSTRUCTOR_WITH_MIXIN', | |
665 "Constant constructor cannot be declared for a class with a mixin"); | 637 "Constant constructor cannot be declared for a class with a mixin"); |
666 | 638 |
667 /** | 639 /** |
668 * 7.6.3 Constant Constructors: The superinitializer that appears, explicitly | 640 * 7.6.3 Constant Constructors: The superinitializer that appears, explicitly |
669 * or implicitly, in the initializer list of a constant constructor must | 641 * or implicitly, in the initializer list of a constant constructor must |
670 * specify a constant constructor of the superclass of the immediately | 642 * specify a constant constructor of the superclass of the immediately |
671 * enclosing class or a compile-time error occurs. | 643 * enclosing class or a compile-time error occurs. |
672 */ | 644 */ |
673 static const CompileTimeErrorCode CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER = | 645 static const CompileTimeErrorCode CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER = |
674 const CompileTimeErrorCode( | 646 const CompileTimeErrorCode('CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER', |
675 'CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER', | |
676 "Constant constructor cannot call non-constant super constructor of '{
0}'"); | 647 "Constant constructor cannot call non-constant super constructor of '{
0}'"); |
677 | 648 |
678 /** | 649 /** |
679 * 7.6.3 Constant Constructors: It is a compile-time error if a constant | 650 * 7.6.3 Constant Constructors: It is a compile-time error if a constant |
680 * constructor is declared by a class that has a non-final instance variable. | 651 * constructor is declared by a class that has a non-final instance variable. |
681 * | 652 * |
682 * The above refers to both locally declared and inherited instance variables. | 653 * The above refers to both locally declared and inherited instance variables. |
683 */ | 654 */ |
684 static const CompileTimeErrorCode CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD = | 655 static const CompileTimeErrorCode CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD = |
685 const CompileTimeErrorCode( | 656 const CompileTimeErrorCode('CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD', |
686 'CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD', | |
687 "Cannot define the 'const' constructor for a class with non-final fiel
ds"); | 657 "Cannot define the 'const' constructor for a class with non-final fiel
ds"); |
688 | 658 |
689 /** | 659 /** |
690 * 12.12.2 Const: It is a compile-time error if <i>T</i> is a deferred type. | 660 * 12.12.2 Const: It is a compile-time error if <i>T</i> is a deferred type. |
691 */ | 661 */ |
692 static const CompileTimeErrorCode CONST_DEFERRED_CLASS = | 662 static const CompileTimeErrorCode CONST_DEFERRED_CLASS = |
693 const CompileTimeErrorCode( | 663 const CompileTimeErrorCode('CONST_DEFERRED_CLASS', |
694 'CONST_DEFERRED_CLASS', | |
695 "Deferred classes cannot be created with 'const'"); | 664 "Deferred classes cannot be created with 'const'"); |
696 | 665 |
697 /** | 666 /** |
698 * 6.2 Formal Parameters: It is a compile-time error if a formal parameter is | 667 * 6.2 Formal Parameters: It is a compile-time error if a formal parameter is |
699 * declared as a constant variable. | 668 * declared as a constant variable. |
700 */ | 669 */ |
701 static const CompileTimeErrorCode CONST_FORMAL_PARAMETER = | 670 static const CompileTimeErrorCode CONST_FORMAL_PARAMETER = |
702 const CompileTimeErrorCode( | 671 const CompileTimeErrorCode( |
703 'CONST_FORMAL_PARAMETER', | 672 'CONST_FORMAL_PARAMETER', "Parameters cannot be 'const'"); |
704 "Parameters cannot be 'const'"); | |
705 | 673 |
706 /** | 674 /** |
707 * 5 Variables: A constant variable must be initialized to a compile-time | 675 * 5 Variables: A constant variable must be initialized to a compile-time |
708 * constant or a compile-time error occurs. | 676 * constant or a compile-time error occurs. |
709 */ | 677 */ |
710 static const CompileTimeErrorCode CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE = | 678 static const CompileTimeErrorCode CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE = |
711 const CompileTimeErrorCode( | 679 const CompileTimeErrorCode('CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE', |
712 'CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE', | |
713 "'const' variables must be constant value"); | 680 "'const' variables must be constant value"); |
714 | 681 |
715 /** | 682 /** |
716 * 5 Variables: A constant variable must be initialized to a compile-time | 683 * 5 Variables: A constant variable must be initialized to a compile-time |
717 * constant or a compile-time error occurs. | 684 * constant or a compile-time error occurs. |
718 * | 685 * |
719 * 12.1 Constants: A qualified reference to a static constant variable that is | 686 * 12.1 Constants: A qualified reference to a static constant variable that is |
720 * not qualified by a deferred prefix. | 687 * not qualified by a deferred prefix. |
721 */ | 688 */ |
722 static const CompileTimeErrorCode | 689 static const CompileTimeErrorCode CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE_FR
OM_DEFERRED_LIBRARY = |
723 CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE_FROM_DEFERRED_LIBRARY = | |
724 const CompileTimeErrorCode( | 690 const CompileTimeErrorCode( |
725 'CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE_FROM_DEFERRED_LIBRARY', | 691 'CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE_FROM_DEFERRED_LIBRARY', |
726 "Constant values from a deferred library cannot be used to initialized
a 'const' variable"); | 692 "Constant values from a deferred library cannot be used to initialized
a 'const' variable"); |
727 | 693 |
728 /** | 694 /** |
729 * 7.5 Instance Variables: It is a compile-time error if an instance variable | 695 * 7.5 Instance Variables: It is a compile-time error if an instance variable |
730 * is declared to be constant. | 696 * is declared to be constant. |
731 */ | 697 */ |
732 static const CompileTimeErrorCode CONST_INSTANCE_FIELD = | 698 static const CompileTimeErrorCode CONST_INSTANCE_FIELD = |
733 const CompileTimeErrorCode( | 699 const CompileTimeErrorCode('CONST_INSTANCE_FIELD', |
734 'CONST_INSTANCE_FIELD', | |
735 "Only static fields can be declared as 'const'"); | 700 "Only static fields can be declared as 'const'"); |
736 | 701 |
737 /** | 702 /** |
738 * 12.8 Maps: It is a compile-time error if the key of an entry in a constant | 703 * 12.8 Maps: It is a compile-time error if the key of an entry in a constant |
739 * map literal is an instance of a class that implements the operator | 704 * map literal is an instance of a class that implements the operator |
740 * <i>==</i> unless the key is a string or integer. | 705 * <i>==</i> unless the key is a string or integer. |
741 */ | 706 */ |
742 static const CompileTimeErrorCode | 707 static const CompileTimeErrorCode CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQU
ALS = |
743 CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUALS = | |
744 const CompileTimeErrorCode( | 708 const CompileTimeErrorCode( |
745 'CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUALS', | 709 'CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUALS', |
746 "The constant map entry key expression type '{0}' cannot override the
== operator"); | 710 "The constant map entry key expression type '{0}' cannot override the
== operator"); |
747 | 711 |
748 /** | 712 /** |
749 * 5 Variables: A constant variable must be initialized to a compile-time | 713 * 5 Variables: A constant variable must be initialized to a compile-time |
750 * constant (12.1) or a compile-time error occurs. | 714 * constant (12.1) or a compile-time error occurs. |
751 * | 715 * |
752 * @param name the name of the uninitialized final variable | 716 * @param name the name of the uninitialized final variable |
753 */ | 717 */ |
754 static const CompileTimeErrorCode CONST_NOT_INITIALIZED = | 718 static const CompileTimeErrorCode CONST_NOT_INITIALIZED = |
755 const CompileTimeErrorCode( | 719 const CompileTimeErrorCode('CONST_NOT_INITIALIZED', |
756 'CONST_NOT_INITIALIZED', | |
757 "The const variable '{0}' must be initialized"); | 720 "The const variable '{0}' must be initialized"); |
758 | 721 |
759 /** | 722 /** |
760 * 12.11.2 Const: An expression of one of the forms !e, e1 && e2 or e1 || e2, | 723 * 12.11.2 Const: An expression of one of the forms !e, e1 && e2 or e1 || e2, |
761 * where e, e1 and e2 are constant expressions that evaluate to a boolean | 724 * where e, e1 and e2 are constant expressions that evaluate to a boolean |
762 * value. | 725 * value. |
763 */ | 726 */ |
764 static const CompileTimeErrorCode CONST_EVAL_TYPE_BOOL = | 727 static const CompileTimeErrorCode CONST_EVAL_TYPE_BOOL = |
765 const CompileTimeErrorCode( | 728 const CompileTimeErrorCode( |
766 'CONST_EVAL_TYPE_BOOL', | 729 'CONST_EVAL_TYPE_BOOL', "An expression of type 'bool' was expected"); |
767 "An expression of type 'bool' was expected"); | |
768 | 730 |
769 /** | 731 /** |
770 * 12.11.2 Const: An expression of one of the forms e1 == e2 or e1 != e2 where | 732 * 12.11.2 Const: An expression of one of the forms e1 == e2 or e1 != e2 where |
771 * e1 and e2 are constant expressions that evaluate to a numeric, string or | 733 * e1 and e2 are constant expressions that evaluate to a numeric, string or |
772 * boolean value or to null. | 734 * boolean value or to null. |
773 */ | 735 */ |
774 static const CompileTimeErrorCode CONST_EVAL_TYPE_BOOL_NUM_STRING = | 736 static const CompileTimeErrorCode CONST_EVAL_TYPE_BOOL_NUM_STRING = |
775 const CompileTimeErrorCode( | 737 const CompileTimeErrorCode('CONST_EVAL_TYPE_BOOL_NUM_STRING', |
776 'CONST_EVAL_TYPE_BOOL_NUM_STRING', | |
777 "An expression of type 'bool', 'num', 'String' or 'null' was expected"
); | 738 "An expression of type 'bool', 'num', 'String' or 'null' was expected"
); |
778 | 739 |
779 /** | 740 /** |
780 * 12.11.2 Const: An expression of one of the forms ~e, e1 ^ e2, e1 & e2, | 741 * 12.11.2 Const: An expression of one of the forms ~e, e1 ^ e2, e1 & e2, |
781 * e1 | e2, e1 >> e2 or e1 << e2, where e, e1 and e2 are constant expressions | 742 * e1 | e2, e1 >> e2 or e1 << e2, where e, e1 and e2 are constant expressions |
782 * that evaluate to an integer value or to null. | 743 * that evaluate to an integer value or to null. |
783 */ | 744 */ |
784 static const CompileTimeErrorCode CONST_EVAL_TYPE_INT = | 745 static const CompileTimeErrorCode CONST_EVAL_TYPE_INT = |
785 const CompileTimeErrorCode( | 746 const CompileTimeErrorCode( |
786 'CONST_EVAL_TYPE_INT', | 747 'CONST_EVAL_TYPE_INT', "An expression of type 'int' was expected"); |
787 "An expression of type 'int' was expected"); | |
788 | 748 |
789 /** | 749 /** |
790 * 12.11.2 Const: An expression of one of the forms e, e1 + e2, e1 - e2, e1 * | 750 * 12.11.2 Const: An expression of one of the forms e, e1 + e2, e1 - e2, e1 * |
791 * e2, e1 / e2, e1 ~/ e2, e1 > e2, e1 < e2, e1 >= e2, e1 <= e2 or e1 % e2, | 751 * e2, e1 / e2, e1 ~/ e2, e1 > e2, e1 < e2, e1 >= e2, e1 <= e2 or e1 % e2, |
792 * where e, e1 and e2 are constant expressions that evaluate to a numeric | 752 * where e, e1 and e2 are constant expressions that evaluate to a numeric |
793 * value or to null. | 753 * value or to null. |
794 */ | 754 */ |
795 static const CompileTimeErrorCode CONST_EVAL_TYPE_NUM = | 755 static const CompileTimeErrorCode CONST_EVAL_TYPE_NUM = |
796 const CompileTimeErrorCode( | 756 const CompileTimeErrorCode( |
797 'CONST_EVAL_TYPE_NUM', | 757 'CONST_EVAL_TYPE_NUM', "An expression of type 'num' was expected"); |
798 "An expression of type 'num' was expected"); | |
799 | 758 |
800 /** | 759 /** |
801 * 12.11.2 Const: It is a compile-time error if evaluation of a constant | 760 * 12.11.2 Const: It is a compile-time error if evaluation of a constant |
802 * object results in an uncaught exception being thrown. | 761 * object results in an uncaught exception being thrown. |
803 */ | 762 */ |
804 static const CompileTimeErrorCode CONST_EVAL_THROWS_EXCEPTION = | 763 static const CompileTimeErrorCode CONST_EVAL_THROWS_EXCEPTION = |
805 const CompileTimeErrorCode( | 764 const CompileTimeErrorCode('CONST_EVAL_THROWS_EXCEPTION', |
806 'CONST_EVAL_THROWS_EXCEPTION', | |
807 "Evaluation of this constant expression causes exception"); | 765 "Evaluation of this constant expression causes exception"); |
808 | 766 |
809 /** | 767 /** |
810 * 12.11.2 Const: It is a compile-time error if evaluation of a constant | 768 * 12.11.2 Const: It is a compile-time error if evaluation of a constant |
811 * object results in an uncaught exception being thrown. | 769 * object results in an uncaught exception being thrown. |
812 */ | 770 */ |
813 static const CompileTimeErrorCode CONST_EVAL_THROWS_IDBZE = | 771 static const CompileTimeErrorCode CONST_EVAL_THROWS_IDBZE = |
814 const CompileTimeErrorCode( | 772 const CompileTimeErrorCode('CONST_EVAL_THROWS_IDBZE', |
815 'CONST_EVAL_THROWS_IDBZE', | |
816 "Evaluation of this constant expression throws IntegerDivisionByZeroEx
ception"); | 773 "Evaluation of this constant expression throws IntegerDivisionByZeroEx
ception"); |
817 | 774 |
818 /** | 775 /** |
819 * 12.11.2 Const: If <i>T</i> is a parameterized type <i>S<U<sub>1</sub>, | 776 * 12.11.2 Const: If <i>T</i> is a parameterized type <i>S<U<sub>1</sub>, |
820 * …, U<sub>m</sub>></i>, let <i>R = S</i>; It is a compile time | 777 * …, U<sub>m</sub>></i>, let <i>R = S</i>; It is a compile time |
821 * error if <i>S</i> is not a generic type with <i>m</i> type parameters. | 778 * error if <i>S</i> is not a generic type with <i>m</i> type parameters. |
822 * | 779 * |
823 * @param typeName the name of the type being referenced (<i>S</i>) | 780 * @param typeName the name of the type being referenced (<i>S</i>) |
824 * @param parameterCount the number of type parameters that were declared | 781 * @param parameterCount the number of type parameters that were declared |
825 * @param argumentCount the number of type arguments provided | 782 * @param argumentCount the number of type arguments provided |
826 * See [CompileTimeErrorCode.NEW_WITH_INVALID_TYPE_PARAMETERS], and | 783 * See [CompileTimeErrorCode.NEW_WITH_INVALID_TYPE_PARAMETERS], and |
827 * [StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]. | 784 * [StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]. |
828 */ | 785 */ |
829 static const CompileTimeErrorCode CONST_WITH_INVALID_TYPE_PARAMETERS = | 786 static const CompileTimeErrorCode CONST_WITH_INVALID_TYPE_PARAMETERS = |
830 const CompileTimeErrorCode( | 787 const CompileTimeErrorCode('CONST_WITH_INVALID_TYPE_PARAMETERS', |
831 'CONST_WITH_INVALID_TYPE_PARAMETERS', | |
832 "The type '{0}' is declared with {1} type parameters, but {2} type arg
uments were given"); | 788 "The type '{0}' is declared with {1} type parameters, but {2} type arg
uments were given"); |
833 | 789 |
834 /** | 790 /** |
835 * 12.11.2 Const: If <i>e</i> is of the form <i>const T(a<sub>1</sub>, | 791 * 12.11.2 Const: If <i>e</i> is of the form <i>const T(a<sub>1</sub>, |
836 * …, a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n+1</sub>, …, | 792 * …, a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n+1</sub>, …, |
837 * x<sub>n+k</sub>: a<sub>n+k</sub>)</i> it is a compile-time error if the | 793 * x<sub>n+k</sub>: a<sub>n+k</sub>)</i> it is a compile-time error if the |
838 * type <i>T</i> does not declare a constant constructor with the same name as | 794 * type <i>T</i> does not declare a constant constructor with the same name as |
839 * the declaration of <i>T</i>. | 795 * the declaration of <i>T</i>. |
840 */ | 796 */ |
841 static const CompileTimeErrorCode CONST_WITH_NON_CONST = | 797 static const CompileTimeErrorCode CONST_WITH_NON_CONST = |
842 const CompileTimeErrorCode( | 798 const CompileTimeErrorCode('CONST_WITH_NON_CONST', |
843 'CONST_WITH_NON_CONST', | |
844 "The constructor being called is not a 'const' constructor"); | 799 "The constructor being called is not a 'const' constructor"); |
845 | 800 |
846 /** | 801 /** |
847 * 12.11.2 Const: In all of the above cases, it is a compile-time error if | 802 * 12.11.2 Const: In all of the above cases, it is a compile-time error if |
848 * <i>a<sub>i</sub>, 1 <= i <= n + k</i>, is not a compile-time constant | 803 * <i>a<sub>i</sub>, 1 <= i <= n + k</i>, is not a compile-time constant |
849 * expression. | 804 * expression. |
850 */ | 805 */ |
851 static const CompileTimeErrorCode CONST_WITH_NON_CONSTANT_ARGUMENT = | 806 static const CompileTimeErrorCode CONST_WITH_NON_CONSTANT_ARGUMENT = |
852 const CompileTimeErrorCode( | 807 const CompileTimeErrorCode('CONST_WITH_NON_CONSTANT_ARGUMENT', |
853 'CONST_WITH_NON_CONSTANT_ARGUMENT', | |
854 "Arguments of a constant creation must be constant expressions"); | 808 "Arguments of a constant creation must be constant expressions"); |
855 | 809 |
856 /** | 810 /** |
857 * 12.11.2 Const: It is a compile-time error if <i>T</i> is not a class | 811 * 12.11.2 Const: It is a compile-time error if <i>T</i> is not a class |
858 * accessible in the current scope, optionally followed by type arguments. | 812 * accessible in the current scope, optionally followed by type arguments. |
859 * | 813 * |
860 * 12.11.2 Const: If <i>e</i> is of the form <i>const T.id(a<sub>1</sub>, | 814 * 12.11.2 Const: If <i>e</i> is of the form <i>const T.id(a<sub>1</sub>, |
861 * …, a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n+1</sub>, … | 815 * …, a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n+1</sub>, … |
862 * x<sub>n+k</sub>: a<sub>n+k</sub>)</i> it is a compile-time error if | 816 * x<sub>n+k</sub>: a<sub>n+k</sub>)</i> it is a compile-time error if |
863 * <i>T</i> is not a class accessible in the current scope, optionally | 817 * <i>T</i> is not a class accessible in the current scope, optionally |
864 * followed by type arguments. | 818 * followed by type arguments. |
865 * | 819 * |
866 * @param name the name of the non-type element | 820 * @param name the name of the non-type element |
867 */ | 821 */ |
868 static const CompileTimeErrorCode CONST_WITH_NON_TYPE = | 822 static const CompileTimeErrorCode CONST_WITH_NON_TYPE = |
869 const CompileTimeErrorCode( | 823 const CompileTimeErrorCode( |
870 'CONST_WITH_NON_TYPE', | 824 'CONST_WITH_NON_TYPE', "The name '{0}' is not a class"); |
871 "The name '{0}' is not a class"); | |
872 | 825 |
873 /** | 826 /** |
874 * 12.11.2 Const: It is a compile-time error if <i>T</i> includes any type | 827 * 12.11.2 Const: It is a compile-time error if <i>T</i> includes any type |
875 * parameters. | 828 * parameters. |
876 */ | 829 */ |
877 static const CompileTimeErrorCode CONST_WITH_TYPE_PARAMETERS = | 830 static const CompileTimeErrorCode CONST_WITH_TYPE_PARAMETERS = |
878 const CompileTimeErrorCode( | 831 const CompileTimeErrorCode('CONST_WITH_TYPE_PARAMETERS', |
879 'CONST_WITH_TYPE_PARAMETERS', | |
880 "The constant creation cannot use a type parameter"); | 832 "The constant creation cannot use a type parameter"); |
881 | 833 |
882 /** | 834 /** |
883 * 12.11.2 Const: It is a compile-time error if <i>T.id</i> is not the name of | 835 * 12.11.2 Const: It is a compile-time error if <i>T.id</i> is not the name of |
884 * a constant constructor declared by the type <i>T</i>. | 836 * a constant constructor declared by the type <i>T</i>. |
885 * | 837 * |
886 * @param typeName the name of the type | 838 * @param typeName the name of the type |
887 * @param constructorName the name of the requested constant constructor | 839 * @param constructorName the name of the requested constant constructor |
888 */ | 840 */ |
889 static const CompileTimeErrorCode CONST_WITH_UNDEFINED_CONSTRUCTOR = | 841 static const CompileTimeErrorCode CONST_WITH_UNDEFINED_CONSTRUCTOR = |
890 const CompileTimeErrorCode( | 842 const CompileTimeErrorCode('CONST_WITH_UNDEFINED_CONSTRUCTOR', |
891 'CONST_WITH_UNDEFINED_CONSTRUCTOR', | |
892 "The class '{0}' does not have a constant constructor '{1}'"); | 843 "The class '{0}' does not have a constant constructor '{1}'"); |
893 | 844 |
894 /** | 845 /** |
895 * 12.11.2 Const: It is a compile-time error if <i>T.id</i> is not the name of | 846 * 12.11.2 Const: It is a compile-time error if <i>T.id</i> is not the name of |
896 * a constant constructor declared by the type <i>T</i>. | 847 * a constant constructor declared by the type <i>T</i>. |
897 * | 848 * |
898 * @param typeName the name of the type | 849 * @param typeName the name of the type |
899 */ | 850 */ |
900 static const CompileTimeErrorCode CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT = | 851 static const CompileTimeErrorCode CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT = |
901 const CompileTimeErrorCode( | 852 const CompileTimeErrorCode('CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT', |
902 'CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT', | |
903 "The class '{0}' does not have a default constant constructor"); | 853 "The class '{0}' does not have a default constant constructor"); |
904 | 854 |
905 /** | 855 /** |
906 * 15.3.1 Typedef: It is a compile-time error if any default values are | 856 * 15.3.1 Typedef: It is a compile-time error if any default values are |
907 * specified in the signature of a function type alias. | 857 * specified in the signature of a function type alias. |
908 */ | 858 */ |
909 static const CompileTimeErrorCode DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS = | 859 static const CompileTimeErrorCode DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS = |
910 const CompileTimeErrorCode( | 860 const CompileTimeErrorCode('DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS', |
911 'DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS', | |
912 "Default values aren't allowed in typedefs"); | 861 "Default values aren't allowed in typedefs"); |
913 | 862 |
914 /** | 863 /** |
915 * 6.2.1 Required Formals: By means of a function signature that names the | 864 * 6.2.1 Required Formals: By means of a function signature that names the |
916 * parameter and describes its type as a function type. It is a compile-time | 865 * parameter and describes its type as a function type. It is a compile-time |
917 * error if any default values are specified in the signature of such a | 866 * error if any default values are specified in the signature of such a |
918 * function type. | 867 * function type. |
919 */ | 868 */ |
920 static const CompileTimeErrorCode DEFAULT_VALUE_IN_FUNCTION_TYPED_PARAMETER = | 869 static const CompileTimeErrorCode DEFAULT_VALUE_IN_FUNCTION_TYPED_PARAMETER = |
921 const CompileTimeErrorCode( | 870 const CompileTimeErrorCode('DEFAULT_VALUE_IN_FUNCTION_TYPED_PARAMETER', |
922 'DEFAULT_VALUE_IN_FUNCTION_TYPED_PARAMETER', | |
923 "Default values aren't allowed in function type parameters"); | 871 "Default values aren't allowed in function type parameters"); |
924 | 872 |
925 /** | 873 /** |
926 * 7.6.2 Factories: It is a compile-time error if <i>k</i> explicitly | 874 * 7.6.2 Factories: It is a compile-time error if <i>k</i> explicitly |
927 * specifies a default value for an optional parameter. | 875 * specifies a default value for an optional parameter. |
928 */ | 876 */ |
929 static const CompileTimeErrorCode | 877 static const CompileTimeErrorCode DEFAULT_VALUE_IN_REDIRECTING_FACTORY_CONSTRU
CTOR = |
930 DEFAULT_VALUE_IN_REDIRECTING_FACTORY_CONSTRUCTOR = | |
931 const CompileTimeErrorCode( | 878 const CompileTimeErrorCode( |
932 'DEFAULT_VALUE_IN_REDIRECTING_FACTORY_CONSTRUCTOR', | 879 'DEFAULT_VALUE_IN_REDIRECTING_FACTORY_CONSTRUCTOR', |
933 "Default values aren't allowed in factory constructors that redirect t
o another constructor"); | 880 "Default values aren't allowed in factory constructors that redirect t
o another constructor"); |
934 | 881 |
935 /** | 882 /** |
936 * 3.1 Scoping: It is a compile-time error if there is more than one entity | 883 * 3.1 Scoping: It is a compile-time error if there is more than one entity |
937 * with the same name declared in the same scope. | 884 * with the same name declared in the same scope. |
938 */ | 885 */ |
939 static const CompileTimeErrorCode DUPLICATE_CONSTRUCTOR_DEFAULT = | 886 static const CompileTimeErrorCode DUPLICATE_CONSTRUCTOR_DEFAULT = |
940 const CompileTimeErrorCode( | 887 const CompileTimeErrorCode('DUPLICATE_CONSTRUCTOR_DEFAULT', |
941 'DUPLICATE_CONSTRUCTOR_DEFAULT', | |
942 "The default constructor is already defined"); | 888 "The default constructor is already defined"); |
943 | 889 |
944 /** | 890 /** |
945 * 3.1 Scoping: It is a compile-time error if there is more than one entity | 891 * 3.1 Scoping: It is a compile-time error if there is more than one entity |
946 * with the same name declared in the same scope. | 892 * with the same name declared in the same scope. |
947 * | 893 * |
948 * @param duplicateName the name of the duplicate entity | 894 * @param duplicateName the name of the duplicate entity |
949 */ | 895 */ |
950 static const CompileTimeErrorCode DUPLICATE_CONSTRUCTOR_NAME = | 896 static const CompileTimeErrorCode DUPLICATE_CONSTRUCTOR_NAME = |
951 const CompileTimeErrorCode( | 897 const CompileTimeErrorCode('DUPLICATE_CONSTRUCTOR_NAME', |
952 'DUPLICATE_CONSTRUCTOR_NAME', | |
953 "The constructor with name '{0}' is already defined"); | 898 "The constructor with name '{0}' is already defined"); |
954 | 899 |
955 /** | 900 /** |
956 * 3.1 Scoping: It is a compile-time error if there is more than one entity | 901 * 3.1 Scoping: It is a compile-time error if there is more than one entity |
957 * with the same name declared in the same scope. | 902 * with the same name declared in the same scope. |
958 * | 903 * |
959 * 7 Classes: It is a compile-time error if a class declares two members of | 904 * 7 Classes: It is a compile-time error if a class declares two members of |
960 * the same name. | 905 * the same name. |
961 * | 906 * |
962 * 7 Classes: It is a compile-time error if a class has an instance member and | 907 * 7 Classes: It is a compile-time error if a class has an instance member and |
963 * a static member with the same name. | 908 * a static member with the same name. |
964 * | 909 * |
965 * @param duplicateName the name of the duplicate entity | 910 * @param duplicateName the name of the duplicate entity |
966 */ | 911 */ |
967 static const CompileTimeErrorCode DUPLICATE_DEFINITION = | 912 static const CompileTimeErrorCode DUPLICATE_DEFINITION = |
968 const CompileTimeErrorCode( | 913 const CompileTimeErrorCode( |
969 'DUPLICATE_DEFINITION', | 914 'DUPLICATE_DEFINITION', "The name '{0}' is already defined"); |
970 "The name '{0}' is already defined"); | |
971 | 915 |
972 /** | 916 /** |
973 * 7. Classes: It is a compile-time error if a class has an instance member | 917 * 7. Classes: It is a compile-time error if a class has an instance member |
974 * and a static member with the same name. | 918 * and a static member with the same name. |
975 * | 919 * |
976 * This covers the additional duplicate definition cases where inheritance has | 920 * This covers the additional duplicate definition cases where inheritance has |
977 * to be considered. | 921 * to be considered. |
978 * | 922 * |
979 * @param className the name of the class that has conflicting instance/static | 923 * @param className the name of the class that has conflicting instance/static |
980 * members | 924 * members |
981 * @param name the name of the conflicting members | 925 * @param name the name of the conflicting members |
982 * See [DUPLICATE_DEFINITION]. | 926 * See [DUPLICATE_DEFINITION]. |
983 */ | 927 */ |
984 static const CompileTimeErrorCode DUPLICATE_DEFINITION_INHERITANCE = | 928 static const CompileTimeErrorCode DUPLICATE_DEFINITION_INHERITANCE = |
985 const CompileTimeErrorCode( | 929 const CompileTimeErrorCode('DUPLICATE_DEFINITION_INHERITANCE', |
986 'DUPLICATE_DEFINITION_INHERITANCE', | |
987 "The name '{0}' is already defined in '{1}'"); | 930 "The name '{0}' is already defined in '{1}'"); |
988 | 931 |
989 /** | 932 /** |
990 * 12.14.2 Binding Actuals to Formals: It is a compile-time error if | 933 * 12.14.2 Binding Actuals to Formals: It is a compile-time error if |
991 * <i>q<sub>i</sub> = q<sub>j</sub></i> for any <i>i != j</i> [where | 934 * <i>q<sub>i</sub> = q<sub>j</sub></i> for any <i>i != j</i> [where |
992 * <i>q<sub>i</sub></i> is the label for a named argument]. | 935 * <i>q<sub>i</sub></i> is the label for a named argument]. |
993 */ | 936 */ |
994 static const CompileTimeErrorCode DUPLICATE_NAMED_ARGUMENT = | 937 static const CompileTimeErrorCode DUPLICATE_NAMED_ARGUMENT = |
995 const CompileTimeErrorCode( | 938 const CompileTimeErrorCode('DUPLICATE_NAMED_ARGUMENT', |
996 'DUPLICATE_NAMED_ARGUMENT', | |
997 "The argument for the named parameter '{0}' was already specified"); | 939 "The argument for the named parameter '{0}' was already specified"); |
998 | 940 |
999 /** | 941 /** |
1000 * SDK implementation libraries can be exported only by other SDK libraries. | 942 * SDK implementation libraries can be exported only by other SDK libraries. |
1001 * | 943 * |
1002 * @param uri the uri pointing to a library | 944 * @param uri the uri pointing to a library |
1003 */ | 945 */ |
1004 static const CompileTimeErrorCode EXPORT_INTERNAL_LIBRARY = | 946 static const CompileTimeErrorCode EXPORT_INTERNAL_LIBRARY = |
1005 const CompileTimeErrorCode( | 947 const CompileTimeErrorCode('EXPORT_INTERNAL_LIBRARY', |
1006 'EXPORT_INTERNAL_LIBRARY', | |
1007 "The library '{0}' is internal and cannot be exported"); | 948 "The library '{0}' is internal and cannot be exported"); |
1008 | 949 |
1009 /** | 950 /** |
1010 * 14.2 Exports: It is a compile-time error if the compilation unit found at | 951 * 14.2 Exports: It is a compile-time error if the compilation unit found at |
1011 * the specified URI is not a library declaration. | 952 * the specified URI is not a library declaration. |
1012 * | 953 * |
1013 * @param uri the uri pointing to a non-library declaration | 954 * @param uri the uri pointing to a non-library declaration |
1014 */ | 955 */ |
1015 static const CompileTimeErrorCode EXPORT_OF_NON_LIBRARY = | 956 static const CompileTimeErrorCode EXPORT_OF_NON_LIBRARY = |
1016 const CompileTimeErrorCode( | 957 const CompileTimeErrorCode('EXPORT_OF_NON_LIBRARY', |
1017 'EXPORT_OF_NON_LIBRARY', | |
1018 "The exported library '{0}' must not have a part-of directive"); | 958 "The exported library '{0}' must not have a part-of directive"); |
1019 | 959 |
1020 /** | 960 /** |
1021 * Enum proposal: It is a compile-time error to subclass, mix-in or implement | 961 * Enum proposal: It is a compile-time error to subclass, mix-in or implement |
1022 * an enum. | 962 * an enum. |
1023 */ | 963 */ |
1024 static const CompileTimeErrorCode EXTENDS_ENUM = | 964 static const CompileTimeErrorCode EXTENDS_ENUM = const CompileTimeErrorCode( |
1025 const CompileTimeErrorCode('EXTENDS_ENUM', "Classes cannot extend an enum"
); | 965 'EXTENDS_ENUM', "Classes cannot extend an enum"); |
1026 | 966 |
1027 /** | 967 /** |
1028 * 7.9 Superclasses: It is a compile-time error if the extends clause of a | 968 * 7.9 Superclasses: It is a compile-time error if the extends clause of a |
1029 * class <i>C</i> includes a type expression that does not denote a class | 969 * class <i>C</i> includes a type expression that does not denote a class |
1030 * available in the lexical scope of <i>C</i>. | 970 * available in the lexical scope of <i>C</i>. |
1031 * | 971 * |
1032 * @param typeName the name of the superclass that was not found | 972 * @param typeName the name of the superclass that was not found |
1033 */ | 973 */ |
1034 static const CompileTimeErrorCode EXTENDS_NON_CLASS = | 974 static const CompileTimeErrorCode EXTENDS_NON_CLASS = |
1035 const CompileTimeErrorCode( | 975 const CompileTimeErrorCode( |
1036 'EXTENDS_NON_CLASS', | 976 'EXTENDS_NON_CLASS', "Classes can only extend other classes"); |
1037 "Classes can only extend other classes"); | |
1038 | 977 |
1039 /** | 978 /** |
1040 * 12.2 Null: It is a compile-time error for a class to attempt to extend or | 979 * 12.2 Null: It is a compile-time error for a class to attempt to extend or |
1041 * implement Null. | 980 * implement Null. |
1042 * | 981 * |
1043 * 12.3 Numbers: It is a compile-time error for a class to attempt to extend | 982 * 12.3 Numbers: It is a compile-time error for a class to attempt to extend |
1044 * or implement int. | 983 * or implement int. |
1045 * | 984 * |
1046 * 12.3 Numbers: It is a compile-time error for a class to attempt to extend | 985 * 12.3 Numbers: It is a compile-time error for a class to attempt to extend |
1047 * or implement double. | 986 * or implement double. |
1048 * | 987 * |
1049 * 12.3 Numbers: It is a compile-time error for any type other than the types | 988 * 12.3 Numbers: It is a compile-time error for any type other than the types |
1050 * int and double to | 989 * int and double to |
1051 * attempt to extend or implement num. | 990 * attempt to extend or implement num. |
1052 * | 991 * |
1053 * 12.4 Booleans: It is a compile-time error for a class to attempt to extend | 992 * 12.4 Booleans: It is a compile-time error for a class to attempt to extend |
1054 * or implement bool. | 993 * or implement bool. |
1055 * | 994 * |
1056 * 12.5 Strings: It is a compile-time error for a class to attempt to extend | 995 * 12.5 Strings: It is a compile-time error for a class to attempt to extend |
1057 * or implement String. | 996 * or implement String. |
1058 * | 997 * |
1059 * @param typeName the name of the type that cannot be extended | 998 * @param typeName the name of the type that cannot be extended |
1060 * See [IMPLEMENTS_DISALLOWED_CLASS]. | 999 * See [IMPLEMENTS_DISALLOWED_CLASS]. |
1061 */ | 1000 */ |
1062 static const CompileTimeErrorCode EXTENDS_DISALLOWED_CLASS = | 1001 static const CompileTimeErrorCode EXTENDS_DISALLOWED_CLASS = |
1063 const CompileTimeErrorCode( | 1002 const CompileTimeErrorCode( |
1064 'EXTENDS_DISALLOWED_CLASS', | 1003 'EXTENDS_DISALLOWED_CLASS', "Classes cannot extend '{0}'"); |
1065 "Classes cannot extend '{0}'"); | |
1066 | 1004 |
1067 /** | 1005 /** |
1068 * 7.9 Superclasses: It is a compile-time error if the extends clause of a | 1006 * 7.9 Superclasses: It is a compile-time error if the extends clause of a |
1069 * class <i>C</i> includes a deferred type expression. | 1007 * class <i>C</i> includes a deferred type expression. |
1070 * | 1008 * |
1071 * @param typeName the name of the type that cannot be extended | 1009 * @param typeName the name of the type that cannot be extended |
1072 * See [IMPLEMENTS_DEFERRED_CLASS], and [MIXIN_DEFERRED_CLASS]. | 1010 * See [IMPLEMENTS_DEFERRED_CLASS], and [MIXIN_DEFERRED_CLASS]. |
1073 */ | 1011 */ |
1074 static const CompileTimeErrorCode EXTENDS_DEFERRED_CLASS = | 1012 static const CompileTimeErrorCode EXTENDS_DEFERRED_CLASS = |
1075 const CompileTimeErrorCode( | 1013 const CompileTimeErrorCode('EXTENDS_DEFERRED_CLASS', |
1076 'EXTENDS_DEFERRED_CLASS', | |
1077 "This class cannot extend the deferred class '{0}'"); | 1014 "This class cannot extend the deferred class '{0}'"); |
1078 | 1015 |
1079 /** | 1016 /** |
1080 * 12.14.2 Binding Actuals to Formals: It is a static warning if <i>m < | 1017 * 12.14.2 Binding Actuals to Formals: It is a static warning if <i>m < |
1081 * h</i> or if <i>m > n</i>. | 1018 * h</i> or if <i>m > n</i>. |
1082 * | 1019 * |
1083 * 12.11.2 Const: It is a compile-time error if evaluation of a constant | 1020 * 12.11.2 Const: It is a compile-time error if evaluation of a constant |
1084 * object results in an uncaught exception being thrown. | 1021 * object results in an uncaught exception being thrown. |
1085 * | 1022 * |
1086 * @param requiredCount the maximum number of positional arguments | 1023 * @param requiredCount the maximum number of positional arguments |
1087 * @param argumentCount the actual number of positional arguments given | 1024 * @param argumentCount the actual number of positional arguments given |
1088 */ | 1025 */ |
1089 static const CompileTimeErrorCode EXTRA_POSITIONAL_ARGUMENTS = | 1026 static const CompileTimeErrorCode EXTRA_POSITIONAL_ARGUMENTS = |
1090 const CompileTimeErrorCode( | 1027 const CompileTimeErrorCode('EXTRA_POSITIONAL_ARGUMENTS', |
1091 'EXTRA_POSITIONAL_ARGUMENTS', | |
1092 "{0} positional arguments expected, but {1} found"); | 1028 "{0} positional arguments expected, but {1} found"); |
1093 | 1029 |
1094 /** | 1030 /** |
1095 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It | 1031 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It |
1096 * is a compile time error if more than one initializer corresponding to a | 1032 * is a compile time error if more than one initializer corresponding to a |
1097 * given instance variable appears in <i>k</i>'s list. | 1033 * given instance variable appears in <i>k</i>'s list. |
1098 */ | 1034 */ |
1099 static const CompileTimeErrorCode FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS = | 1035 static const CompileTimeErrorCode FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS = |
1100 const CompileTimeErrorCode( | 1036 const CompileTimeErrorCode('FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS', |
1101 'FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS', | |
1102 "The field '{0}' cannot be initialized twice in the same constructor")
; | 1037 "The field '{0}' cannot be initialized twice in the same constructor")
; |
1103 | 1038 |
1104 /** | 1039 /** |
1105 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It | 1040 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It |
1106 * is a compile time error if <i>k</i>'s initializer list contains an | 1041 * is a compile time error if <i>k</i>'s initializer list contains an |
1107 * initializer for a variable that is initialized by means of an initializing | 1042 * initializer for a variable that is initialized by means of an initializing |
1108 * formal of <i>k</i>. | 1043 * formal of <i>k</i>. |
1109 */ | 1044 */ |
1110 static const CompileTimeErrorCode | 1045 static const CompileTimeErrorCode FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZ
ER = |
1111 FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER = | |
1112 const CompileTimeErrorCode( | 1046 const CompileTimeErrorCode( |
1113 'FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER', | 1047 'FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER', |
1114 "Fields cannot be initialized in both the parameter list and the initi
alizers"); | 1048 "Fields cannot be initialized in both the parameter list and the initi
alizers"); |
1115 | 1049 |
1116 /** | 1050 /** |
1117 * 5 Variables: It is a compile-time error if a final instance variable that | 1051 * 5 Variables: It is a compile-time error if a final instance variable that |
1118 * has is initialized by means of an initializing formal of a constructor is | 1052 * has is initialized by means of an initializing formal of a constructor is |
1119 * also initialized elsewhere in the same constructor. | 1053 * also initialized elsewhere in the same constructor. |
1120 * | 1054 * |
1121 * @param name the name of the field in question | 1055 * @param name the name of the field in question |
1122 */ | 1056 */ |
1123 static const CompileTimeErrorCode FINAL_INITIALIZED_MULTIPLE_TIMES = | 1057 static const CompileTimeErrorCode FINAL_INITIALIZED_MULTIPLE_TIMES = |
1124 const CompileTimeErrorCode( | 1058 const CompileTimeErrorCode('FINAL_INITIALIZED_MULTIPLE_TIMES', |
1125 'FINAL_INITIALIZED_MULTIPLE_TIMES', | |
1126 "'{0}' is a final field and so can only be set once"); | 1059 "'{0}' is a final field and so can only be set once"); |
1127 | 1060 |
1128 /** | 1061 /** |
1129 * 7.6.1 Generative Constructors: It is a compile-time error if an | 1062 * 7.6.1 Generative Constructors: It is a compile-time error if an |
1130 * initializing formal is used by a function other than a non-redirecting | 1063 * initializing formal is used by a function other than a non-redirecting |
1131 * generative constructor. | 1064 * generative constructor. |
1132 */ | 1065 */ |
1133 static const CompileTimeErrorCode FIELD_INITIALIZER_FACTORY_CONSTRUCTOR = | 1066 static const CompileTimeErrorCode FIELD_INITIALIZER_FACTORY_CONSTRUCTOR = |
1134 const CompileTimeErrorCode( | 1067 const CompileTimeErrorCode('FIELD_INITIALIZER_FACTORY_CONSTRUCTOR', |
1135 'FIELD_INITIALIZER_FACTORY_CONSTRUCTOR', | |
1136 "Initializing formal fields cannot be used in factory constructors"); | 1068 "Initializing formal fields cannot be used in factory constructors"); |
1137 | 1069 |
1138 /** | 1070 /** |
1139 * 7.6.1 Generative Constructors: It is a compile-time error if an | 1071 * 7.6.1 Generative Constructors: It is a compile-time error if an |
1140 * initializing formal is used by a function other than a non-redirecting | 1072 * initializing formal is used by a function other than a non-redirecting |
1141 * generative constructor. | 1073 * generative constructor. |
1142 */ | 1074 */ |
1143 static const CompileTimeErrorCode FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR = | 1075 static const CompileTimeErrorCode FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR = |
1144 const CompileTimeErrorCode( | 1076 const CompileTimeErrorCode('FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR', |
1145 'FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR', | |
1146 "Initializing formal fields can only be used in constructors"); | 1077 "Initializing formal fields can only be used in constructors"); |
1147 | 1078 |
1148 /** | 1079 /** |
1149 * 7.6.1 Generative Constructors: A generative constructor may be redirecting, | 1080 * 7.6.1 Generative Constructors: A generative constructor may be redirecting, |
1150 * in which case its only action is to invoke another generative constructor. | 1081 * in which case its only action is to invoke another generative constructor. |
1151 * | 1082 * |
1152 * 7.6.1 Generative Constructors: It is a compile-time error if an | 1083 * 7.6.1 Generative Constructors: It is a compile-time error if an |
1153 * initializing formal is used by a function other than a non-redirecting | 1084 * initializing formal is used by a function other than a non-redirecting |
1154 * generative constructor. | 1085 * generative constructor. |
1155 */ | 1086 */ |
1156 static const CompileTimeErrorCode FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR = | 1087 static const CompileTimeErrorCode FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR = |
1157 const CompileTimeErrorCode( | 1088 const CompileTimeErrorCode('FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR', |
1158 'FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR', | |
1159 "The redirecting constructor cannot have a field initializer"); | 1089 "The redirecting constructor cannot have a field initializer"); |
1160 | 1090 |
1161 /** | 1091 /** |
1162 * 7.2 Getters: It is a compile-time error if a class has both a getter and a | 1092 * 7.2 Getters: It is a compile-time error if a class has both a getter and a |
1163 * method with the same name. | 1093 * method with the same name. |
1164 * | 1094 * |
1165 * @param name the conflicting name of the getter and method | 1095 * @param name the conflicting name of the getter and method |
1166 */ | 1096 */ |
1167 static const CompileTimeErrorCode GETTER_AND_METHOD_WITH_SAME_NAME = | 1097 static const CompileTimeErrorCode GETTER_AND_METHOD_WITH_SAME_NAME = |
1168 const CompileTimeErrorCode( | 1098 const CompileTimeErrorCode('GETTER_AND_METHOD_WITH_SAME_NAME', |
1169 'GETTER_AND_METHOD_WITH_SAME_NAME', | |
1170 "'{0}' cannot be used to name a getter, there is already a method with
the same name"); | 1099 "'{0}' cannot be used to name a getter, there is already a method with
the same name"); |
1171 | 1100 |
1172 /** | 1101 /** |
1173 * 7.10 Superinterfaces: It is a compile-time error if the implements clause | 1102 * 7.10 Superinterfaces: It is a compile-time error if the implements clause |
1174 * of a class <i>C</i> specifies a malformed type or deferred type as a | 1103 * of a class <i>C</i> specifies a malformed type or deferred type as a |
1175 * superinterface. | 1104 * superinterface. |
1176 * | 1105 * |
1177 * @param typeName the name of the type that cannot be extended | 1106 * @param typeName the name of the type that cannot be extended |
1178 * See [EXTENDS_DEFERRED_CLASS], and [MIXIN_DEFERRED_CLASS]. | 1107 * See [EXTENDS_DEFERRED_CLASS], and [MIXIN_DEFERRED_CLASS]. |
1179 */ | 1108 */ |
1180 static const CompileTimeErrorCode IMPLEMENTS_DEFERRED_CLASS = | 1109 static const CompileTimeErrorCode IMPLEMENTS_DEFERRED_CLASS = |
1181 const CompileTimeErrorCode( | 1110 const CompileTimeErrorCode('IMPLEMENTS_DEFERRED_CLASS', |
1182 'IMPLEMENTS_DEFERRED_CLASS', | |
1183 "This class cannot implement the deferred class '{0}'"); | 1111 "This class cannot implement the deferred class '{0}'"); |
1184 | 1112 |
1185 /** | 1113 /** |
1186 * 12.2 Null: It is a compile-time error for a class to attempt to extend or | 1114 * 12.2 Null: It is a compile-time error for a class to attempt to extend or |
1187 * implement Null. | 1115 * implement Null. |
1188 * | 1116 * |
1189 * 12.3 Numbers: It is a compile-time error for a class to attempt to extend | 1117 * 12.3 Numbers: It is a compile-time error for a class to attempt to extend |
1190 * or implement int. | 1118 * or implement int. |
1191 * | 1119 * |
1192 * 12.3 Numbers: It is a compile-time error for a class to attempt to extend | 1120 * 12.3 Numbers: It is a compile-time error for a class to attempt to extend |
1193 * or implement double. | 1121 * or implement double. |
1194 * | 1122 * |
1195 * 12.3 Numbers: It is a compile-time error for any type other than the types | 1123 * 12.3 Numbers: It is a compile-time error for any type other than the types |
1196 * int and double to | 1124 * int and double to |
1197 * attempt to extend or implement num. | 1125 * attempt to extend or implement num. |
1198 * | 1126 * |
1199 * 12.4 Booleans: It is a compile-time error for a class to attempt to extend | 1127 * 12.4 Booleans: It is a compile-time error for a class to attempt to extend |
1200 * or implement bool. | 1128 * or implement bool. |
1201 * | 1129 * |
1202 * 12.5 Strings: It is a compile-time error for a class to attempt to extend | 1130 * 12.5 Strings: It is a compile-time error for a class to attempt to extend |
1203 * or implement String. | 1131 * or implement String. |
1204 * | 1132 * |
1205 * @param typeName the name of the type that cannot be implemented | 1133 * @param typeName the name of the type that cannot be implemented |
1206 * See [EXTENDS_DISALLOWED_CLASS]. | 1134 * See [EXTENDS_DISALLOWED_CLASS]. |
1207 */ | 1135 */ |
1208 static const CompileTimeErrorCode IMPLEMENTS_DISALLOWED_CLASS = | 1136 static const CompileTimeErrorCode IMPLEMENTS_DISALLOWED_CLASS = |
1209 const CompileTimeErrorCode( | 1137 const CompileTimeErrorCode( |
1210 'IMPLEMENTS_DISALLOWED_CLASS', | 1138 'IMPLEMENTS_DISALLOWED_CLASS', "Classes cannot implement '{0}'"); |
1211 "Classes cannot implement '{0}'"); | |
1212 | 1139 |
1213 /** | 1140 /** |
1214 * 7.10 Superinterfaces: It is a compile-time error if the implements clause | 1141 * 7.10 Superinterfaces: It is a compile-time error if the implements clause |
1215 * of a class includes type dynamic. | 1142 * of a class includes type dynamic. |
1216 */ | 1143 */ |
1217 static const CompileTimeErrorCode IMPLEMENTS_DYNAMIC = | 1144 static const CompileTimeErrorCode IMPLEMENTS_DYNAMIC = |
1218 const CompileTimeErrorCode( | 1145 const CompileTimeErrorCode( |
1219 'IMPLEMENTS_DYNAMIC', | 1146 'IMPLEMENTS_DYNAMIC', "Classes cannot implement 'dynamic'"); |
1220 "Classes cannot implement 'dynamic'"); | |
1221 | 1147 |
1222 /** | 1148 /** |
1223 * Enum proposal: It is a compile-time error to subclass, mix-in or implement | 1149 * Enum proposal: It is a compile-time error to subclass, mix-in or implement |
1224 * an enum. | 1150 * an enum. |
1225 */ | 1151 */ |
1226 static const CompileTimeErrorCode IMPLEMENTS_ENUM = | 1152 static const CompileTimeErrorCode IMPLEMENTS_ENUM = |
1227 const CompileTimeErrorCode( | 1153 const CompileTimeErrorCode( |
1228 'IMPLEMENTS_ENUM', | 1154 'IMPLEMENTS_ENUM', "Classes cannot implement an enum"); |
1229 "Classes cannot implement an enum"); | |
1230 | 1155 |
1231 /** | 1156 /** |
1232 * 7.10 Superinterfaces: It is a compile-time error if the implements clause | 1157 * 7.10 Superinterfaces: It is a compile-time error if the implements clause |
1233 * of a class <i>C</i> includes a type expression that does not denote a class | 1158 * of a class <i>C</i> includes a type expression that does not denote a class |
1234 * available in the lexical scope of <i>C</i>. | 1159 * available in the lexical scope of <i>C</i>. |
1235 * | 1160 * |
1236 * @param typeName the name of the interface that was not found | 1161 * @param typeName the name of the interface that was not found |
1237 */ | 1162 */ |
1238 static const CompileTimeErrorCode IMPLEMENTS_NON_CLASS = | 1163 static const CompileTimeErrorCode IMPLEMENTS_NON_CLASS = |
1239 const CompileTimeErrorCode( | 1164 const CompileTimeErrorCode( |
1240 'IMPLEMENTS_NON_CLASS', | 1165 'IMPLEMENTS_NON_CLASS', "Classes can only implement other classes"); |
1241 "Classes can only implement other classes"); | |
1242 | 1166 |
1243 /** | 1167 /** |
1244 * 7.10 Superinterfaces: It is a compile-time error if a type <i>T</i> appears | 1168 * 7.10 Superinterfaces: It is a compile-time error if a type <i>T</i> appears |
1245 * more than once in the implements clause of a class. | 1169 * more than once in the implements clause of a class. |
1246 * | 1170 * |
1247 * @param className the name of the class that is implemented more than once | 1171 * @param className the name of the class that is implemented more than once |
1248 */ | 1172 */ |
1249 static const CompileTimeErrorCode IMPLEMENTS_REPEATED = | 1173 static const CompileTimeErrorCode IMPLEMENTS_REPEATED = |
1250 const CompileTimeErrorCode( | 1174 const CompileTimeErrorCode( |
1251 'IMPLEMENTS_REPEATED', | 1175 'IMPLEMENTS_REPEATED', "'{0}' can only be implemented once"); |
1252 "'{0}' can only be implemented once"); | |
1253 | 1176 |
1254 /** | 1177 /** |
1255 * 7.10 Superinterfaces: It is a compile-time error if the superclass of a | 1178 * 7.10 Superinterfaces: It is a compile-time error if the superclass of a |
1256 * class <i>C</i> appears in the implements clause of <i>C</i>. | 1179 * class <i>C</i> appears in the implements clause of <i>C</i>. |
1257 * | 1180 * |
1258 * @param className the name of the class that appears in both "extends" and | 1181 * @param className the name of the class that appears in both "extends" and |
1259 * "implements" clauses | 1182 * "implements" clauses |
1260 */ | 1183 */ |
1261 static const CompileTimeErrorCode IMPLEMENTS_SUPER_CLASS = | 1184 static const CompileTimeErrorCode IMPLEMENTS_SUPER_CLASS = |
1262 const CompileTimeErrorCode( | 1185 const CompileTimeErrorCode('IMPLEMENTS_SUPER_CLASS', |
1263 'IMPLEMENTS_SUPER_CLASS', | |
1264 "'{0}' cannot be used in both 'extends' and 'implements' clauses"); | 1186 "'{0}' cannot be used in both 'extends' and 'implements' clauses"); |
1265 | 1187 |
1266 /** | 1188 /** |
1267 * 7.6.1 Generative Constructors: Note that <b>this</b> is not in scope on the | 1189 * 7.6.1 Generative Constructors: Note that <b>this</b> is not in scope on the |
1268 * right hand side of an initializer. | 1190 * right hand side of an initializer. |
1269 * | 1191 * |
1270 * 12.10 This: It is a compile-time error if this appears in a top-level | 1192 * 12.10 This: It is a compile-time error if this appears in a top-level |
1271 * function or variable initializer, in a factory constructor, or in a static | 1193 * function or variable initializer, in a factory constructor, or in a static |
1272 * method or variable initializer, or in the initializer of an instance | 1194 * method or variable initializer, or in the initializer of an instance |
1273 * variable. | 1195 * variable. |
1274 * | 1196 * |
1275 * @param name the name of the type in question | 1197 * @param name the name of the type in question |
1276 */ | 1198 */ |
1277 static const CompileTimeErrorCode IMPLICIT_THIS_REFERENCE_IN_INITIALIZER = | 1199 static const CompileTimeErrorCode IMPLICIT_THIS_REFERENCE_IN_INITIALIZER = |
1278 const CompileTimeErrorCode( | 1200 const CompileTimeErrorCode('IMPLICIT_THIS_REFERENCE_IN_INITIALIZER', |
1279 'IMPLICIT_THIS_REFERENCE_IN_INITIALIZER', | |
1280 "Only static members can be accessed in initializers"); | 1201 "Only static members can be accessed in initializers"); |
1281 | 1202 |
1282 /** | 1203 /** |
1283 * SDK implementation libraries can be imported only by other SDK libraries. | 1204 * SDK implementation libraries can be imported only by other SDK libraries. |
1284 * | 1205 * |
1285 * @param uri the uri pointing to a library | 1206 * @param uri the uri pointing to a library |
1286 */ | 1207 */ |
1287 static const CompileTimeErrorCode IMPORT_INTERNAL_LIBRARY = | 1208 static const CompileTimeErrorCode IMPORT_INTERNAL_LIBRARY = |
1288 const CompileTimeErrorCode( | 1209 const CompileTimeErrorCode('IMPORT_INTERNAL_LIBRARY', |
1289 'IMPORT_INTERNAL_LIBRARY', | |
1290 "The library '{0}' is internal and cannot be imported"); | 1210 "The library '{0}' is internal and cannot be imported"); |
1291 | 1211 |
1292 /** | 1212 /** |
1293 * 14.1 Imports: It is a compile-time error if the specified URI of an | 1213 * 14.1 Imports: It is a compile-time error if the specified URI of an |
1294 * immediate import does not refer to a library declaration. | 1214 * immediate import does not refer to a library declaration. |
1295 * | 1215 * |
1296 * @param uri the uri pointing to a non-library declaration | 1216 * @param uri the uri pointing to a non-library declaration |
1297 * See [StaticWarningCode.IMPORT_OF_NON_LIBRARY]. | 1217 * See [StaticWarningCode.IMPORT_OF_NON_LIBRARY]. |
1298 */ | 1218 */ |
1299 static const CompileTimeErrorCode IMPORT_OF_NON_LIBRARY = | 1219 static const CompileTimeErrorCode IMPORT_OF_NON_LIBRARY = |
1300 const CompileTimeErrorCode( | 1220 const CompileTimeErrorCode('IMPORT_OF_NON_LIBRARY', |
1301 'IMPORT_OF_NON_LIBRARY', | |
1302 "The imported library '{0}' must not have a part-of directive"); | 1221 "The imported library '{0}' must not have a part-of directive"); |
1303 | 1222 |
1304 /** | 1223 /** |
1305 * 13.9 Switch: It is a compile-time error if values of the expressions | 1224 * 13.9 Switch: It is a compile-time error if values of the expressions |
1306 * <i>e<sub>k</sub></i> are not instances of the same class <i>C</i>, for all | 1225 * <i>e<sub>k</sub></i> are not instances of the same class <i>C</i>, for all |
1307 * <i>1 <= k <= n</i>. | 1226 * <i>1 <= k <= n</i>. |
1308 * | 1227 * |
1309 * @param expressionSource the expression source code that is the unexpected | 1228 * @param expressionSource the expression source code that is the unexpected |
1310 * type | 1229 * type |
1311 * @param expectedType the name of the expected type | 1230 * @param expectedType the name of the expected type |
1312 */ | 1231 */ |
1313 static const CompileTimeErrorCode INCONSISTENT_CASE_EXPRESSION_TYPES = | 1232 static const CompileTimeErrorCode INCONSISTENT_CASE_EXPRESSION_TYPES = |
1314 const CompileTimeErrorCode( | 1233 const CompileTimeErrorCode('INCONSISTENT_CASE_EXPRESSION_TYPES', |
1315 'INCONSISTENT_CASE_EXPRESSION_TYPES', | |
1316 "Case expressions must have the same types, '{0}' is not a '{1}'"); | 1234 "Case expressions must have the same types, '{0}' is not a '{1}'"); |
1317 | 1235 |
1318 /** | 1236 /** |
1319 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It | 1237 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It |
1320 * is a compile-time error if <i>k</i>'s initializer list contains an | 1238 * is a compile-time error if <i>k</i>'s initializer list contains an |
1321 * initializer for a variable that is not an instance variable declared in the | 1239 * initializer for a variable that is not an instance variable declared in the |
1322 * immediately surrounding class. | 1240 * immediately surrounding class. |
1323 * | 1241 * |
1324 * @param id the name of the initializing formal that is not an instance | 1242 * @param id the name of the initializing formal that is not an instance |
1325 * variable in the immediately enclosing class | 1243 * variable in the immediately enclosing class |
1326 * See [INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD]. | 1244 * See [INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD]. |
1327 */ | 1245 */ |
1328 static const CompileTimeErrorCode INITIALIZER_FOR_NON_EXISTENT_FIELD = | 1246 static const CompileTimeErrorCode INITIALIZER_FOR_NON_EXISTENT_FIELD = |
1329 const CompileTimeErrorCode( | 1247 const CompileTimeErrorCode('INITIALIZER_FOR_NON_EXISTENT_FIELD', |
1330 'INITIALIZER_FOR_NON_EXISTENT_FIELD', | |
1331 "'{0}' is not a variable in the enclosing class"); | 1248 "'{0}' is not a variable in the enclosing class"); |
1332 | 1249 |
1333 /** | 1250 /** |
1334 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It | 1251 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It |
1335 * is a compile-time error if <i>k</i>'s initializer list contains an | 1252 * is a compile-time error if <i>k</i>'s initializer list contains an |
1336 * initializer for a variable that is not an instance variable declared in the | 1253 * initializer for a variable that is not an instance variable declared in the |
1337 * immediately surrounding class. | 1254 * immediately surrounding class. |
1338 * | 1255 * |
1339 * @param id the name of the initializing formal that is a static variable in | 1256 * @param id the name of the initializing formal that is a static variable in |
1340 * the immediately enclosing class | 1257 * the immediately enclosing class |
1341 * See [INITIALIZING_FORMAL_FOR_STATIC_FIELD]. | 1258 * See [INITIALIZING_FORMAL_FOR_STATIC_FIELD]. |
1342 */ | 1259 */ |
1343 static const CompileTimeErrorCode INITIALIZER_FOR_STATIC_FIELD = | 1260 static const CompileTimeErrorCode INITIALIZER_FOR_STATIC_FIELD = |
1344 const CompileTimeErrorCode( | 1261 const CompileTimeErrorCode('INITIALIZER_FOR_STATIC_FIELD', |
1345 'INITIALIZER_FOR_STATIC_FIELD', | |
1346 "'{0}' is a static variable in the enclosing class, variables initiali
zed in a constructor cannot be static"); | 1262 "'{0}' is a static variable in the enclosing class, variables initiali
zed in a constructor cannot be static"); |
1347 | 1263 |
1348 /** | 1264 /** |
1349 * 7.6.1 Generative Constructors: An initializing formal has the form | 1265 * 7.6.1 Generative Constructors: An initializing formal has the form |
1350 * <i>this.id</i>. It is a compile-time error if <i>id</i> is not the name of | 1266 * <i>this.id</i>. It is a compile-time error if <i>id</i> is not the name of |
1351 * an instance variable of the immediately enclosing class. | 1267 * an instance variable of the immediately enclosing class. |
1352 * | 1268 * |
1353 * @param id the name of the initializing formal that is not an instance | 1269 * @param id the name of the initializing formal that is not an instance |
1354 * variable in the immediately enclosing class | 1270 * variable in the immediately enclosing class |
1355 * See [INITIALIZING_FORMAL_FOR_STATIC_FIELD], and | 1271 * See [INITIALIZING_FORMAL_FOR_STATIC_FIELD], and |
1356 * [INITIALIZER_FOR_NON_EXISTENT_FIELD]. | 1272 * [INITIALIZER_FOR_NON_EXISTENT_FIELD]. |
1357 */ | 1273 */ |
1358 static const CompileTimeErrorCode INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD = | 1274 static const CompileTimeErrorCode INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD = |
1359 const CompileTimeErrorCode( | 1275 const CompileTimeErrorCode('INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD', |
1360 'INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD', | |
1361 "'{0}' is not a variable in the enclosing class"); | 1276 "'{0}' is not a variable in the enclosing class"); |
1362 | 1277 |
1363 /** | 1278 /** |
1364 * 7.6.1 Generative Constructors: An initializing formal has the form | 1279 * 7.6.1 Generative Constructors: An initializing formal has the form |
1365 * <i>this.id</i>. It is a compile-time error if <i>id</i> is not the name of | 1280 * <i>this.id</i>. It is a compile-time error if <i>id</i> is not the name of |
1366 * an instance variable of the immediately enclosing class. | 1281 * an instance variable of the immediately enclosing class. |
1367 * | 1282 * |
1368 * @param id the name of the initializing formal that is a static variable in | 1283 * @param id the name of the initializing formal that is a static variable in |
1369 * the immediately enclosing class | 1284 * the immediately enclosing class |
1370 * See [INITIALIZER_FOR_STATIC_FIELD]. | 1285 * See [INITIALIZER_FOR_STATIC_FIELD]. |
1371 */ | 1286 */ |
1372 static const CompileTimeErrorCode INITIALIZING_FORMAL_FOR_STATIC_FIELD = | 1287 static const CompileTimeErrorCode INITIALIZING_FORMAL_FOR_STATIC_FIELD = |
1373 const CompileTimeErrorCode( | 1288 const CompileTimeErrorCode('INITIALIZING_FORMAL_FOR_STATIC_FIELD', |
1374 'INITIALIZING_FORMAL_FOR_STATIC_FIELD', | |
1375 "'{0}' is a static field in the enclosing class, fields initialized in
a constructor cannot be static"); | 1289 "'{0}' is a static field in the enclosing class, fields initialized in
a constructor cannot be static"); |
1376 | 1290 |
1377 /** | 1291 /** |
1378 * 12.30 Identifier Reference: Otherwise, e is equivalent to the property | 1292 * 12.30 Identifier Reference: Otherwise, e is equivalent to the property |
1379 * extraction <b>this</b>.<i>id</i>. | 1293 * extraction <b>this</b>.<i>id</i>. |
1380 */ | 1294 */ |
1381 static const CompileTimeErrorCode INSTANCE_MEMBER_ACCESS_FROM_FACTORY = | 1295 static const CompileTimeErrorCode INSTANCE_MEMBER_ACCESS_FROM_FACTORY = |
1382 const CompileTimeErrorCode( | 1296 const CompileTimeErrorCode('INSTANCE_MEMBER_ACCESS_FROM_FACTORY', |
1383 'INSTANCE_MEMBER_ACCESS_FROM_FACTORY', | |
1384 "Instance members cannot be accessed from a factory constructor"); | 1297 "Instance members cannot be accessed from a factory constructor"); |
1385 | 1298 |
1386 /** | 1299 /** |
1387 * 12.30 Identifier Reference: Otherwise, e is equivalent to the property | 1300 * 12.30 Identifier Reference: Otherwise, e is equivalent to the property |
1388 * extraction <b>this</b>.<i>id</i>. | 1301 * extraction <b>this</b>.<i>id</i>. |
1389 */ | 1302 */ |
1390 static const CompileTimeErrorCode INSTANCE_MEMBER_ACCESS_FROM_STATIC = | 1303 static const CompileTimeErrorCode INSTANCE_MEMBER_ACCESS_FROM_STATIC = |
1391 const CompileTimeErrorCode( | 1304 const CompileTimeErrorCode('INSTANCE_MEMBER_ACCESS_FROM_STATIC', |
1392 'INSTANCE_MEMBER_ACCESS_FROM_STATIC', | |
1393 "Instance members cannot be accessed from a static method"); | 1305 "Instance members cannot be accessed from a static method"); |
1394 | 1306 |
1395 /** | 1307 /** |
1396 * Enum proposal: It is also a compile-time error to explicitly instantiate an | 1308 * Enum proposal: It is also a compile-time error to explicitly instantiate an |
1397 * enum via 'new' or 'const' or to access its private fields. | 1309 * enum via 'new' or 'const' or to access its private fields. |
1398 */ | 1310 */ |
1399 static const CompileTimeErrorCode INSTANTIATE_ENUM = | 1311 static const CompileTimeErrorCode INSTANTIATE_ENUM = |
1400 const CompileTimeErrorCode('INSTANTIATE_ENUM', "Enums cannot be instantiat
ed"); | 1312 const CompileTimeErrorCode( |
| 1313 'INSTANTIATE_ENUM', "Enums cannot be instantiated"); |
1401 | 1314 |
1402 /** | 1315 /** |
1403 * 11 Metadata: Metadata consists of a series of annotations, each of which | 1316 * 11 Metadata: Metadata consists of a series of annotations, each of which |
1404 * begin with the character @, followed by a constant expression that must be | 1317 * begin with the character @, followed by a constant expression that must be |
1405 * either a reference to a compile-time constant variable, or a call to a | 1318 * either a reference to a compile-time constant variable, or a call to a |
1406 * constant constructor. | 1319 * constant constructor. |
1407 */ | 1320 */ |
1408 static const CompileTimeErrorCode INVALID_ANNOTATION = | 1321 static const CompileTimeErrorCode INVALID_ANNOTATION = const CompileTimeErrorC
ode( |
1409 const CompileTimeErrorCode( | 1322 'INVALID_ANNOTATION', |
1410 'INVALID_ANNOTATION', | 1323 "Annotation can be only constant variable or constant constructor invocati
on"); |
1411 "Annotation can be only constant variable or constant constructor invo
cation"); | |
1412 | 1324 |
1413 /** | 1325 /** |
1414 * 11 Metadata: Metadata consists of a series of annotations, each of which | 1326 * 11 Metadata: Metadata consists of a series of annotations, each of which |
1415 * begin with the character @, followed by a constant expression that must be | 1327 * begin with the character @, followed by a constant expression that must be |
1416 * either a reference to a compile-time constant variable, or a call to a | 1328 * either a reference to a compile-time constant variable, or a call to a |
1417 * constant constructor. | 1329 * constant constructor. |
1418 * | 1330 * |
1419 * 12.1 Constants: A qualified reference to a static constant variable that is | 1331 * 12.1 Constants: A qualified reference to a static constant variable that is |
1420 * not qualified by a deferred prefix. | 1332 * not qualified by a deferred prefix. |
1421 */ | 1333 */ |
1422 static const CompileTimeErrorCode INVALID_ANNOTATION_FROM_DEFERRED_LIBRARY = | 1334 static const CompileTimeErrorCode INVALID_ANNOTATION_FROM_DEFERRED_LIBRARY = |
1423 const CompileTimeErrorCode( | 1335 const CompileTimeErrorCode('INVALID_ANNOTATION_FROM_DEFERRED_LIBRARY', |
1424 'INVALID_ANNOTATION_FROM_DEFERRED_LIBRARY', | |
1425 "Constant values from a deferred library cannot be used as annotations
"); | 1336 "Constant values from a deferred library cannot be used as annotations
"); |
1426 | 1337 |
1427 /** | 1338 /** |
1428 * 15.31 Identifier Reference: It is a compile-time error if any of the | 1339 * 15.31 Identifier Reference: It is a compile-time error if any of the |
1429 * identifiers async, await or yield is used as an identifier in a function | 1340 * identifiers async, await or yield is used as an identifier in a function |
1430 * body marked with either async, async* or sync*. | 1341 * body marked with either async, async* or sync*. |
1431 */ | 1342 */ |
1432 static const CompileTimeErrorCode INVALID_IDENTIFIER_IN_ASYNC = | 1343 static const CompileTimeErrorCode INVALID_IDENTIFIER_IN_ASYNC = |
1433 const CompileTimeErrorCode( | 1344 const CompileTimeErrorCode('INVALID_IDENTIFIER_IN_ASYNC', |
1434 'INVALID_IDENTIFIER_IN_ASYNC', | |
1435 "The identifier '{0}' cannot be used in a function marked with async,
async* or sync*"); | 1345 "The identifier '{0}' cannot be used in a function marked with async,
async* or sync*"); |
1436 | 1346 |
1437 /** | 1347 /** |
1438 * 9. Functions: It is a compile-time error if an async, async* or sync* | 1348 * 9. Functions: It is a compile-time error if an async, async* or sync* |
1439 * modifier is attached to the body of a setter or constructor. | 1349 * modifier is attached to the body of a setter or constructor. |
1440 */ | 1350 */ |
1441 static const CompileTimeErrorCode INVALID_MODIFIER_ON_CONSTRUCTOR = | 1351 static const CompileTimeErrorCode INVALID_MODIFIER_ON_CONSTRUCTOR = |
1442 const CompileTimeErrorCode( | 1352 const CompileTimeErrorCode('INVALID_MODIFIER_ON_CONSTRUCTOR', |
1443 'INVALID_MODIFIER_ON_CONSTRUCTOR', | |
1444 "The modifier '{0}' cannot be applied to the body of a constructor"); | 1353 "The modifier '{0}' cannot be applied to the body of a constructor"); |
1445 | 1354 |
1446 /** | 1355 /** |
1447 * 9. Functions: It is a compile-time error if an async, async* or sync* | 1356 * 9. Functions: It is a compile-time error if an async, async* or sync* |
1448 * modifier is attached to the body of a setter or constructor. | 1357 * modifier is attached to the body of a setter or constructor. |
1449 */ | 1358 */ |
1450 static const CompileTimeErrorCode INVALID_MODIFIER_ON_SETTER = | 1359 static const CompileTimeErrorCode INVALID_MODIFIER_ON_SETTER = |
1451 const CompileTimeErrorCode( | 1360 const CompileTimeErrorCode('INVALID_MODIFIER_ON_SETTER', |
1452 'INVALID_MODIFIER_ON_SETTER', | |
1453 "The modifier '{0}' cannot be applied to the body of a setter"); | 1361 "The modifier '{0}' cannot be applied to the body of a setter"); |
1454 | 1362 |
1455 /** | 1363 /** |
1456 * TODO(brianwilkerson) Remove this when we have decided on how to report | 1364 * TODO(brianwilkerson) Remove this when we have decided on how to report |
1457 * errors in compile-time constants. Until then, this acts as a placeholder | 1365 * errors in compile-time constants. Until then, this acts as a placeholder |
1458 * for more informative errors. | 1366 * for more informative errors. |
1459 * | 1367 * |
1460 * See TODOs in ConstantVisitor | 1368 * See TODOs in ConstantVisitor |
1461 */ | 1369 */ |
1462 static const CompileTimeErrorCode INVALID_CONSTANT = | 1370 static const CompileTimeErrorCode INVALID_CONSTANT = |
1463 const CompileTimeErrorCode('INVALID_CONSTANT', "Invalid constant value"); | 1371 const CompileTimeErrorCode('INVALID_CONSTANT', "Invalid constant value"); |
1464 | 1372 |
1465 /** | 1373 /** |
1466 * 7.6 Constructors: It is a compile-time error if the name of a constructor | 1374 * 7.6 Constructors: It is a compile-time error if the name of a constructor |
1467 * is not a constructor name. | 1375 * is not a constructor name. |
1468 */ | 1376 */ |
1469 static const CompileTimeErrorCode INVALID_CONSTRUCTOR_NAME = | 1377 static const CompileTimeErrorCode INVALID_CONSTRUCTOR_NAME = |
1470 const CompileTimeErrorCode( | 1378 const CompileTimeErrorCode( |
1471 'INVALID_CONSTRUCTOR_NAME', | 1379 'INVALID_CONSTRUCTOR_NAME', "Invalid constructor name"); |
1472 "Invalid constructor name"); | |
1473 | 1380 |
1474 /** | 1381 /** |
1475 * 7.6.2 Factories: It is a compile-time error if <i>M</i> is not the name of | 1382 * 7.6.2 Factories: It is a compile-time error if <i>M</i> is not the name of |
1476 * the immediately enclosing class. | 1383 * the immediately enclosing class. |
1477 */ | 1384 */ |
1478 static const CompileTimeErrorCode INVALID_FACTORY_NAME_NOT_A_CLASS = | 1385 static const CompileTimeErrorCode INVALID_FACTORY_NAME_NOT_A_CLASS = |
1479 const CompileTimeErrorCode( | 1386 const CompileTimeErrorCode('INVALID_FACTORY_NAME_NOT_A_CLASS', |
1480 'INVALID_FACTORY_NAME_NOT_A_CLASS', | |
1481 "The name of the immediately enclosing class expected"); | 1387 "The name of the immediately enclosing class expected"); |
1482 | 1388 |
1483 /** | 1389 /** |
1484 * 12.10 This: It is a compile-time error if this appears in a top-level | 1390 * 12.10 This: It is a compile-time error if this appears in a top-level |
1485 * function or variable initializer, in a factory constructor, or in a static | 1391 * function or variable initializer, in a factory constructor, or in a static |
1486 * method or variable initializer, or in the initializer of an instance | 1392 * method or variable initializer, or in the initializer of an instance |
1487 * variable. | 1393 * variable. |
1488 */ | 1394 */ |
1489 static const CompileTimeErrorCode INVALID_REFERENCE_TO_THIS = | 1395 static const CompileTimeErrorCode INVALID_REFERENCE_TO_THIS = |
1490 const CompileTimeErrorCode( | 1396 const CompileTimeErrorCode('INVALID_REFERENCE_TO_THIS', |
1491 'INVALID_REFERENCE_TO_THIS', | |
1492 "Invalid reference to 'this' expression"); | 1397 "Invalid reference to 'this' expression"); |
1493 | 1398 |
1494 /** | 1399 /** |
1495 * 12.6 Lists: It is a compile time error if the type argument of a constant | 1400 * 12.6 Lists: It is a compile time error if the type argument of a constant |
1496 * list literal includes a type parameter. | 1401 * list literal includes a type parameter. |
1497 * | 1402 * |
1498 * @name the name of the type parameter | 1403 * @name the name of the type parameter |
1499 */ | 1404 */ |
1500 static const CompileTimeErrorCode INVALID_TYPE_ARGUMENT_IN_CONST_LIST = | 1405 static const CompileTimeErrorCode INVALID_TYPE_ARGUMENT_IN_CONST_LIST = |
1501 const CompileTimeErrorCode( | 1406 const CompileTimeErrorCode('INVALID_TYPE_ARGUMENT_IN_CONST_LIST', |
1502 'INVALID_TYPE_ARGUMENT_IN_CONST_LIST', | |
1503 "Constant list literals cannot include a type parameter as a type argu
ment, such as '{0}'"); | 1407 "Constant list literals cannot include a type parameter as a type argu
ment, such as '{0}'"); |
1504 | 1408 |
1505 /** | 1409 /** |
1506 * 12.7 Maps: It is a compile time error if the type arguments of a constant | 1410 * 12.7 Maps: It is a compile time error if the type arguments of a constant |
1507 * map literal include a type parameter. | 1411 * map literal include a type parameter. |
1508 * | 1412 * |
1509 * @name the name of the type parameter | 1413 * @name the name of the type parameter |
1510 */ | 1414 */ |
1511 static const CompileTimeErrorCode INVALID_TYPE_ARGUMENT_IN_CONST_MAP = | 1415 static const CompileTimeErrorCode INVALID_TYPE_ARGUMENT_IN_CONST_MAP = |
1512 const CompileTimeErrorCode( | 1416 const CompileTimeErrorCode('INVALID_TYPE_ARGUMENT_IN_CONST_MAP', |
1513 'INVALID_TYPE_ARGUMENT_IN_CONST_MAP', | |
1514 "Constant map literals cannot include a type parameter as a type argum
ent, such as '{0}'"); | 1417 "Constant map literals cannot include a type parameter as a type argum
ent, such as '{0}'"); |
1515 | 1418 |
1516 /** | 1419 /** |
1517 * 14.2 Exports: It is a compile-time error if the compilation unit found at | 1420 * 14.2 Exports: It is a compile-time error if the compilation unit found at |
1518 * the specified URI is not a library declaration. | 1421 * the specified URI is not a library declaration. |
1519 * | 1422 * |
1520 * 14.1 Imports: It is a compile-time error if the compilation unit found at | 1423 * 14.1 Imports: It is a compile-time error if the compilation unit found at |
1521 * the specified URI is not a library declaration. | 1424 * the specified URI is not a library declaration. |
1522 * | 1425 * |
1523 * 14.3 Parts: It is a compile time error if the contents of the URI are not a | 1426 * 14.3 Parts: It is a compile time error if the contents of the URI are not a |
(...skipping 10 matching lines...) Expand all Loading... |
1534 * <i>s<sub>E</sub></i> exists within the innermost function in which | 1437 * <i>s<sub>E</sub></i> exists within the innermost function in which |
1535 * <i>s<sub>b</sub></i> occurs. | 1438 * <i>s<sub>b</sub></i> occurs. |
1536 * | 1439 * |
1537 * 13.14 Continue: It is a compile-time error if no such statement or case | 1440 * 13.14 Continue: It is a compile-time error if no such statement or case |
1538 * clause <i>s<sub>E</sub></i> exists within the innermost function in which | 1441 * clause <i>s<sub>E</sub></i> exists within the innermost function in which |
1539 * <i>s<sub>c</sub></i> occurs. | 1442 * <i>s<sub>c</sub></i> occurs. |
1540 * | 1443 * |
1541 * @param labelName the name of the unresolvable label | 1444 * @param labelName the name of the unresolvable label |
1542 */ | 1445 */ |
1543 static const CompileTimeErrorCode LABEL_IN_OUTER_SCOPE = | 1446 static const CompileTimeErrorCode LABEL_IN_OUTER_SCOPE = |
1544 const CompileTimeErrorCode( | 1447 const CompileTimeErrorCode('LABEL_IN_OUTER_SCOPE', |
1545 'LABEL_IN_OUTER_SCOPE', | |
1546 "Cannot reference label '{0}' declared in an outer method"); | 1448 "Cannot reference label '{0}' declared in an outer method"); |
1547 | 1449 |
1548 /** | 1450 /** |
1549 * 13.13 Break: It is a compile-time error if no such statement | 1451 * 13.13 Break: It is a compile-time error if no such statement |
1550 * <i>s<sub>E</sub></i> exists within the innermost function in which | 1452 * <i>s<sub>E</sub></i> exists within the innermost function in which |
1551 * <i>s<sub>b</sub></i> occurs. | 1453 * <i>s<sub>b</sub></i> occurs. |
1552 * | 1454 * |
1553 * 13.14 Continue: It is a compile-time error if no such statement or case | 1455 * 13.14 Continue: It is a compile-time error if no such statement or case |
1554 * clause <i>s<sub>E</sub></i> exists within the innermost function in which | 1456 * clause <i>s<sub>E</sub></i> exists within the innermost function in which |
1555 * <i>s<sub>c</sub></i> occurs. | 1457 * <i>s<sub>c</sub></i> occurs. |
1556 * | 1458 * |
1557 * @param labelName the name of the unresolvable label | 1459 * @param labelName the name of the unresolvable label |
1558 */ | 1460 */ |
1559 static const CompileTimeErrorCode LABEL_UNDEFINED = | 1461 static const CompileTimeErrorCode LABEL_UNDEFINED = |
1560 const CompileTimeErrorCode( | 1462 const CompileTimeErrorCode( |
1561 'LABEL_UNDEFINED', | 1463 'LABEL_UNDEFINED', "Cannot reference undefined label '{0}'"); |
1562 "Cannot reference undefined label '{0}'"); | |
1563 | 1464 |
1564 /** | 1465 /** |
1565 * 7 Classes: It is a compile time error if a class <i>C</i> declares a member | 1466 * 7 Classes: It is a compile time error if a class <i>C</i> declares a member |
1566 * with the same name as <i>C</i>. | 1467 * with the same name as <i>C</i>. |
1567 */ | 1468 */ |
1568 static const CompileTimeErrorCode MEMBER_WITH_CLASS_NAME = | 1469 static const CompileTimeErrorCode MEMBER_WITH_CLASS_NAME = |
1569 const CompileTimeErrorCode( | 1470 const CompileTimeErrorCode('MEMBER_WITH_CLASS_NAME', |
1570 'MEMBER_WITH_CLASS_NAME', | |
1571 "Class members cannot have the same name as the enclosing class"); | 1471 "Class members cannot have the same name as the enclosing class"); |
1572 | 1472 |
1573 /** | 1473 /** |
1574 * 7.2 Getters: It is a compile-time error if a class has both a getter and a | 1474 * 7.2 Getters: It is a compile-time error if a class has both a getter and a |
1575 * method with the same name. | 1475 * method with the same name. |
1576 * | 1476 * |
1577 * @param name the conflicting name of the getter and method | 1477 * @param name the conflicting name of the getter and method |
1578 */ | 1478 */ |
1579 static const CompileTimeErrorCode METHOD_AND_GETTER_WITH_SAME_NAME = | 1479 static const CompileTimeErrorCode METHOD_AND_GETTER_WITH_SAME_NAME = |
1580 const CompileTimeErrorCode( | 1480 const CompileTimeErrorCode('METHOD_AND_GETTER_WITH_SAME_NAME', |
1581 'METHOD_AND_GETTER_WITH_SAME_NAME', | |
1582 "'{0}' cannot be used to name a method, there is already a getter with
the same name"); | 1481 "'{0}' cannot be used to name a method, there is already a getter with
the same name"); |
1583 | 1482 |
1584 /** | 1483 /** |
1585 * 12.1 Constants: A constant expression is ... a constant list literal. | 1484 * 12.1 Constants: A constant expression is ... a constant list literal. |
1586 */ | 1485 */ |
1587 static const CompileTimeErrorCode MISSING_CONST_IN_LIST_LITERAL = | 1486 static const CompileTimeErrorCode MISSING_CONST_IN_LIST_LITERAL = |
1588 const CompileTimeErrorCode( | 1487 const CompileTimeErrorCode('MISSING_CONST_IN_LIST_LITERAL', |
1589 'MISSING_CONST_IN_LIST_LITERAL', | |
1590 "List literals must be prefixed with 'const' when used as a constant e
xpression"); | 1488 "List literals must be prefixed with 'const' when used as a constant e
xpression"); |
1591 | 1489 |
1592 /** | 1490 /** |
1593 * 12.1 Constants: A constant expression is ... a constant map literal. | 1491 * 12.1 Constants: A constant expression is ... a constant map literal. |
1594 */ | 1492 */ |
1595 static const CompileTimeErrorCode MISSING_CONST_IN_MAP_LITERAL = | 1493 static const CompileTimeErrorCode MISSING_CONST_IN_MAP_LITERAL = |
1596 const CompileTimeErrorCode( | 1494 const CompileTimeErrorCode('MISSING_CONST_IN_MAP_LITERAL', |
1597 'MISSING_CONST_IN_MAP_LITERAL', | |
1598 "Map literals must be prefixed with 'const' when used as a constant ex
pression"); | 1495 "Map literals must be prefixed with 'const' when used as a constant ex
pression"); |
1599 | 1496 |
1600 /** | 1497 /** |
1601 * Enum proposal: It is a static warning if all of the following conditions | 1498 * Enum proposal: It is a static warning if all of the following conditions |
1602 * hold: | 1499 * hold: |
1603 * * The switch statement does not have a 'default' clause. | 1500 * * The switch statement does not have a 'default' clause. |
1604 * * The static type of <i>e</i> is an enumerated typed with elements | 1501 * * The static type of <i>e</i> is an enumerated typed with elements |
1605 * <i>id<sub>1</sub></i>, …, <i>id<sub>n</sub></i>. | 1502 * <i>id<sub>1</sub></i>, …, <i>id<sub>n</sub></i>. |
1606 * * The sets {<i>e<sub>1</sub></i>, …, <i>e<sub>k</sub></i>} and | 1503 * * The sets {<i>e<sub>1</sub></i>, …, <i>e<sub>k</sub></i>} and |
1607 * {<i>id<sub>1</sub></i>, …, <i>id<sub>n</sub></i>} are not the same
. | 1504 * {<i>id<sub>1</sub></i>, …, <i>id<sub>n</sub></i>} are not the same
. |
1608 * | 1505 * |
1609 * @param constantName the name of the constant that is missing | 1506 * @param constantName the name of the constant that is missing |
1610 */ | 1507 */ |
1611 static const CompileTimeErrorCode MISSING_ENUM_CONSTANT_IN_SWITCH = | 1508 static const CompileTimeErrorCode MISSING_ENUM_CONSTANT_IN_SWITCH = |
1612 const CompileTimeErrorCode( | 1509 const CompileTimeErrorCode('MISSING_ENUM_CONSTANT_IN_SWITCH', |
1613 'MISSING_ENUM_CONSTANT_IN_SWITCH', | |
1614 "Missing case clause for '{0}'", | 1510 "Missing case clause for '{0}'", |
1615 "Add a case clause for the missing constant or add a default clause.")
; | 1511 "Add a case clause for the missing constant or add a default clause.")
; |
1616 | 1512 |
1617 /** | 1513 /** |
1618 * 9 Mixins: It is a compile-time error if a declared or derived mixin | 1514 * 9 Mixins: It is a compile-time error if a declared or derived mixin |
1619 * explicitly declares a constructor. | 1515 * explicitly declares a constructor. |
1620 * | 1516 * |
1621 * @param typeName the name of the mixin that is invalid | 1517 * @param typeName the name of the mixin that is invalid |
1622 */ | 1518 */ |
1623 static const CompileTimeErrorCode MIXIN_DECLARES_CONSTRUCTOR = | 1519 static const CompileTimeErrorCode MIXIN_DECLARES_CONSTRUCTOR = |
1624 const CompileTimeErrorCode( | 1520 const CompileTimeErrorCode('MIXIN_DECLARES_CONSTRUCTOR', |
1625 'MIXIN_DECLARES_CONSTRUCTOR', | |
1626 "The class '{0}' cannot be used as a mixin because it declares a const
ructor"); | 1521 "The class '{0}' cannot be used as a mixin because it declares a const
ructor"); |
1627 | 1522 |
1628 /** | 1523 /** |
1629 * 9.1 Mixin Application: It is a compile-time error if the with clause of a | 1524 * 9.1 Mixin Application: It is a compile-time error if the with clause of a |
1630 * mixin application <i>C</i> includes a deferred type expression. | 1525 * mixin application <i>C</i> includes a deferred type expression. |
1631 * | 1526 * |
1632 * @param typeName the name of the type that cannot be extended | 1527 * @param typeName the name of the type that cannot be extended |
1633 * See [EXTENDS_DEFERRED_CLASS], and [IMPLEMENTS_DEFERRED_CLASS]. | 1528 * See [EXTENDS_DEFERRED_CLASS], and [IMPLEMENTS_DEFERRED_CLASS]. |
1634 */ | 1529 */ |
1635 static const CompileTimeErrorCode MIXIN_DEFERRED_CLASS = | 1530 static const CompileTimeErrorCode MIXIN_DEFERRED_CLASS = |
1636 const CompileTimeErrorCode( | 1531 const CompileTimeErrorCode('MIXIN_DEFERRED_CLASS', |
1637 'MIXIN_DEFERRED_CLASS', | |
1638 "This class cannot mixin the deferred class '{0}'"); | 1532 "This class cannot mixin the deferred class '{0}'"); |
1639 | 1533 |
1640 /** | 1534 /** |
1641 * Not yet in the spec, but consistent with VM behavior. It is a | 1535 * Not yet in the spec, but consistent with VM behavior. It is a |
1642 * compile-time error if all of the constructors of a mixin's base class have | 1536 * compile-time error if all of the constructors of a mixin's base class have |
1643 * at least one optional parameter (since only constructors that lack | 1537 * at least one optional parameter (since only constructors that lack |
1644 * optional parameters can be forwarded to the mixin). See | 1538 * optional parameters can be forwarded to the mixin). See |
1645 * https://code.google.com/p/dart/issues/detail?id=15101#c4 | 1539 * https://code.google.com/p/dart/issues/detail?id=15101#c4 |
1646 */ | 1540 */ |
1647 static const CompileTimeErrorCode MIXIN_HAS_NO_CONSTRUCTORS = | 1541 static const CompileTimeErrorCode MIXIN_HAS_NO_CONSTRUCTORS = |
1648 const CompileTimeErrorCode( | 1542 const CompileTimeErrorCode('MIXIN_HAS_NO_CONSTRUCTORS', |
1649 'MIXIN_HAS_NO_CONSTRUCTORS', | |
1650 "This mixin application is invalid because all of the constructors " | 1543 "This mixin application is invalid because all of the constructors " |
1651 "in the base class '{0}' have optional parameters."); | 1544 "in the base class '{0}' have optional parameters."); |
1652 | 1545 |
1653 /** | 1546 /** |
1654 * 9 Mixins: It is a compile-time error if a mixin is derived from a class | 1547 * 9 Mixins: It is a compile-time error if a mixin is derived from a class |
1655 * whose superclass is not Object. | 1548 * whose superclass is not Object. |
1656 * | 1549 * |
1657 * @param typeName the name of the mixin that is invalid | 1550 * @param typeName the name of the mixin that is invalid |
1658 */ | 1551 */ |
1659 static const CompileTimeErrorCode MIXIN_INHERITS_FROM_NOT_OBJECT = | 1552 static const CompileTimeErrorCode MIXIN_INHERITS_FROM_NOT_OBJECT = |
1660 const CompileTimeErrorCode( | 1553 const CompileTimeErrorCode('MIXIN_INHERITS_FROM_NOT_OBJECT', |
1661 'MIXIN_INHERITS_FROM_NOT_OBJECT', | |
1662 "The class '{0}' cannot be used as a mixin because it extends a class
other than Object"); | 1554 "The class '{0}' cannot be used as a mixin because it extends a class
other than Object"); |
1663 | 1555 |
1664 /** | 1556 /** |
1665 * 12.2 Null: It is a compile-time error for a class to attempt to extend or | 1557 * 12.2 Null: It is a compile-time error for a class to attempt to extend or |
1666 * implement Null. | 1558 * implement Null. |
1667 * | 1559 * |
1668 * 12.3 Numbers: It is a compile-time error for a class to attempt to extend | 1560 * 12.3 Numbers: It is a compile-time error for a class to attempt to extend |
1669 * or implement int. | 1561 * or implement int. |
1670 * | 1562 * |
1671 * 12.3 Numbers: It is a compile-time error for a class to attempt to extend | 1563 * 12.3 Numbers: It is a compile-time error for a class to attempt to extend |
1672 * or implement double. | 1564 * or implement double. |
1673 * | 1565 * |
1674 * 12.3 Numbers: It is a compile-time error for any type other than the types | 1566 * 12.3 Numbers: It is a compile-time error for any type other than the types |
1675 * int and double to attempt to extend or implement num. | 1567 * int and double to attempt to extend or implement num. |
1676 * | 1568 * |
1677 * 12.4 Booleans: It is a compile-time error for a class to attempt to extend | 1569 * 12.4 Booleans: It is a compile-time error for a class to attempt to extend |
1678 * or implement bool. | 1570 * or implement bool. |
1679 * | 1571 * |
1680 * 12.5 Strings: It is a compile-time error for a class to attempt to extend | 1572 * 12.5 Strings: It is a compile-time error for a class to attempt to extend |
1681 * or implement String. | 1573 * or implement String. |
1682 * | 1574 * |
1683 * @param typeName the name of the type that cannot be extended | 1575 * @param typeName the name of the type that cannot be extended |
1684 * See [IMPLEMENTS_DISALLOWED_CLASS]. | 1576 * See [IMPLEMENTS_DISALLOWED_CLASS]. |
1685 */ | 1577 */ |
1686 static const CompileTimeErrorCode MIXIN_OF_DISALLOWED_CLASS = | 1578 static const CompileTimeErrorCode MIXIN_OF_DISALLOWED_CLASS = |
1687 const CompileTimeErrorCode( | 1579 const CompileTimeErrorCode( |
1688 'MIXIN_OF_DISALLOWED_CLASS', | 1580 'MIXIN_OF_DISALLOWED_CLASS', "Classes cannot mixin '{0}'"); |
1689 "Classes cannot mixin '{0}'"); | |
1690 | 1581 |
1691 /** | 1582 /** |
1692 * Enum proposal: It is a compile-time error to subclass, mix-in or implement | 1583 * Enum proposal: It is a compile-time error to subclass, mix-in or implement |
1693 * an enum. | 1584 * an enum. |
1694 */ | 1585 */ |
1695 static const CompileTimeErrorCode MIXIN_OF_ENUM = | 1586 static const CompileTimeErrorCode MIXIN_OF_ENUM = const CompileTimeErrorCode( |
1696 const CompileTimeErrorCode('MIXIN_OF_ENUM', "Classes cannot mixin an enum"
); | 1587 'MIXIN_OF_ENUM', "Classes cannot mixin an enum"); |
1697 | 1588 |
1698 /** | 1589 /** |
1699 * 9.1 Mixin Application: It is a compile-time error if <i>M</i> does not | 1590 * 9.1 Mixin Application: It is a compile-time error if <i>M</i> does not |
1700 * denote a class or mixin available in the immediately enclosing scope. | 1591 * denote a class or mixin available in the immediately enclosing scope. |
1701 */ | 1592 */ |
1702 static const CompileTimeErrorCode MIXIN_OF_NON_CLASS = | 1593 static const CompileTimeErrorCode MIXIN_OF_NON_CLASS = |
1703 const CompileTimeErrorCode( | 1594 const CompileTimeErrorCode( |
1704 'MIXIN_OF_NON_CLASS', | 1595 'MIXIN_OF_NON_CLASS', "Classes can only mixin other classes"); |
1705 "Classes can only mixin other classes"); | |
1706 | 1596 |
1707 /** | 1597 /** |
1708 * 9 Mixins: It is a compile-time error if a declared or derived mixin refers | 1598 * 9 Mixins: It is a compile-time error if a declared or derived mixin refers |
1709 * to super. | 1599 * to super. |
1710 */ | 1600 */ |
1711 static const CompileTimeErrorCode MIXIN_REFERENCES_SUPER = | 1601 static const CompileTimeErrorCode MIXIN_REFERENCES_SUPER = |
1712 const CompileTimeErrorCode( | 1602 const CompileTimeErrorCode('MIXIN_REFERENCES_SUPER', |
1713 'MIXIN_REFERENCES_SUPER', | |
1714 "The class '{0}' cannot be used as a mixin because it references 'supe
r'"); | 1603 "The class '{0}' cannot be used as a mixin because it references 'supe
r'"); |
1715 | 1604 |
1716 /** | 1605 /** |
1717 * 9.1 Mixin Application: It is a compile-time error if <i>S</i> does not | 1606 * 9.1 Mixin Application: It is a compile-time error if <i>S</i> does not |
1718 * denote a class available in the immediately enclosing scope. | 1607 * denote a class available in the immediately enclosing scope. |
1719 */ | 1608 */ |
1720 static const CompileTimeErrorCode MIXIN_WITH_NON_CLASS_SUPERCLASS = | 1609 static const CompileTimeErrorCode MIXIN_WITH_NON_CLASS_SUPERCLASS = |
1721 const CompileTimeErrorCode( | 1610 const CompileTimeErrorCode('MIXIN_WITH_NON_CLASS_SUPERCLASS', |
1722 'MIXIN_WITH_NON_CLASS_SUPERCLASS', | |
1723 "Mixin can only be applied to class"); | 1611 "Mixin can only be applied to class"); |
1724 | 1612 |
1725 /** | 1613 /** |
1726 * 7.6.1 Generative Constructors: A generative constructor may be redirecting, | 1614 * 7.6.1 Generative Constructors: A generative constructor may be redirecting, |
1727 * in which case its only action is to invoke another generative constructor. | 1615 * in which case its only action is to invoke another generative constructor. |
1728 */ | 1616 */ |
1729 static const CompileTimeErrorCode MULTIPLE_REDIRECTING_CONSTRUCTOR_INVOCATIONS | 1617 static const CompileTimeErrorCode MULTIPLE_REDIRECTING_CONSTRUCTOR_INVOCATIONS
= |
1730 = | 1618 const CompileTimeErrorCode('MULTIPLE_REDIRECTING_CONSTRUCTOR_INVOCATIONS', |
1731 const CompileTimeErrorCode( | |
1732 'MULTIPLE_REDIRECTING_CONSTRUCTOR_INVOCATIONS', | |
1733 "Constructor may have at most one 'this' redirection"); | 1619 "Constructor may have at most one 'this' redirection"); |
1734 | 1620 |
1735 /** | 1621 /** |
1736 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. | 1622 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. |
1737 * Then <i>k</i> may include at most one superinitializer in its initializer | 1623 * Then <i>k</i> may include at most one superinitializer in its initializer |
1738 * list or a compile time error occurs. | 1624 * list or a compile time error occurs. |
1739 */ | 1625 */ |
1740 static const CompileTimeErrorCode MULTIPLE_SUPER_INITIALIZERS = | 1626 static const CompileTimeErrorCode MULTIPLE_SUPER_INITIALIZERS = |
1741 const CompileTimeErrorCode( | 1627 const CompileTimeErrorCode('MULTIPLE_SUPER_INITIALIZERS', |
1742 'MULTIPLE_SUPER_INITIALIZERS', | |
1743 "Constructor may have at most one 'super' initializer"); | 1628 "Constructor may have at most one 'super' initializer"); |
1744 | 1629 |
1745 /** | 1630 /** |
1746 * 11 Metadata: Metadata consists of a series of annotations, each of which | 1631 * 11 Metadata: Metadata consists of a series of annotations, each of which |
1747 * begin with the character @, followed by a constant expression that must be | 1632 * begin with the character @, followed by a constant expression that must be |
1748 * either a reference to a compile-time constant variable, or a call to a | 1633 * either a reference to a compile-time constant variable, or a call to a |
1749 * constant constructor. | 1634 * constant constructor. |
1750 */ | 1635 */ |
1751 static const CompileTimeErrorCode NO_ANNOTATION_CONSTRUCTOR_ARGUMENTS = | 1636 static const CompileTimeErrorCode NO_ANNOTATION_CONSTRUCTOR_ARGUMENTS = |
1752 const CompileTimeErrorCode( | 1637 const CompileTimeErrorCode('NO_ANNOTATION_CONSTRUCTOR_ARGUMENTS', |
1753 'NO_ANNOTATION_CONSTRUCTOR_ARGUMENTS', | |
1754 "Annotation creation must have arguments"); | 1638 "Annotation creation must have arguments"); |
1755 | 1639 |
1756 /** | 1640 /** |
1757 * 7.6.1 Generative Constructors: If no superinitializer is provided, an | 1641 * 7.6.1 Generative Constructors: If no superinitializer is provided, an |
1758 * implicit superinitializer of the form <b>super</b>() is added at the end of | 1642 * implicit superinitializer of the form <b>super</b>() is added at the end of |
1759 * <i>k</i>'s initializer list, unless the enclosing class is class | 1643 * <i>k</i>'s initializer list, unless the enclosing class is class |
1760 * <i>Object</i>. | 1644 * <i>Object</i>. |
1761 * | 1645 * |
1762 * 7.6.1 Generative constructors. It is a compile-time error if class <i>S</i> | 1646 * 7.6.1 Generative constructors. It is a compile-time error if class <i>S</i> |
1763 * does not declare a generative constructor named <i>S</i> (respectively | 1647 * does not declare a generative constructor named <i>S</i> (respectively |
1764 * <i>S.id</i>) | 1648 * <i>S.id</i>) |
1765 */ | 1649 */ |
1766 static const CompileTimeErrorCode NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT = | 1650 static const CompileTimeErrorCode NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT = |
1767 const CompileTimeErrorCode( | 1651 const CompileTimeErrorCode('NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT', |
1768 'NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT', | |
1769 "The class '{0}' does not have a default constructor"); | 1652 "The class '{0}' does not have a default constructor"); |
1770 | 1653 |
1771 /** | 1654 /** |
1772 * 7.6 Constructors: Iff no constructor is specified for a class <i>C</i>, it | 1655 * 7.6 Constructors: Iff no constructor is specified for a class <i>C</i>, it |
1773 * implicitly has a default constructor C() : <b>super<b>() {}, unless | 1656 * implicitly has a default constructor C() : <b>super<b>() {}, unless |
1774 * <i>C</i> is class <i>Object</i>. | 1657 * <i>C</i> is class <i>Object</i>. |
1775 * | 1658 * |
1776 * 7.6.1 Generative constructors. It is a compile-time error if class <i>S</i> | 1659 * 7.6.1 Generative constructors. It is a compile-time error if class <i>S</i> |
1777 * does not declare a generative constructor named <i>S</i> (respectively | 1660 * does not declare a generative constructor named <i>S</i> (respectively |
1778 * <i>S.id</i>) | 1661 * <i>S.id</i>) |
1779 */ | 1662 */ |
1780 static const CompileTimeErrorCode NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT = | 1663 static const CompileTimeErrorCode NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT = |
1781 const CompileTimeErrorCode( | 1664 const CompileTimeErrorCode('NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT', |
1782 'NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT', | |
1783 "The class '{0}' does not have a default constructor"); | 1665 "The class '{0}' does not have a default constructor"); |
1784 | 1666 |
1785 /** | 1667 /** |
1786 * 13.2 Expression Statements: It is a compile-time error if a non-constant | 1668 * 13.2 Expression Statements: It is a compile-time error if a non-constant |
1787 * map literal that has no explicit type arguments appears in a place where a | 1669 * map literal that has no explicit type arguments appears in a place where a |
1788 * statement is expected. | 1670 * statement is expected. |
1789 */ | 1671 */ |
1790 static const CompileTimeErrorCode NON_CONST_MAP_AS_EXPRESSION_STATEMENT = | 1672 static const CompileTimeErrorCode NON_CONST_MAP_AS_EXPRESSION_STATEMENT = |
1791 const CompileTimeErrorCode( | 1673 const CompileTimeErrorCode('NON_CONST_MAP_AS_EXPRESSION_STATEMENT', |
1792 'NON_CONST_MAP_AS_EXPRESSION_STATEMENT', | |
1793 "A non-constant map literal without type arguments cannot be used as a
n expression statement"); | 1674 "A non-constant map literal without type arguments cannot be used as a
n expression statement"); |
1794 | 1675 |
1795 /** | 1676 /** |
1796 * 13.9 Switch: Given a switch statement of the form <i>switch (e) { | 1677 * 13.9 Switch: Given a switch statement of the form <i>switch (e) { |
1797 * label<sub>11</sub> … label<sub>1j1</sub> case e<sub>1</sub>: | 1678 * label<sub>11</sub> … label<sub>1j1</sub> case e<sub>1</sub>: |
1798 * s<sub>1</sub> … label<sub>n1</sub> … label<sub>njn</sub> case | 1679 * s<sub>1</sub> … label<sub>n1</sub> … label<sub>njn</sub> case |
1799 * e<sub>n</sub>: s<sub>n</sub> default: s<sub>n+1</sub>}</i> or the form | 1680 * e<sub>n</sub>: s<sub>n</sub> default: s<sub>n+1</sub>}</i> or the form |
1800 * <i>switch (e) { label<sub>11</sub> … label<sub>1j1</sub> case | 1681 * <i>switch (e) { label<sub>11</sub> … label<sub>1j1</sub> case |
1801 * e<sub>1</sub>: s<sub>1</sub> … label<sub>n1</sub> … | 1682 * e<sub>1</sub>: s<sub>1</sub> … label<sub>n1</sub> … |
1802 * label<sub>njn</sub> case e<sub>n</sub>: s<sub>n</sub>}</i>, it is a | 1683 * label<sub>njn</sub> case e<sub>n</sub>: s<sub>n</sub>}</i>, it is a |
1803 * compile-time error if the expressions <i>e<sub>k</sub></i> are not | 1684 * compile-time error if the expressions <i>e<sub>k</sub></i> are not |
1804 * compile-time constants, for all <i>1 <= k <= n</i>. | 1685 * compile-time constants, for all <i>1 <= k <= n</i>. |
1805 */ | 1686 */ |
1806 static const CompileTimeErrorCode NON_CONSTANT_CASE_EXPRESSION = | 1687 static const CompileTimeErrorCode NON_CONSTANT_CASE_EXPRESSION = |
1807 const CompileTimeErrorCode( | 1688 const CompileTimeErrorCode( |
1808 'NON_CONSTANT_CASE_EXPRESSION', | 1689 'NON_CONSTANT_CASE_EXPRESSION', "Case expressions must be constant"); |
1809 "Case expressions must be constant"); | |
1810 | 1690 |
1811 /** | 1691 /** |
1812 * 13.9 Switch: Given a switch statement of the form <i>switch (e) { | 1692 * 13.9 Switch: Given a switch statement of the form <i>switch (e) { |
1813 * label<sub>11</sub> … label<sub>1j1</sub> case e<sub>1</sub>: | 1693 * label<sub>11</sub> … label<sub>1j1</sub> case e<sub>1</sub>: |
1814 * s<sub>1</sub> … label<sub>n1</sub> … label<sub>njn</sub> case | 1694 * s<sub>1</sub> … label<sub>n1</sub> … label<sub>njn</sub> case |
1815 * e<sub>n</sub>: s<sub>n</sub> default: s<sub>n+1</sub>}</i> or the form | 1695 * e<sub>n</sub>: s<sub>n</sub> default: s<sub>n+1</sub>}</i> or the form |
1816 * <i>switch (e) { label<sub>11</sub> … label<sub>1j1</sub> case | 1696 * <i>switch (e) { label<sub>11</sub> … label<sub>1j1</sub> case |
1817 * e<sub>1</sub>: s<sub>1</sub> … label<sub>n1</sub> … | 1697 * e<sub>1</sub>: s<sub>1</sub> … label<sub>n1</sub> … |
1818 * label<sub>njn</sub> case e<sub>n</sub>: s<sub>n</sub>}</i>, it is a | 1698 * label<sub>njn</sub> case e<sub>n</sub>: s<sub>n</sub>}</i>, it is a |
1819 * compile-time error if the expressions <i>e<sub>k</sub></i> are not | 1699 * compile-time error if the expressions <i>e<sub>k</sub></i> are not |
1820 * compile-time constants, for all <i>1 <= k <= n</i>. | 1700 * compile-time constants, for all <i>1 <= k <= n</i>. |
1821 * | 1701 * |
1822 * 12.1 Constants: A qualified reference to a static constant variable that is | 1702 * 12.1 Constants: A qualified reference to a static constant variable that is |
1823 * not qualified by a deferred prefix. | 1703 * not qualified by a deferred prefix. |
1824 */ | 1704 */ |
1825 static const CompileTimeErrorCode | 1705 static const CompileTimeErrorCode NON_CONSTANT_CASE_EXPRESSION_FROM_DEFERRED_L
IBRARY = |
1826 NON_CONSTANT_CASE_EXPRESSION_FROM_DEFERRED_LIBRARY = | |
1827 const CompileTimeErrorCode( | 1706 const CompileTimeErrorCode( |
1828 'NON_CONSTANT_CASE_EXPRESSION_FROM_DEFERRED_LIBRARY', | 1707 'NON_CONSTANT_CASE_EXPRESSION_FROM_DEFERRED_LIBRARY', |
1829 "Constant values from a deferred library cannot be used as a case expr
ession"); | 1708 "Constant values from a deferred library cannot be used as a case expr
ession"); |
1830 | 1709 |
1831 /** | 1710 /** |
1832 * 6.2.2 Optional Formals: It is a compile-time error if the default value of | 1711 * 6.2.2 Optional Formals: It is a compile-time error if the default value of |
1833 * an optional parameter is not a compile-time constant. | 1712 * an optional parameter is not a compile-time constant. |
1834 */ | 1713 */ |
1835 static const CompileTimeErrorCode NON_CONSTANT_DEFAULT_VALUE = | 1714 static const CompileTimeErrorCode NON_CONSTANT_DEFAULT_VALUE = |
1836 const CompileTimeErrorCode( | 1715 const CompileTimeErrorCode('NON_CONSTANT_DEFAULT_VALUE', |
1837 'NON_CONSTANT_DEFAULT_VALUE', | |
1838 "Default values of an optional parameter must be constant"); | 1716 "Default values of an optional parameter must be constant"); |
1839 | 1717 |
1840 /** | 1718 /** |
1841 * 6.2.2 Optional Formals: It is a compile-time error if the default value of | 1719 * 6.2.2 Optional Formals: It is a compile-time error if the default value of |
1842 * an optional parameter is not a compile-time constant. | 1720 * an optional parameter is not a compile-time constant. |
1843 * | 1721 * |
1844 * 12.1 Constants: A qualified reference to a static constant variable that is | 1722 * 12.1 Constants: A qualified reference to a static constant variable that is |
1845 * not qualified by a deferred prefix. | 1723 * not qualified by a deferred prefix. |
1846 */ | 1724 */ |
1847 static const CompileTimeErrorCode | 1725 static const CompileTimeErrorCode NON_CONSTANT_DEFAULT_VALUE_FROM_DEFERRED_LIB
RARY = |
1848 NON_CONSTANT_DEFAULT_VALUE_FROM_DEFERRED_LIBRARY = | |
1849 const CompileTimeErrorCode( | 1726 const CompileTimeErrorCode( |
1850 'NON_CONSTANT_DEFAULT_VALUE_FROM_DEFERRED_LIBRARY', | 1727 'NON_CONSTANT_DEFAULT_VALUE_FROM_DEFERRED_LIBRARY', |
1851 "Constant values from a deferred library cannot be used as a default p
arameter value"); | 1728 "Constant values from a deferred library cannot be used as a default p
arameter value"); |
1852 | 1729 |
1853 /** | 1730 /** |
1854 * 12.6 Lists: It is a compile time error if an element of a constant list | 1731 * 12.6 Lists: It is a compile time error if an element of a constant list |
1855 * literal is not a compile-time constant. | 1732 * literal is not a compile-time constant. |
1856 */ | 1733 */ |
1857 static const CompileTimeErrorCode NON_CONSTANT_LIST_ELEMENT = | 1734 static const CompileTimeErrorCode NON_CONSTANT_LIST_ELEMENT = |
1858 const CompileTimeErrorCode( | 1735 const CompileTimeErrorCode('NON_CONSTANT_LIST_ELEMENT', |
1859 'NON_CONSTANT_LIST_ELEMENT', | |
1860 "'const' lists must have all constant values"); | 1736 "'const' lists must have all constant values"); |
1861 | 1737 |
1862 /** | 1738 /** |
1863 * 12.6 Lists: It is a compile time error if an element of a constant list | 1739 * 12.6 Lists: It is a compile time error if an element of a constant list |
1864 * literal is not a compile-time constant. | 1740 * literal is not a compile-time constant. |
1865 * | 1741 * |
1866 * 12.1 Constants: A qualified reference to a static constant variable that is | 1742 * 12.1 Constants: A qualified reference to a static constant variable that is |
1867 * not qualified by a deferred prefix. | 1743 * not qualified by a deferred prefix. |
1868 */ | 1744 */ |
1869 static const CompileTimeErrorCode | 1745 static const CompileTimeErrorCode NON_CONSTANT_LIST_ELEMENT_FROM_DEFERRED_LIBR
ARY = |
1870 NON_CONSTANT_LIST_ELEMENT_FROM_DEFERRED_LIBRARY = | |
1871 const CompileTimeErrorCode( | 1746 const CompileTimeErrorCode( |
1872 'NON_CONSTANT_LIST_ELEMENT_FROM_DEFERRED_LIBRARY', | 1747 'NON_CONSTANT_LIST_ELEMENT_FROM_DEFERRED_LIBRARY', |
1873 "Constant values from a deferred library cannot be used as values in a
'const' list"); | 1748 "Constant values from a deferred library cannot be used as values in a
'const' list"); |
1874 | 1749 |
1875 /** | 1750 /** |
1876 * 12.7 Maps: It is a compile time error if either a key or a value of an | 1751 * 12.7 Maps: It is a compile time error if either a key or a value of an |
1877 * entry in a constant map literal is not a compile-time constant. | 1752 * entry in a constant map literal is not a compile-time constant. |
1878 */ | 1753 */ |
1879 static const CompileTimeErrorCode NON_CONSTANT_MAP_KEY = | 1754 static const CompileTimeErrorCode NON_CONSTANT_MAP_KEY = |
1880 const CompileTimeErrorCode( | 1755 const CompileTimeErrorCode( |
1881 'NON_CONSTANT_MAP_KEY', | 1756 'NON_CONSTANT_MAP_KEY', "The keys in a map must be constant"); |
1882 "The keys in a map must be constant"); | |
1883 | 1757 |
1884 /** | 1758 /** |
1885 * 12.7 Maps: It is a compile time error if either a key or a value of an | 1759 * 12.7 Maps: It is a compile time error if either a key or a value of an |
1886 * entry in a constant map literal is not a compile-time constant. | 1760 * entry in a constant map literal is not a compile-time constant. |
1887 * | 1761 * |
1888 * 12.1 Constants: A qualified reference to a static constant variable that is | 1762 * 12.1 Constants: A qualified reference to a static constant variable that is |
1889 * not qualified by a deferred prefix. | 1763 * not qualified by a deferred prefix. |
1890 */ | 1764 */ |
1891 static const CompileTimeErrorCode NON_CONSTANT_MAP_KEY_FROM_DEFERRED_LIBRARY = | 1765 static const CompileTimeErrorCode NON_CONSTANT_MAP_KEY_FROM_DEFERRED_LIBRARY = |
1892 const CompileTimeErrorCode( | 1766 const CompileTimeErrorCode('NON_CONSTANT_MAP_KEY_FROM_DEFERRED_LIBRARY', |
1893 'NON_CONSTANT_MAP_KEY_FROM_DEFERRED_LIBRARY', | |
1894 "Constant values from a deferred library cannot be used as keys in a m
ap"); | 1767 "Constant values from a deferred library cannot be used as keys in a m
ap"); |
1895 | 1768 |
1896 /** | 1769 /** |
1897 * 12.7 Maps: It is a compile time error if either a key or a value of an | 1770 * 12.7 Maps: It is a compile time error if either a key or a value of an |
1898 * entry in a constant map literal is not a compile-time constant. | 1771 * entry in a constant map literal is not a compile-time constant. |
1899 */ | 1772 */ |
1900 static const CompileTimeErrorCode NON_CONSTANT_MAP_VALUE = | 1773 static const CompileTimeErrorCode NON_CONSTANT_MAP_VALUE = |
1901 const CompileTimeErrorCode( | 1774 const CompileTimeErrorCode('NON_CONSTANT_MAP_VALUE', |
1902 'NON_CONSTANT_MAP_VALUE', | |
1903 "The values in a 'const' map must be constant"); | 1775 "The values in a 'const' map must be constant"); |
1904 | 1776 |
1905 /** | 1777 /** |
1906 * 12.7 Maps: It is a compile time error if either a key or a value of an | 1778 * 12.7 Maps: It is a compile time error if either a key or a value of an |
1907 * entry in a constant map literal is not a compile-time constant. | 1779 * entry in a constant map literal is not a compile-time constant. |
1908 * | 1780 * |
1909 * 12.1 Constants: A qualified reference to a static constant variable that is | 1781 * 12.1 Constants: A qualified reference to a static constant variable that is |
1910 * not qualified by a deferred prefix. | 1782 * not qualified by a deferred prefix. |
1911 */ | 1783 */ |
1912 static const CompileTimeErrorCode NON_CONSTANT_MAP_VALUE_FROM_DEFERRED_LIBRARY | 1784 static const CompileTimeErrorCode NON_CONSTANT_MAP_VALUE_FROM_DEFERRED_LIBRARY
= |
1913 = | 1785 const CompileTimeErrorCode('NON_CONSTANT_MAP_VALUE_FROM_DEFERRED_LIBRARY', |
1914 const CompileTimeErrorCode( | |
1915 'NON_CONSTANT_MAP_VALUE_FROM_DEFERRED_LIBRARY', | |
1916 "Constant values from a deferred library cannot be used as values in a
'const' map"); | 1786 "Constant values from a deferred library cannot be used as values in a
'const' map"); |
1917 | 1787 |
1918 /** | 1788 /** |
1919 * 11 Metadata: Metadata consists of a series of annotations, each of which | 1789 * 11 Metadata: Metadata consists of a series of annotations, each of which |
1920 * begin with the character @, followed by a constant expression that must be | 1790 * begin with the character @, followed by a constant expression that must be |
1921 * either a reference to a compile-time constant variable, or a call to a | 1791 * either a reference to a compile-time constant variable, or a call to a |
1922 * constant constructor. | 1792 * constant constructor. |
1923 * | 1793 * |
1924 * "From deferred library" case is covered by | 1794 * "From deferred library" case is covered by |
1925 * [CompileTimeErrorCode.INVALID_ANNOTATION_FROM_DEFERRED_LIBRARY]. | 1795 * [CompileTimeErrorCode.INVALID_ANNOTATION_FROM_DEFERRED_LIBRARY]. |
1926 */ | 1796 */ |
1927 static const CompileTimeErrorCode NON_CONSTANT_ANNOTATION_CONSTRUCTOR = | 1797 static const CompileTimeErrorCode NON_CONSTANT_ANNOTATION_CONSTRUCTOR = |
1928 const CompileTimeErrorCode( | 1798 const CompileTimeErrorCode('NON_CONSTANT_ANNOTATION_CONSTRUCTOR', |
1929 'NON_CONSTANT_ANNOTATION_CONSTRUCTOR', | |
1930 "Annotation creation can use only 'const' constructor"); | 1799 "Annotation creation can use only 'const' constructor"); |
1931 | 1800 |
1932 /** | 1801 /** |
1933 * 7.6.3 Constant Constructors: Any expression that appears within the | 1802 * 7.6.3 Constant Constructors: Any expression that appears within the |
1934 * initializer list of a constant constructor must be a potentially constant | 1803 * initializer list of a constant constructor must be a potentially constant |
1935 * expression, or a compile-time error occurs. | 1804 * expression, or a compile-time error occurs. |
1936 */ | 1805 */ |
1937 static const CompileTimeErrorCode NON_CONSTANT_VALUE_IN_INITIALIZER = | 1806 static const CompileTimeErrorCode NON_CONSTANT_VALUE_IN_INITIALIZER = |
1938 const CompileTimeErrorCode( | 1807 const CompileTimeErrorCode('NON_CONSTANT_VALUE_IN_INITIALIZER', |
1939 'NON_CONSTANT_VALUE_IN_INITIALIZER', | |
1940 "Initializer expressions in constant constructors must be constants"); | 1808 "Initializer expressions in constant constructors must be constants"); |
1941 | 1809 |
1942 /** | 1810 /** |
1943 * 7.6.3 Constant Constructors: Any expression that appears within the | 1811 * 7.6.3 Constant Constructors: Any expression that appears within the |
1944 * initializer list of a constant constructor must be a potentially constant | 1812 * initializer list of a constant constructor must be a potentially constant |
1945 * expression, or a compile-time error occurs. | 1813 * expression, or a compile-time error occurs. |
1946 * | 1814 * |
1947 * 12.1 Constants: A qualified reference to a static constant variable that is | 1815 * 12.1 Constants: A qualified reference to a static constant variable that is |
1948 * not qualified by a deferred prefix. | 1816 * not qualified by a deferred prefix. |
1949 */ | 1817 */ |
1950 static const CompileTimeErrorCode | 1818 static const CompileTimeErrorCode NON_CONSTANT_VALUE_IN_INITIALIZER_FROM_DEFER
RED_LIBRARY = |
1951 NON_CONSTANT_VALUE_IN_INITIALIZER_FROM_DEFERRED_LIBRARY = | |
1952 const CompileTimeErrorCode( | 1819 const CompileTimeErrorCode( |
1953 'NON_CONSTANT_VALUE_IN_INITIALIZER_FROM_DEFERRED_LIBRARY', | 1820 'NON_CONSTANT_VALUE_IN_INITIALIZER_FROM_DEFERRED_LIBRARY', |
1954 "Constant values from a deferred library cannot be used as constant in
itializers"); | 1821 "Constant values from a deferred library cannot be used as constant in
itializers"); |
1955 | 1822 |
1956 /** | 1823 /** |
1957 * 12.14.2 Binding Actuals to Formals: It is a static warning if <i>m < h</i> | 1824 * 12.14.2 Binding Actuals to Formals: It is a static warning if <i>m < h</i> |
1958 * or if <i>m > n</i>. | 1825 * or if <i>m > n</i>. |
1959 * | 1826 * |
1960 * 12.11.2 Const: It is a compile-time error if evaluation of a constant | 1827 * 12.11.2 Const: It is a compile-time error if evaluation of a constant |
1961 * object results in an uncaught exception being thrown. | 1828 * object results in an uncaught exception being thrown. |
1962 * | 1829 * |
1963 * @param requiredCount the expected number of required arguments | 1830 * @param requiredCount the expected number of required arguments |
1964 * @param argumentCount the actual number of positional arguments given | 1831 * @param argumentCount the actual number of positional arguments given |
1965 */ | 1832 */ |
1966 static const CompileTimeErrorCode NOT_ENOUGH_REQUIRED_ARGUMENTS = | 1833 static const CompileTimeErrorCode NOT_ENOUGH_REQUIRED_ARGUMENTS = |
1967 const CompileTimeErrorCode( | 1834 const CompileTimeErrorCode('NOT_ENOUGH_REQUIRED_ARGUMENTS', |
1968 'NOT_ENOUGH_REQUIRED_ARGUMENTS', | |
1969 "{0} required argument(s) expected, but {1} found"); | 1835 "{0} required argument(s) expected, but {1} found"); |
1970 | 1836 |
1971 /** | 1837 /** |
1972 * 7.6.1 Generative Constructors: Let <i>C</i> be the class in which the | 1838 * 7.6.1 Generative Constructors: Let <i>C</i> be the class in which the |
1973 * superinitializer appears and let <i>S</i> be the superclass of <i>C</i>. | 1839 * superinitializer appears and let <i>S</i> be the superclass of <i>C</i>. |
1974 * Let <i>k</i> be a generative constructor. It is a compile-time error if | 1840 * Let <i>k</i> be a generative constructor. It is a compile-time error if |
1975 * class <i>S</i> does not declare a generative constructor named <i>S</i> | 1841 * class <i>S</i> does not declare a generative constructor named <i>S</i> |
1976 * (respectively <i>S.id</i>) | 1842 * (respectively <i>S.id</i>) |
1977 */ | 1843 */ |
1978 static const CompileTimeErrorCode NON_GENERATIVE_CONSTRUCTOR = | 1844 static const CompileTimeErrorCode NON_GENERATIVE_CONSTRUCTOR = |
1979 const CompileTimeErrorCode( | 1845 const CompileTimeErrorCode('NON_GENERATIVE_CONSTRUCTOR', |
1980 'NON_GENERATIVE_CONSTRUCTOR', | |
1981 "The generative constructor '{0}' expected, but factory found"); | 1846 "The generative constructor '{0}' expected, but factory found"); |
1982 | 1847 |
1983 /** | 1848 /** |
1984 * 7.9 Superclasses: It is a compile-time error to specify an extends clause | 1849 * 7.9 Superclasses: It is a compile-time error to specify an extends clause |
1985 * for class Object. | 1850 * for class Object. |
1986 */ | 1851 */ |
1987 static const CompileTimeErrorCode OBJECT_CANNOT_EXTEND_ANOTHER_CLASS = | 1852 static const CompileTimeErrorCode OBJECT_CANNOT_EXTEND_ANOTHER_CLASS = |
1988 const CompileTimeErrorCode('OBJECT_CANNOT_EXTEND_ANOTHER_CLASS', ""); | 1853 const CompileTimeErrorCode('OBJECT_CANNOT_EXTEND_ANOTHER_CLASS', ""); |
1989 | 1854 |
1990 /** | 1855 /** |
1991 * 7.1.1 Operators: It is a compile-time error to declare an optional | 1856 * 7.1.1 Operators: It is a compile-time error to declare an optional |
1992 * parameter in an operator. | 1857 * parameter in an operator. |
1993 */ | 1858 */ |
1994 static const CompileTimeErrorCode OPTIONAL_PARAMETER_IN_OPERATOR = | 1859 static const CompileTimeErrorCode OPTIONAL_PARAMETER_IN_OPERATOR = |
1995 const CompileTimeErrorCode( | 1860 const CompileTimeErrorCode('OPTIONAL_PARAMETER_IN_OPERATOR', |
1996 'OPTIONAL_PARAMETER_IN_OPERATOR', | |
1997 "Optional parameters are not allowed when defining an operator"); | 1861 "Optional parameters are not allowed when defining an operator"); |
1998 | 1862 |
1999 /** | 1863 /** |
2000 * 14.3 Parts: It is a compile time error if the contents of the URI are not a | 1864 * 14.3 Parts: It is a compile time error if the contents of the URI are not a |
2001 * valid part declaration. | 1865 * valid part declaration. |
2002 * | 1866 * |
2003 * @param uri the uri pointing to a non-library declaration | 1867 * @param uri the uri pointing to a non-library declaration |
2004 */ | 1868 */ |
2005 static const CompileTimeErrorCode PART_OF_NON_PART = | 1869 static const CompileTimeErrorCode PART_OF_NON_PART = |
2006 const CompileTimeErrorCode( | 1870 const CompileTimeErrorCode('PART_OF_NON_PART', |
2007 'PART_OF_NON_PART', | |
2008 "The included part '{0}' must have a part-of directive"); | 1871 "The included part '{0}' must have a part-of directive"); |
2009 | 1872 |
2010 /** | 1873 /** |
2011 * 14.1 Imports: It is a compile-time error if the current library declares a | 1874 * 14.1 Imports: It is a compile-time error if the current library declares a |
2012 * top-level member named <i>p</i>. | 1875 * top-level member named <i>p</i>. |
2013 */ | 1876 */ |
2014 static const CompileTimeErrorCode PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER = | 1877 static const CompileTimeErrorCode PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER = |
2015 const CompileTimeErrorCode( | 1878 const CompileTimeErrorCode('PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER', |
2016 'PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER', | |
2017 "The name '{0}' is already used as an import prefix and cannot be used
to name a top-level element"); | 1879 "The name '{0}' is already used as an import prefix and cannot be used
to name a top-level element"); |
2018 | 1880 |
2019 /** | 1881 /** |
2020 * 6.2.2 Optional Formals: It is a compile-time error if the name of a named | 1882 * 6.2.2 Optional Formals: It is a compile-time error if the name of a named |
2021 * optional parameter begins with an '_' character. | 1883 * optional parameter begins with an '_' character. |
2022 */ | 1884 */ |
2023 static const CompileTimeErrorCode PRIVATE_OPTIONAL_PARAMETER = | 1885 static const CompileTimeErrorCode PRIVATE_OPTIONAL_PARAMETER = |
2024 const CompileTimeErrorCode( | 1886 const CompileTimeErrorCode('PRIVATE_OPTIONAL_PARAMETER', |
2025 'PRIVATE_OPTIONAL_PARAMETER', | |
2026 "Named optional parameters cannot start with an underscore"); | 1887 "Named optional parameters cannot start with an underscore"); |
2027 | 1888 |
2028 /** | 1889 /** |
2029 * 12.1 Constants: It is a compile-time error if the value of a compile-time | 1890 * 12.1 Constants: It is a compile-time error if the value of a compile-time |
2030 * constant expression depends on itself. | 1891 * constant expression depends on itself. |
2031 */ | 1892 */ |
2032 static const CompileTimeErrorCode RECURSIVE_COMPILE_TIME_CONSTANT = | 1893 static const CompileTimeErrorCode RECURSIVE_COMPILE_TIME_CONSTANT = |
2033 const CompileTimeErrorCode('RECURSIVE_COMPILE_TIME_CONSTANT', ""); | 1894 const CompileTimeErrorCode('RECURSIVE_COMPILE_TIME_CONSTANT', ""); |
2034 | 1895 |
2035 /** | 1896 /** |
2036 * 7.6.1 Generative Constructors: A generative constructor may be redirecting, | 1897 * 7.6.1 Generative Constructors: A generative constructor may be redirecting, |
2037 * in which case its only action is to invoke another generative constructor. | 1898 * in which case its only action is to invoke another generative constructor. |
2038 * | 1899 * |
2039 * TODO(scheglov) review this later, there are no explicit "it is a | 1900 * TODO(scheglov) review this later, there are no explicit "it is a |
2040 * compile-time error" in specification. But it was added to the co19 and | 1901 * compile-time error" in specification. But it was added to the co19 and |
2041 * there is same error for factories. | 1902 * there is same error for factories. |
2042 * | 1903 * |
2043 * https://code.google.com/p/dart/issues/detail?id=954 | 1904 * https://code.google.com/p/dart/issues/detail?id=954 |
2044 */ | 1905 */ |
2045 static const CompileTimeErrorCode RECURSIVE_CONSTRUCTOR_REDIRECT = | 1906 static const CompileTimeErrorCode RECURSIVE_CONSTRUCTOR_REDIRECT = |
2046 const CompileTimeErrorCode( | 1907 const CompileTimeErrorCode('RECURSIVE_CONSTRUCTOR_REDIRECT', |
2047 'RECURSIVE_CONSTRUCTOR_REDIRECT', | |
2048 "Cycle in redirecting generative constructors"); | 1908 "Cycle in redirecting generative constructors"); |
2049 | 1909 |
2050 /** | 1910 /** |
2051 * 7.6.2 Factories: It is a compile-time error if a redirecting factory | 1911 * 7.6.2 Factories: It is a compile-time error if a redirecting factory |
2052 * constructor redirects to itself, either directly or indirectly via a | 1912 * constructor redirects to itself, either directly or indirectly via a |
2053 * sequence of redirections. | 1913 * sequence of redirections. |
2054 */ | 1914 */ |
2055 static const CompileTimeErrorCode RECURSIVE_FACTORY_REDIRECT = | 1915 static const CompileTimeErrorCode RECURSIVE_FACTORY_REDIRECT = |
2056 const CompileTimeErrorCode( | 1916 const CompileTimeErrorCode('RECURSIVE_FACTORY_REDIRECT', |
2057 'RECURSIVE_FACTORY_REDIRECT', | |
2058 "Cycle in redirecting factory constructors"); | 1917 "Cycle in redirecting factory constructors"); |
2059 | 1918 |
2060 /** | 1919 /** |
2061 * 7.10 Superinterfaces: It is a compile-time error if the interface of a | 1920 * 7.10 Superinterfaces: It is a compile-time error if the interface of a |
2062 * class <i>C</i> is a superinterface of itself. | 1921 * class <i>C</i> is a superinterface of itself. |
2063 * | 1922 * |
2064 * 8.1 Superinterfaces: It is a compile-time error if an interface is a | 1923 * 8.1 Superinterfaces: It is a compile-time error if an interface is a |
2065 * superinterface of itself. | 1924 * superinterface of itself. |
2066 * | 1925 * |
2067 * 7.9 Superclasses: It is a compile-time error if a class <i>C</i> is a | 1926 * 7.9 Superclasses: It is a compile-time error if a class <i>C</i> is a |
2068 * superclass of itself. | 1927 * superclass of itself. |
2069 * | 1928 * |
2070 * @param className the name of the class that implements itself recursively | 1929 * @param className the name of the class that implements itself recursively |
2071 * @param strImplementsPath a string representation of the implements loop | 1930 * @param strImplementsPath a string representation of the implements loop |
2072 */ | 1931 */ |
2073 static const CompileTimeErrorCode RECURSIVE_INTERFACE_INHERITANCE = | 1932 static const CompileTimeErrorCode RECURSIVE_INTERFACE_INHERITANCE = |
2074 const CompileTimeErrorCode( | 1933 const CompileTimeErrorCode('RECURSIVE_INTERFACE_INHERITANCE', |
2075 'RECURSIVE_INTERFACE_INHERITANCE', | |
2076 "'{0}' cannot be a superinterface of itself: {1}"); | 1934 "'{0}' cannot be a superinterface of itself: {1}"); |
2077 | 1935 |
2078 /** | 1936 /** |
2079 * 7.10 Superinterfaces: It is a compile-time error if the interface of a | 1937 * 7.10 Superinterfaces: It is a compile-time error if the interface of a |
2080 * class <i>C</i> is a superinterface of itself. | 1938 * class <i>C</i> is a superinterface of itself. |
2081 * | 1939 * |
2082 * 8.1 Superinterfaces: It is a compile-time error if an interface is a | 1940 * 8.1 Superinterfaces: It is a compile-time error if an interface is a |
2083 * superinterface of itself. | 1941 * superinterface of itself. |
2084 * | 1942 * |
2085 * 7.9 Superclasses: It is a compile-time error if a class <i>C</i> is a | 1943 * 7.9 Superclasses: It is a compile-time error if a class <i>C</i> is a |
2086 * superclass of itself. | 1944 * superclass of itself. |
2087 * | 1945 * |
2088 * @param className the name of the class that implements itself recursively | 1946 * @param className the name of the class that implements itself recursively |
2089 */ | 1947 */ |
2090 static const CompileTimeErrorCode | 1948 static const CompileTimeErrorCode RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_EX
TENDS = |
2091 RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_EXTENDS = | |
2092 const CompileTimeErrorCode( | 1949 const CompileTimeErrorCode( |
2093 'RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_EXTENDS', | 1950 'RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_EXTENDS', |
2094 "'{0}' cannot extend itself"); | 1951 "'{0}' cannot extend itself"); |
2095 | 1952 |
2096 /** | 1953 /** |
2097 * 7.10 Superinterfaces: It is a compile-time error if the interface of a | 1954 * 7.10 Superinterfaces: It is a compile-time error if the interface of a |
2098 * class <i>C</i> is a superinterface of itself. | 1955 * class <i>C</i> is a superinterface of itself. |
2099 * | 1956 * |
2100 * 8.1 Superinterfaces: It is a compile-time error if an interface is a | 1957 * 8.1 Superinterfaces: It is a compile-time error if an interface is a |
2101 * superinterface of itself. | 1958 * superinterface of itself. |
2102 * | 1959 * |
2103 * 7.9 Superclasses: It is a compile-time error if a class <i>C</i> is a | 1960 * 7.9 Superclasses: It is a compile-time error if a class <i>C</i> is a |
2104 * superclass of itself. | 1961 * superclass of itself. |
2105 * | 1962 * |
2106 * @param className the name of the class that implements itself recursively | 1963 * @param className the name of the class that implements itself recursively |
2107 */ | 1964 */ |
2108 static const CompileTimeErrorCode | 1965 static const CompileTimeErrorCode RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_IM
PLEMENTS = |
2109 RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_IMPLEMENTS = | |
2110 const CompileTimeErrorCode( | 1966 const CompileTimeErrorCode( |
2111 'RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_IMPLEMENTS', | 1967 'RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_IMPLEMENTS', |
2112 "'{0}' cannot implement itself"); | 1968 "'{0}' cannot implement itself"); |
2113 | 1969 |
2114 /** | 1970 /** |
2115 * 7.10 Superinterfaces: It is a compile-time error if the interface of a | 1971 * 7.10 Superinterfaces: It is a compile-time error if the interface of a |
2116 * class <i>C</i> is a superinterface of itself. | 1972 * class <i>C</i> is a superinterface of itself. |
2117 * | 1973 * |
2118 * 8.1 Superinterfaces: It is a compile-time error if an interface is a | 1974 * 8.1 Superinterfaces: It is a compile-time error if an interface is a |
2119 * superinterface of itself. | 1975 * superinterface of itself. |
2120 * | 1976 * |
2121 * 7.9 Superclasses: It is a compile-time error if a class <i>C</i> is a | 1977 * 7.9 Superclasses: It is a compile-time error if a class <i>C</i> is a |
2122 * superclass of itself. | 1978 * superclass of itself. |
2123 * | 1979 * |
2124 * @param className the name of the class that implements itself recursively | 1980 * @param className the name of the class that implements itself recursively |
2125 */ | 1981 */ |
2126 static const CompileTimeErrorCode | 1982 static const CompileTimeErrorCode RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_WI
TH = |
2127 RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_WITH = | |
2128 const CompileTimeErrorCode( | 1983 const CompileTimeErrorCode( |
2129 'RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_WITH', | 1984 'RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_WITH', |
2130 "'{0}' cannot use itself as a mixin"); | 1985 "'{0}' cannot use itself as a mixin"); |
2131 | 1986 |
2132 /** | 1987 /** |
2133 * 7.6.2 Factories: It is a compile-time error if <i>k</i> is prefixed with | 1988 * 7.6.2 Factories: It is a compile-time error if <i>k</i> is prefixed with |
2134 * the const modifier but <i>k'</i> is not a constant constructor. | 1989 * the const modifier but <i>k'</i> is not a constant constructor. |
2135 */ | 1990 */ |
2136 static const CompileTimeErrorCode REDIRECT_TO_MISSING_CONSTRUCTOR = | 1991 static const CompileTimeErrorCode REDIRECT_TO_MISSING_CONSTRUCTOR = |
2137 const CompileTimeErrorCode( | 1992 const CompileTimeErrorCode('REDIRECT_TO_MISSING_CONSTRUCTOR', |
2138 'REDIRECT_TO_MISSING_CONSTRUCTOR', | |
2139 "The constructor '{0}' could not be found in '{1}'"); | 1993 "The constructor '{0}' could not be found in '{1}'"); |
2140 | 1994 |
2141 /** | 1995 /** |
2142 * 7.6.2 Factories: It is a compile-time error if <i>k</i> is prefixed with | 1996 * 7.6.2 Factories: It is a compile-time error if <i>k</i> is prefixed with |
2143 * the const modifier but <i>k'</i> is not a constant constructor. | 1997 * the const modifier but <i>k'</i> is not a constant constructor. |
2144 */ | 1998 */ |
2145 static const CompileTimeErrorCode REDIRECT_TO_NON_CLASS = | 1999 static const CompileTimeErrorCode REDIRECT_TO_NON_CLASS = |
2146 const CompileTimeErrorCode( | 2000 const CompileTimeErrorCode('REDIRECT_TO_NON_CLASS', |
2147 'REDIRECT_TO_NON_CLASS', | |
2148 "The name '{0}' is not a type and cannot be used in a redirected const
ructor"); | 2001 "The name '{0}' is not a type and cannot be used in a redirected const
ructor"); |
2149 | 2002 |
2150 /** | 2003 /** |
2151 * 7.6.2 Factories: It is a compile-time error if <i>k</i> is prefixed with | 2004 * 7.6.2 Factories: It is a compile-time error if <i>k</i> is prefixed with |
2152 * the const modifier but <i>k'</i> is not a constant constructor. | 2005 * the const modifier but <i>k'</i> is not a constant constructor. |
2153 */ | 2006 */ |
2154 static const CompileTimeErrorCode REDIRECT_TO_NON_CONST_CONSTRUCTOR = | 2007 static const CompileTimeErrorCode REDIRECT_TO_NON_CONST_CONSTRUCTOR = |
2155 const CompileTimeErrorCode( | 2008 const CompileTimeErrorCode('REDIRECT_TO_NON_CONST_CONSTRUCTOR', |
2156 'REDIRECT_TO_NON_CONST_CONSTRUCTOR', | |
2157 "Constant factory constructor cannot delegate to a non-constant constr
uctor"); | 2009 "Constant factory constructor cannot delegate to a non-constant constr
uctor"); |
2158 | 2010 |
2159 /** | 2011 /** |
2160 * 7.6.1 Generative constructors: A generative constructor may be | 2012 * 7.6.1 Generative constructors: A generative constructor may be |
2161 * <i>redirecting</i>, in which case its only action is to invoke another | 2013 * <i>redirecting</i>, in which case its only action is to invoke another |
2162 * generative constructor. | 2014 * generative constructor. |
2163 */ | 2015 */ |
2164 static const CompileTimeErrorCode REDIRECT_GENERATIVE_TO_MISSING_CONSTRUCTOR = | 2016 static const CompileTimeErrorCode REDIRECT_GENERATIVE_TO_MISSING_CONSTRUCTOR = |
2165 const CompileTimeErrorCode( | 2017 const CompileTimeErrorCode('REDIRECT_GENERATIVE_TO_MISSING_CONSTRUCTOR', |
2166 'REDIRECT_GENERATIVE_TO_MISSING_CONSTRUCTOR', | |
2167 "The constructor '{0}' could not be found in '{1}'"); | 2018 "The constructor '{0}' could not be found in '{1}'"); |
2168 | 2019 |
2169 /** | 2020 /** |
2170 * 7.6.1 Generative constructors: A generative constructor may be | 2021 * 7.6.1 Generative constructors: A generative constructor may be |
2171 * <i>redirecting</i>, in which case its only action is to invoke another | 2022 * <i>redirecting</i>, in which case its only action is to invoke another |
2172 * generative constructor. | 2023 * generative constructor. |
2173 */ | 2024 */ |
2174 static const CompileTimeErrorCode | 2025 static const CompileTimeErrorCode REDIRECT_GENERATIVE_TO_NON_GENERATIVE_CONSTR
UCTOR = |
2175 REDIRECT_GENERATIVE_TO_NON_GENERATIVE_CONSTRUCTOR = | |
2176 const CompileTimeErrorCode( | 2026 const CompileTimeErrorCode( |
2177 'REDIRECT_GENERATIVE_TO_NON_GENERATIVE_CONSTRUCTOR', | 2027 'REDIRECT_GENERATIVE_TO_NON_GENERATIVE_CONSTRUCTOR', |
2178 "Generative constructor cannot redirect to a factory constructor"); | 2028 "Generative constructor cannot redirect to a factory constructor"); |
2179 | 2029 |
2180 /** | 2030 /** |
2181 * 5 Variables: A local variable may only be referenced at a source code | 2031 * 5 Variables: A local variable may only be referenced at a source code |
2182 * location that is after its initializer, if any, is complete, or a | 2032 * location that is after its initializer, if any, is complete, or a |
2183 * compile-time error occurs. | 2033 * compile-time error occurs. |
2184 */ | 2034 */ |
2185 static const CompileTimeErrorCode REFERENCED_BEFORE_DECLARATION = | 2035 static const CompileTimeErrorCode REFERENCED_BEFORE_DECLARATION = |
2186 const CompileTimeErrorCode( | 2036 const CompileTimeErrorCode('REFERENCED_BEFORE_DECLARATION', |
2187 'REFERENCED_BEFORE_DECLARATION', | |
2188 "Local variables cannot be referenced before they are declared"); | 2037 "Local variables cannot be referenced before they are declared"); |
2189 | 2038 |
2190 /** | 2039 /** |
2191 * 12.8.1 Rethrow: It is a compile-time error if an expression of the form | 2040 * 12.8.1 Rethrow: It is a compile-time error if an expression of the form |
2192 * <i>rethrow;</i> is not enclosed within a on-catch clause. | 2041 * <i>rethrow;</i> is not enclosed within a on-catch clause. |
2193 */ | 2042 */ |
2194 static const CompileTimeErrorCode RETHROW_OUTSIDE_CATCH = | 2043 static const CompileTimeErrorCode RETHROW_OUTSIDE_CATCH = |
2195 const CompileTimeErrorCode( | 2044 const CompileTimeErrorCode( |
2196 'RETHROW_OUTSIDE_CATCH', | 2045 'RETHROW_OUTSIDE_CATCH', "rethrow must be inside of a catch clause"); |
2197 "rethrow must be inside of a catch clause"); | |
2198 | 2046 |
2199 /** | 2047 /** |
2200 * 13.12 Return: It is a compile-time error if a return statement of the form | 2048 * 13.12 Return: It is a compile-time error if a return statement of the form |
2201 * <i>return e;</i> appears in a generative constructor. | 2049 * <i>return e;</i> appears in a generative constructor. |
2202 */ | 2050 */ |
2203 static const CompileTimeErrorCode RETURN_IN_GENERATIVE_CONSTRUCTOR = | 2051 static const CompileTimeErrorCode RETURN_IN_GENERATIVE_CONSTRUCTOR = |
2204 const CompileTimeErrorCode( | 2052 const CompileTimeErrorCode('RETURN_IN_GENERATIVE_CONSTRUCTOR', |
2205 'RETURN_IN_GENERATIVE_CONSTRUCTOR', | |
2206 "Constructors cannot return a value"); | 2053 "Constructors cannot return a value"); |
2207 | 2054 |
2208 /** | 2055 /** |
2209 * 13.12 Return: It is a compile-time error if a return statement of the form | 2056 * 13.12 Return: It is a compile-time error if a return statement of the form |
2210 * <i>return e;</i> appears in a generator function. | 2057 * <i>return e;</i> appears in a generator function. |
2211 */ | 2058 */ |
2212 static const CompileTimeErrorCode RETURN_IN_GENERATOR = | 2059 static const CompileTimeErrorCode RETURN_IN_GENERATOR = |
2213 const CompileTimeErrorCode( | 2060 const CompileTimeErrorCode('RETURN_IN_GENERATOR', |
2214 'RETURN_IN_GENERATOR', | |
2215 "Cannot return a value from a generator function (one marked with eith
er 'async*' or 'sync*')"); | 2061 "Cannot return a value from a generator function (one marked with eith
er 'async*' or 'sync*')"); |
2216 | 2062 |
2217 /** | 2063 /** |
2218 * 14.1 Imports: It is a compile-time error if a prefix used in a deferred | 2064 * 14.1 Imports: It is a compile-time error if a prefix used in a deferred |
2219 * import is used in another import clause. | 2065 * import is used in another import clause. |
2220 */ | 2066 */ |
2221 static const CompileTimeErrorCode SHARED_DEFERRED_PREFIX = | 2067 static const CompileTimeErrorCode SHARED_DEFERRED_PREFIX = |
2222 const CompileTimeErrorCode( | 2068 const CompileTimeErrorCode('SHARED_DEFERRED_PREFIX', |
2223 'SHARED_DEFERRED_PREFIX', | |
2224 "The prefix of a deferred import cannot be used in other import direct
ives"); | 2069 "The prefix of a deferred import cannot be used in other import direct
ives"); |
2225 | 2070 |
2226 /** | 2071 /** |
2227 * 12.15.4 Super Invocation: A super method invocation <i>i</i> has the form | 2072 * 12.15.4 Super Invocation: A super method invocation <i>i</i> has the form |
2228 * <i>super.m(a<sub>1</sub>, …, a<sub>n</sub>, x<sub>n+1</sub>: | 2073 * <i>super.m(a<sub>1</sub>, …, a<sub>n</sub>, x<sub>n+1</sub>: |
2229 * a<sub>n+1</sub>, … x<sub>n+k</sub>: a<sub>n+k</sub>)</i>. It is a | 2074 * a<sub>n+1</sub>, … x<sub>n+k</sub>: a<sub>n+k</sub>)</i>. It is a |
2230 * compile-time error if a super method invocation occurs in a top-level | 2075 * compile-time error if a super method invocation occurs in a top-level |
2231 * function or variable initializer, in an instance variable initializer or | 2076 * function or variable initializer, in an instance variable initializer or |
2232 * initializer list, in class Object, in a factory constructor, or in a static | 2077 * initializer list, in class Object, in a factory constructor, or in a static |
2233 * method or variable initializer. | 2078 * method or variable initializer. |
2234 */ | 2079 */ |
2235 static const CompileTimeErrorCode SUPER_IN_INVALID_CONTEXT = | 2080 static const CompileTimeErrorCode SUPER_IN_INVALID_CONTEXT = |
2236 const CompileTimeErrorCode( | 2081 const CompileTimeErrorCode( |
2237 'SUPER_IN_INVALID_CONTEXT', | 2082 'SUPER_IN_INVALID_CONTEXT', "Invalid context for 'super' invocation"); |
2238 "Invalid context for 'super' invocation"); | |
2239 | 2083 |
2240 /** | 2084 /** |
2241 * 7.6.1 Generative Constructors: A generative constructor may be redirecting, | 2085 * 7.6.1 Generative Constructors: A generative constructor may be redirecting, |
2242 * in which case its only action is to invoke another generative constructor. | 2086 * in which case its only action is to invoke another generative constructor. |
2243 */ | 2087 */ |
2244 static const CompileTimeErrorCode SUPER_IN_REDIRECTING_CONSTRUCTOR = | 2088 static const CompileTimeErrorCode SUPER_IN_REDIRECTING_CONSTRUCTOR = |
2245 const CompileTimeErrorCode( | 2089 const CompileTimeErrorCode('SUPER_IN_REDIRECTING_CONSTRUCTOR', |
2246 'SUPER_IN_REDIRECTING_CONSTRUCTOR', | |
2247 "The redirecting constructor cannot have a 'super' initializer"); | 2090 "The redirecting constructor cannot have a 'super' initializer"); |
2248 | 2091 |
2249 /** | 2092 /** |
2250 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It | 2093 * 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It |
2251 * is a compile-time error if a generative constructor of class Object | 2094 * is a compile-time error if a generative constructor of class Object |
2252 * includes a superinitializer. | 2095 * includes a superinitializer. |
2253 */ | 2096 */ |
2254 static const CompileTimeErrorCode SUPER_INITIALIZER_IN_OBJECT = | 2097 static const CompileTimeErrorCode SUPER_INITIALIZER_IN_OBJECT = |
2255 const CompileTimeErrorCode('SUPER_INITIALIZER_IN_OBJECT', ""); | 2098 const CompileTimeErrorCode('SUPER_INITIALIZER_IN_OBJECT', ""); |
2256 | 2099 |
(...skipping 10 matching lines...) Expand all Loading... |
2267 * constant would raise an exception. | 2110 * constant would raise an exception. |
2268 * | 2111 * |
2269 * @param boundedTypeName the name of the type used in the instance creation | 2112 * @param boundedTypeName the name of the type used in the instance creation |
2270 * that should be limited by the bound as specified in the class | 2113 * that should be limited by the bound as specified in the class |
2271 * declaration | 2114 * declaration |
2272 * @param boundingTypeName the name of the bounding type | 2115 * @param boundingTypeName the name of the bounding type |
2273 * See [StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]. | 2116 * See [StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]. |
2274 */ | 2117 */ |
2275 static const CompileTimeErrorCode TYPE_ARGUMENT_NOT_MATCHING_BOUNDS = | 2118 static const CompileTimeErrorCode TYPE_ARGUMENT_NOT_MATCHING_BOUNDS = |
2276 const CompileTimeErrorCode( | 2119 const CompileTimeErrorCode( |
2277 'TYPE_ARGUMENT_NOT_MATCHING_BOUNDS', | 2120 'TYPE_ARGUMENT_NOT_MATCHING_BOUNDS', "'{0}' does not extend '{1}'"); |
2278 "'{0}' does not extend '{1}'"); | |
2279 | 2121 |
2280 /** | 2122 /** |
2281 * 15.3.1 Typedef: Any self reference, either directly, or recursively via | 2123 * 15.3.1 Typedef: Any self reference, either directly, or recursively via |
2282 * another typedef, is a compile time error. | 2124 * another typedef, is a compile time error. |
2283 */ | 2125 */ |
2284 static const CompileTimeErrorCode TYPE_ALIAS_CANNOT_REFERENCE_ITSELF = | 2126 static const CompileTimeErrorCode TYPE_ALIAS_CANNOT_REFERENCE_ITSELF = |
2285 const CompileTimeErrorCode( | 2127 const CompileTimeErrorCode('TYPE_ALIAS_CANNOT_REFERENCE_ITSELF', |
2286 'TYPE_ALIAS_CANNOT_REFERENCE_ITSELF', | |
2287 "Type alias cannot reference itself directly or recursively via anothe
r typedef"); | 2128 "Type alias cannot reference itself directly or recursively via anothe
r typedef"); |
2288 | 2129 |
2289 /** | 2130 /** |
2290 * 12.11.2 Const: It is a compile-time error if <i>T</i> is not a class | 2131 * 12.11.2 Const: It is a compile-time error if <i>T</i> is not a class |
2291 * accessible in the current scope, optionally followed by type arguments. | 2132 * accessible in the current scope, optionally followed by type arguments. |
2292 */ | 2133 */ |
2293 static const CompileTimeErrorCode UNDEFINED_CLASS = | 2134 static const CompileTimeErrorCode UNDEFINED_CLASS = |
2294 const CompileTimeErrorCode('UNDEFINED_CLASS', "Undefined class '{0}'"); | 2135 const CompileTimeErrorCode('UNDEFINED_CLASS', "Undefined class '{0}'"); |
2295 | 2136 |
2296 /** | 2137 /** |
2297 * 7.6.1 Generative Constructors: Let <i>C</i> be the class in which the | 2138 * 7.6.1 Generative Constructors: Let <i>C</i> be the class in which the |
2298 * superinitializer appears and let <i>S</i> be the superclass of <i>C</i>. | 2139 * superinitializer appears and let <i>S</i> be the superclass of <i>C</i>. |
2299 * Let <i>k</i> be a generative constructor. It is a compile-time error if | 2140 * Let <i>k</i> be a generative constructor. It is a compile-time error if |
2300 * class <i>S</i> does not declare a generative constructor named <i>S</i> | 2141 * class <i>S</i> does not declare a generative constructor named <i>S</i> |
2301 * (respectively <i>S.id</i>) | 2142 * (respectively <i>S.id</i>) |
2302 */ | 2143 */ |
2303 static const CompileTimeErrorCode UNDEFINED_CONSTRUCTOR_IN_INITIALIZER = | 2144 static const CompileTimeErrorCode UNDEFINED_CONSTRUCTOR_IN_INITIALIZER = |
2304 const CompileTimeErrorCode( | 2145 const CompileTimeErrorCode('UNDEFINED_CONSTRUCTOR_IN_INITIALIZER', |
2305 'UNDEFINED_CONSTRUCTOR_IN_INITIALIZER', | |
2306 "The class '{0}' does not have a generative constructor '{1}'"); | 2146 "The class '{0}' does not have a generative constructor '{1}'"); |
2307 | 2147 |
2308 /** | 2148 /** |
2309 * 7.6.1 Generative Constructors: Let <i>C</i> be the class in which the | 2149 * 7.6.1 Generative Constructors: Let <i>C</i> be the class in which the |
2310 * superinitializer appears and let <i>S</i> be the superclass of <i>C</i>. | 2150 * superinitializer appears and let <i>S</i> be the superclass of <i>C</i>. |
2311 * Let <i>k</i> be a generative constructor. It is a compile-time error if | 2151 * Let <i>k</i> be a generative constructor. It is a compile-time error if |
2312 * class <i>S</i> does not declare a generative constructor named <i>S</i> | 2152 * class <i>S</i> does not declare a generative constructor named <i>S</i> |
2313 * (respectively <i>S.id</i>) | 2153 * (respectively <i>S.id</i>) |
2314 */ | 2154 */ |
2315 static const CompileTimeErrorCode UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT | 2155 static const CompileTimeErrorCode UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT
= |
2316 = | 2156 const CompileTimeErrorCode('UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT', |
2317 const CompileTimeErrorCode( | |
2318 'UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT', | |
2319 "The class '{0}' does not have a default generative constructor"); | 2157 "The class '{0}' does not have a default generative constructor"); |
2320 | 2158 |
2321 /** | 2159 /** |
2322 * 12.14.2 Binding Actuals to Formals: Furthermore, each <i>q<sub>i</sub></i>, | 2160 * 12.14.2 Binding Actuals to Formals: Furthermore, each <i>q<sub>i</sub></i>, |
2323 * <i>1<=i<=l</i>, must have a corresponding named parameter in the set | 2161 * <i>1<=i<=l</i>, must have a corresponding named parameter in the set |
2324 * {<i>p<sub>n+1</sub></i> ... <i>p<sub>n+k</sub></i>} or a static warning | 2162 * {<i>p<sub>n+1</sub></i> ... <i>p<sub>n+k</sub></i>} or a static warning |
2325 * occurs. | 2163 * occurs. |
2326 * | 2164 * |
2327 * 12.11.2 Const: It is a compile-time error if evaluation of a constant | 2165 * 12.11.2 Const: It is a compile-time error if evaluation of a constant |
2328 * object results in an uncaught exception being thrown. | 2166 * object results in an uncaught exception being thrown. |
2329 * | 2167 * |
2330 * @param name the name of the requested named parameter | 2168 * @param name the name of the requested named parameter |
2331 */ | 2169 */ |
2332 static const CompileTimeErrorCode UNDEFINED_NAMED_PARAMETER = | 2170 static const CompileTimeErrorCode UNDEFINED_NAMED_PARAMETER = |
2333 const CompileTimeErrorCode( | 2171 const CompileTimeErrorCode('UNDEFINED_NAMED_PARAMETER', |
2334 'UNDEFINED_NAMED_PARAMETER', | |
2335 "The named parameter '{0}' is not defined"); | 2172 "The named parameter '{0}' is not defined"); |
2336 | 2173 |
2337 /** | 2174 /** |
2338 * 14.2 Exports: It is a compile-time error if the compilation unit found at | 2175 * 14.2 Exports: It is a compile-time error if the compilation unit found at |
2339 * the specified URI is not a library declaration. | 2176 * the specified URI is not a library declaration. |
2340 * | 2177 * |
2341 * 14.1 Imports: It is a compile-time error if the compilation unit found at | 2178 * 14.1 Imports: It is a compile-time error if the compilation unit found at |
2342 * the specified URI is not a library declaration. | 2179 * the specified URI is not a library declaration. |
2343 * | 2180 * |
2344 * 14.3 Parts: It is a compile time error if the contents of the URI are not a | 2181 * 14.3 Parts: It is a compile time error if the contents of the URI are not a |
2345 * valid part declaration. | 2182 * valid part declaration. |
2346 * | 2183 * |
2347 * @param uri the URI pointing to a non-existent file | 2184 * @param uri the URI pointing to a non-existent file |
2348 * See [INVALID_URI]. | 2185 * See [INVALID_URI]. |
2349 */ | 2186 */ |
2350 static const CompileTimeErrorCode URI_DOES_NOT_EXIST = | 2187 static const CompileTimeErrorCode URI_DOES_NOT_EXIST = |
2351 const CompileTimeErrorCode( | 2188 const CompileTimeErrorCode( |
2352 'URI_DOES_NOT_EXIST', | 2189 'URI_DOES_NOT_EXIST', "Target of URI does not exist: '{0}'"); |
2353 "Target of URI does not exist: '{0}'"); | |
2354 | 2190 |
2355 /** | 2191 /** |
2356 * 14.1 Imports: It is a compile-time error if <i>x</i> is not a compile-time | 2192 * 14.1 Imports: It is a compile-time error if <i>x</i> is not a compile-time |
2357 * constant, or if <i>x</i> involves string interpolation. | 2193 * constant, or if <i>x</i> involves string interpolation. |
2358 * | 2194 * |
2359 * 14.3 Parts: It is a compile-time error if <i>s</i> is not a compile-time | 2195 * 14.3 Parts: It is a compile-time error if <i>s</i> is not a compile-time |
2360 * constant, or if <i>s</i> involves string interpolation. | 2196 * constant, or if <i>s</i> involves string interpolation. |
2361 * | 2197 * |
2362 * 14.5 URIs: It is a compile-time error if the string literal <i>x</i> that | 2198 * 14.5 URIs: It is a compile-time error if the string literal <i>x</i> that |
2363 * describes a URI is not a compile-time constant, or if <i>x</i> involves | 2199 * describes a URI is not a compile-time constant, or if <i>x</i> involves |
2364 * string interpolation. | 2200 * string interpolation. |
2365 */ | 2201 */ |
2366 static const CompileTimeErrorCode URI_WITH_INTERPOLATION = | 2202 static const CompileTimeErrorCode URI_WITH_INTERPOLATION = |
2367 const CompileTimeErrorCode( | 2203 const CompileTimeErrorCode( |
2368 'URI_WITH_INTERPOLATION', | 2204 'URI_WITH_INTERPOLATION', "URIs cannot use string interpolation"); |
2369 "URIs cannot use string interpolation"); | |
2370 | 2205 |
2371 /** | 2206 /** |
2372 * 7.1.1 Operators: It is a compile-time error if the arity of the | 2207 * 7.1.1 Operators: It is a compile-time error if the arity of the |
2373 * user-declared operator []= is not 2. It is a compile time error if the | 2208 * user-declared operator []= is not 2. It is a compile time error if the |
2374 * arity of a user-declared operator with one of the names: <, >, <=, | 2209 * arity of a user-declared operator with one of the names: <, >, <=, |
2375 * >=, ==, +, /, ~/, *, %, |, ^, &, <<, >>, [] is not 1. It is | 2210 * >=, ==, +, /, ~/, *, %, |, ^, &, <<, >>, [] is not 1. It is |
2376 * a compile time error if the arity of the user-declared operator - is not 0 | 2211 * a compile time error if the arity of the user-declared operator - is not 0 |
2377 * or 1. It is a compile time error if the arity of the user-declared operator | 2212 * or 1. It is a compile time error if the arity of the user-declared operator |
2378 * ~ is not 0. | 2213 * ~ is not 0. |
2379 * | 2214 * |
2380 * @param operatorName the name of the declared operator | 2215 * @param operatorName the name of the declared operator |
2381 * @param expectedNumberOfParameters the number of parameters expected | 2216 * @param expectedNumberOfParameters the number of parameters expected |
2382 * @param actualNumberOfParameters the number of parameters found in the | 2217 * @param actualNumberOfParameters the number of parameters found in the |
2383 * operator declaration | 2218 * operator declaration |
2384 */ | 2219 */ |
2385 static const CompileTimeErrorCode WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR = | 2220 static const CompileTimeErrorCode WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR = |
2386 const CompileTimeErrorCode( | 2221 const CompileTimeErrorCode('WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR', |
2387 'WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR', | |
2388 "Operator '{0}' should declare exactly {1} parameter(s), but {2} found
"); | 2222 "Operator '{0}' should declare exactly {1} parameter(s), but {2} found
"); |
2389 | 2223 |
2390 /** | 2224 /** |
2391 * 7.1.1 Operators: It is a compile time error if the arity of the | 2225 * 7.1.1 Operators: It is a compile time error if the arity of the |
2392 * user-declared operator - is not 0 or 1. | 2226 * user-declared operator - is not 0 or 1. |
2393 * | 2227 * |
2394 * @param actualNumberOfParameters the number of parameters found in the | 2228 * @param actualNumberOfParameters the number of parameters found in the |
2395 * operator declaration | 2229 * operator declaration |
2396 */ | 2230 */ |
2397 static const CompileTimeErrorCode | 2231 static const CompileTimeErrorCode WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR_MINU
S = |
2398 WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR_MINUS = | |
2399 const CompileTimeErrorCode( | 2232 const CompileTimeErrorCode( |
2400 'WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR_MINUS', | 2233 'WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR_MINUS', |
2401 "Operator '-' should declare 0 or 1 parameter, but {0} found"); | 2234 "Operator '-' should declare 0 or 1 parameter, but {0} found"); |
2402 | 2235 |
2403 /** | 2236 /** |
2404 * 7.3 Setters: It is a compile-time error if a setter's formal parameter list | 2237 * 7.3 Setters: It is a compile-time error if a setter's formal parameter list |
2405 * does not include exactly one required formal parameter <i>p</i>. | 2238 * does not include exactly one required formal parameter <i>p</i>. |
2406 */ | 2239 */ |
2407 static const CompileTimeErrorCode WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER = | 2240 static const CompileTimeErrorCode WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER = |
2408 const CompileTimeErrorCode( | 2241 const CompileTimeErrorCode('WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER', |
2409 'WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER', | |
2410 "Setters should declare exactly one required parameter"); | 2242 "Setters should declare exactly one required parameter"); |
2411 | 2243 |
2412 /** | 2244 /** |
2413 * ?? Yield: It is a compile-time error if a yield statement appears in a | 2245 * ?? Yield: It is a compile-time error if a yield statement appears in a |
2414 * function that is not a generator function. | 2246 * function that is not a generator function. |
2415 */ | 2247 */ |
2416 static const CompileTimeErrorCode YIELD_EACH_IN_NON_GENERATOR = | 2248 static const CompileTimeErrorCode YIELD_EACH_IN_NON_GENERATOR = |
2417 const CompileTimeErrorCode( | 2249 const CompileTimeErrorCode('YIELD_EACH_IN_NON_GENERATOR', |
2418 'YIELD_EACH_IN_NON_GENERATOR', | |
2419 "Yield-each statements must be in a generator function (one marked wit
h either 'async*' or 'sync*')"); | 2250 "Yield-each statements must be in a generator function (one marked wit
h either 'async*' or 'sync*')"); |
2420 | 2251 |
2421 /** | 2252 /** |
2422 * ?? Yield: It is a compile-time error if a yield statement appears in a | 2253 * ?? Yield: It is a compile-time error if a yield statement appears in a |
2423 * function that is not a generator function. | 2254 * function that is not a generator function. |
2424 */ | 2255 */ |
2425 static const CompileTimeErrorCode YIELD_IN_NON_GENERATOR = | 2256 static const CompileTimeErrorCode YIELD_IN_NON_GENERATOR = |
2426 const CompileTimeErrorCode( | 2257 const CompileTimeErrorCode('YIELD_IN_NON_GENERATOR', |
2427 'YIELD_IN_NON_GENERATOR', | |
2428 "Yield statements must be in a generator function (one marked with eit
her 'async*' or 'sync*')"); | 2258 "Yield statements must be in a generator function (one marked with eit
her 'async*' or 'sync*')"); |
2429 | 2259 |
2430 /** | 2260 /** |
2431 * Initialize a newly created error code to have the given [name]. The message | 2261 * Initialize a newly created error code to have the given [name]. The message |
2432 * associated with the error will be created from the given [message] | 2262 * associated with the error will be created from the given [message] |
2433 * template. The correction associated with the error will be created from the | 2263 * template. The correction associated with the error will be created from the |
2434 * given [correction] template. | 2264 * given [correction] template. |
2435 */ | 2265 */ |
2436 const CompileTimeErrorCode(String name, String message, [String correction]) | 2266 const CompileTimeErrorCode(String name, String message, [String correction]) |
2437 : super(name, message, correction); | 2267 : super(name, message, correction); |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2566 this._source = source == null ? _defaultSource : source; | 2396 this._source = source == null ? _defaultSource : source; |
2567 } | 2397 } |
2568 | 2398 |
2569 /** | 2399 /** |
2570 * Creates an error with properties with the given error code and arguments. | 2400 * Creates an error with properties with the given error code and arguments. |
2571 * | 2401 * |
2572 * @param errorCode the error code of the error to be reported | 2402 * @param errorCode the error code of the error to be reported |
2573 * @param node the node specifying the location of the error | 2403 * @param node the node specifying the location of the error |
2574 * @param arguments the arguments to the error, used to compose the error mess
age | 2404 * @param arguments the arguments to the error, used to compose the error mess
age |
2575 */ | 2405 */ |
2576 AnalysisErrorWithProperties newErrorWithProperties(ErrorCode errorCode, | 2406 AnalysisErrorWithProperties newErrorWithProperties( |
2577 AstNode node, List<Object> arguments) => | 2407 ErrorCode errorCode, AstNode node, List<Object> arguments) => |
2578 new AnalysisErrorWithProperties.con2( | 2408 new AnalysisErrorWithProperties.con2( |
2579 _source, | 2409 _source, node.offset, node.length, errorCode, arguments); |
2580 node.offset, | |
2581 node.length, | |
2582 errorCode, | |
2583 arguments); | |
2584 | 2410 |
2585 /** | 2411 /** |
2586 * Report a passed error. | 2412 * Report a passed error. |
2587 * | 2413 * |
2588 * @param error the error to report | 2414 * @param error the error to report |
2589 */ | 2415 */ |
2590 void reportError(AnalysisError error) { | 2416 void reportError(AnalysisError error) { |
2591 _errorListener.onError(error); | 2417 _errorListener.onError(error); |
2592 } | 2418 } |
2593 | 2419 |
2594 /** | 2420 /** |
2595 * Report an error with the given error code and arguments. | 2421 * Report an error with the given error code and arguments. |
2596 * | 2422 * |
2597 * @param errorCode the error code of the error to be reported | 2423 * @param errorCode the error code of the error to be reported |
2598 * @param element the element which name should be used as the location of the
error | 2424 * @param element the element which name should be used as the location of the
error |
2599 * @param arguments the arguments to the error, used to compose the error mess
age | 2425 * @param arguments the arguments to the error, used to compose the error mess
age |
2600 */ | 2426 */ |
2601 void reportErrorForElement(ErrorCode errorCode, Element element, | 2427 void reportErrorForElement( |
2602 List<Object> arguments) { | 2428 ErrorCode errorCode, Element element, List<Object> arguments) { |
2603 reportErrorForOffset( | 2429 reportErrorForOffset( |
2604 errorCode, | 2430 errorCode, element.nameOffset, element.displayName.length, arguments); |
2605 element.nameOffset, | |
2606 element.displayName.length, | |
2607 arguments); | |
2608 } | 2431 } |
2609 | 2432 |
2610 /** | 2433 /** |
2611 * Report an error with the given error code and arguments. | 2434 * Report an error with the given error code and arguments. |
2612 * | 2435 * |
2613 * If the arguments contain the names of two or more types, the method | 2436 * If the arguments contain the names of two or more types, the method |
2614 * [reportTypeErrorForNode] should be used and the types | 2437 * [reportTypeErrorForNode] should be used and the types |
2615 * themselves (rather than their names) should be passed as arguments. | 2438 * themselves (rather than their names) should be passed as arguments. |
2616 * | 2439 * |
2617 * @param errorCode the error code of the error to be reported | 2440 * @param errorCode the error code of the error to be reported |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2655 * unless there are two or more types with the same names, in which case the e
xtended display | 2478 * unless there are two or more types with the same names, in which case the e
xtended display |
2656 * names of the types will be used in order to clarify the message. | 2479 * names of the types will be used in order to clarify the message. |
2657 * | 2480 * |
2658 * If there are not two or more types in the argument list, the method | 2481 * If there are not two or more types in the argument list, the method |
2659 * [reportErrorForNode] should be used instead. | 2482 * [reportErrorForNode] should be used instead. |
2660 * | 2483 * |
2661 * @param errorCode the error code of the error to be reported | 2484 * @param errorCode the error code of the error to be reported |
2662 * @param node the node specifying the location of the error | 2485 * @param node the node specifying the location of the error |
2663 * @param arguments the arguments to the error, used to compose the error mess
age | 2486 * @param arguments the arguments to the error, used to compose the error mess
age |
2664 */ | 2487 */ |
2665 void reportTypeErrorForNode(ErrorCode errorCode, AstNode node, | 2488 void reportTypeErrorForNode( |
2666 List<Object> arguments) { | 2489 ErrorCode errorCode, AstNode node, List<Object> arguments) { |
2667 _convertTypeNames(arguments); | 2490 _convertTypeNames(arguments); |
2668 reportErrorForOffset(errorCode, node.offset, node.length, arguments); | 2491 reportErrorForOffset(errorCode, node.offset, node.length, arguments); |
2669 } | 2492 } |
2670 | 2493 |
2671 /** | 2494 /** |
2672 * Given an array of arguments that is expected to contain two or more types,
convert the types | 2495 * Given an array of arguments that is expected to contain two or more types,
convert the types |
2673 * into strings by using the display names of the types, unless there are two
or more types with | 2496 * into strings by using the display names of the types, unless there are two
or more types with |
2674 * the same names, in which case the extended display names of the types will
be used in order to | 2497 * the same names, in which case the extended display names of the types will
be used in order to |
2675 * clarify the message. | 2498 * clarify the message. |
2676 * | 2499 * |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2763 * The name of the severity used when producing readable output. | 2586 * The name of the severity used when producing readable output. |
2764 */ | 2587 */ |
2765 final String displayName; | 2588 final String displayName; |
2766 | 2589 |
2767 /** | 2590 /** |
2768 * Initialize a newly created severity with the given names. | 2591 * Initialize a newly created severity with the given names. |
2769 * | 2592 * |
2770 * @param machineCode the name of the severity used when producing machine out
put | 2593 * @param machineCode the name of the severity used when producing machine out
put |
2771 * @param displayName the name of the severity used when producing readable ou
tput | 2594 * @param displayName the name of the severity used when producing readable ou
tput |
2772 */ | 2595 */ |
2773 const ErrorSeverity(String name, int ordinal, this.machineCode, | 2596 const ErrorSeverity( |
2774 this.displayName) | 2597 String name, int ordinal, this.machineCode, this.displayName) |
2775 : super(name, ordinal); | 2598 : super(name, ordinal); |
2776 | 2599 |
2777 /** | 2600 /** |
2778 * Return the severity constant that represents the greatest severity. | 2601 * Return the severity constant that represents the greatest severity. |
2779 * | 2602 * |
2780 * @param severity the severity being compared against | 2603 * @param severity the severity being compared against |
2781 * @return the most sever of this or the given severity | 2604 * @return the most sever of this or the given severity |
2782 */ | 2605 */ |
2783 ErrorSeverity max(ErrorSeverity severity) => | 2606 ErrorSeverity max(ErrorSeverity severity) => |
2784 this.ordinal >= severity.ordinal ? this : severity; | 2607 this.ordinal >= severity.ordinal ? this : severity; |
(...skipping 17 matching lines...) Expand all Loading... |
2802 /** | 2625 /** |
2803 * Compile-time errors are errors that preclude execution. A compile time erro
r must be reported | 2626 * Compile-time errors are errors that preclude execution. A compile time erro
r must be reported |
2804 * by a Dart compiler before the erroneous code is executed. | 2627 * by a Dart compiler before the erroneous code is executed. |
2805 */ | 2628 */ |
2806 static const ErrorType COMPILE_TIME_ERROR = | 2629 static const ErrorType COMPILE_TIME_ERROR = |
2807 const ErrorType('COMPILE_TIME_ERROR', 2, ErrorSeverity.ERROR); | 2630 const ErrorType('COMPILE_TIME_ERROR', 2, ErrorSeverity.ERROR); |
2808 | 2631 |
2809 /** | 2632 /** |
2810 * Checked mode compile-time errors are errors that preclude execution in chec
ked mode. | 2633 * Checked mode compile-time errors are errors that preclude execution in chec
ked mode. |
2811 */ | 2634 */ |
2812 static const ErrorType CHECKED_MODE_COMPILE_TIME_ERROR = | 2635 static const ErrorType CHECKED_MODE_COMPILE_TIME_ERROR = const ErrorType( |
2813 const ErrorType('CHECKED_MODE_COMPILE_TIME_ERROR', 3, ErrorSeverity.ERROR)
; | 2636 'CHECKED_MODE_COMPILE_TIME_ERROR', 3, ErrorSeverity.ERROR); |
2814 | 2637 |
2815 /** | 2638 /** |
2816 * Static warnings are those warnings reported by the static checker. They hav
e no effect on | 2639 * Static warnings are those warnings reported by the static checker. They hav
e no effect on |
2817 * execution. Static warnings must be provided by Dart compilers used during d
evelopment. | 2640 * execution. Static warnings must be provided by Dart compilers used during d
evelopment. |
2818 */ | 2641 */ |
2819 static const ErrorType STATIC_WARNING = | 2642 static const ErrorType STATIC_WARNING = |
2820 const ErrorType('STATIC_WARNING', 4, ErrorSeverity.WARNING); | 2643 const ErrorType('STATIC_WARNING', 4, ErrorSeverity.WARNING); |
2821 | 2644 |
2822 /** | 2645 /** |
2823 * Many, but not all, static warnings relate to types, in which case they are
known as static type | 2646 * Many, but not all, static warnings relate to types, in which case they are
known as static type |
2824 * warnings. | 2647 * warnings. |
2825 */ | 2648 */ |
2826 static const ErrorType STATIC_TYPE_WARNING = | 2649 static const ErrorType STATIC_TYPE_WARNING = |
2827 const ErrorType('STATIC_TYPE_WARNING', 5, ErrorSeverity.WARNING); | 2650 const ErrorType('STATIC_TYPE_WARNING', 5, ErrorSeverity.WARNING); |
2828 | 2651 |
2829 /** | 2652 /** |
2830 * Syntactic errors are errors produced as a result of input that does not con
form to the grammar. | 2653 * Syntactic errors are errors produced as a result of input that does not con
form to the grammar. |
2831 */ | 2654 */ |
2832 static const ErrorType SYNTACTIC_ERROR = | 2655 static const ErrorType SYNTACTIC_ERROR = |
2833 const ErrorType('SYNTACTIC_ERROR', 6, ErrorSeverity.ERROR); | 2656 const ErrorType('SYNTACTIC_ERROR', 6, ErrorSeverity.ERROR); |
2834 | 2657 |
2835 /** | 2658 /** |
2836 * Lint warnings describe style and best practice recommendations that can be
used to formalize a project's style | 2659 * Lint warnings describe style and best practice recommendations that can be
used to formalize a project's style |
2837 * guidelines. | 2660 * guidelines. |
2838 */ | 2661 */ |
2839 static const ErrorType LINT = const ErrorType('LINT', 7, ErrorSeverity.INFO); | 2662 static const ErrorType LINT = const ErrorType('LINT', 7, ErrorSeverity.INFO); |
2840 | 2663 |
2841 static const List<ErrorType> values = const [ | 2664 static const List<ErrorType> values = const [ |
2842 TODO, | 2665 TODO, |
2843 HINT, | 2666 HINT, |
2844 COMPILE_TIME_ERROR, | 2667 COMPILE_TIME_ERROR, |
2845 CHECKED_MODE_COMPILE_TIME_ERROR, | 2668 CHECKED_MODE_COMPILE_TIME_ERROR, |
2846 STATIC_WARNING, | 2669 STATIC_WARNING, |
2847 STATIC_TYPE_WARNING, | 2670 STATIC_TYPE_WARNING, |
2848 SYNTACTIC_ERROR, | 2671 SYNTACTIC_ERROR, |
2849 LINT]; | 2672 LINT |
| 2673 ]; |
2850 | 2674 |
2851 /** | 2675 /** |
2852 * The severity of this type of error. | 2676 * The severity of this type of error. |
2853 */ | 2677 */ |
2854 final ErrorSeverity severity; | 2678 final ErrorSeverity severity; |
2855 | 2679 |
2856 /** | 2680 /** |
2857 * Initialize a newly created error type to have the given severity. | 2681 * Initialize a newly created error type to have the given severity. |
2858 * | 2682 * |
2859 * @param severity the severity of this type of error | 2683 * @param severity the severity of this type of error |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2924 /** | 2748 /** |
2925 * Hint to use the ~/ operator. | 2749 * Hint to use the ~/ operator. |
2926 */ | 2750 */ |
2927 static const HintCode DIVISION_OPTIMIZATION = const HintCode( | 2751 static const HintCode DIVISION_OPTIMIZATION = const HintCode( |
2928 'DIVISION_OPTIMIZATION', | 2752 'DIVISION_OPTIMIZATION', |
2929 "The operator x ~/ y is more efficient than (x / y).toInt()"); | 2753 "The operator x ~/ y is more efficient than (x / y).toInt()"); |
2930 | 2754 |
2931 /** | 2755 /** |
2932 * Hint for the `x is double` type checks. | 2756 * Hint for the `x is double` type checks. |
2933 */ | 2757 */ |
2934 static const HintCode IS_DOUBLE = const HintCode( | 2758 static const HintCode IS_DOUBLE = const HintCode('IS_DOUBLE', |
2935 'IS_DOUBLE', | |
2936 "When compiled to JS, this test might return true when the left hand side
is an int"); | 2759 "When compiled to JS, this test might return true when the left hand side
is an int"); |
2937 | 2760 |
2938 /** | 2761 /** |
2939 * Hint for the `x is int` type checks. | 2762 * Hint for the `x is int` type checks. |
2940 */ | 2763 */ |
2941 static const HintCode IS_INT = const HintCode( | 2764 static const HintCode IS_INT = const HintCode('IS_INT', |
2942 'IS_INT', | |
2943 "When compiled to JS, this test might return true when the left hand side
is a double"); | 2765 "When compiled to JS, this test might return true when the left hand side
is a double"); |
2944 | 2766 |
2945 /** | 2767 /** |
2946 * Hint for the `x is! double` type checks. | 2768 * Hint for the `x is! double` type checks. |
2947 */ | 2769 */ |
2948 static const HintCode IS_NOT_DOUBLE = const HintCode( | 2770 static const HintCode IS_NOT_DOUBLE = const HintCode('IS_NOT_DOUBLE', |
2949 'IS_NOT_DOUBLE', | |
2950 "When compiled to JS, this test might return false when the left hand side
is an int"); | 2771 "When compiled to JS, this test might return false when the left hand side
is an int"); |
2951 | 2772 |
2952 /** | 2773 /** |
2953 * Hint for the `x is! int` type checks. | 2774 * Hint for the `x is! int` type checks. |
2954 */ | 2775 */ |
2955 static const HintCode IS_NOT_INT = const HintCode( | 2776 static const HintCode IS_NOT_INT = const HintCode('IS_NOT_INT', |
2956 'IS_NOT_INT', | |
2957 "When compiled to JS, this test might return false when the left hand side
is a double"); | 2777 "When compiled to JS, this test might return false when the left hand side
is a double"); |
2958 | 2778 |
2959 /** | 2779 /** |
2960 * Deferred libraries shouldn't define a top level function 'loadLibrary'. | 2780 * Deferred libraries shouldn't define a top level function 'loadLibrary'. |
2961 */ | 2781 */ |
2962 static const HintCode IMPORT_DEFERRED_LIBRARY_WITH_LOAD_FUNCTION = | 2782 static const HintCode IMPORT_DEFERRED_LIBRARY_WITH_LOAD_FUNCTION = const HintC
ode( |
2963 const HintCode( | 2783 'IMPORT_DEFERRED_LIBRARY_WITH_LOAD_FUNCTION', |
2964 'IMPORT_DEFERRED_LIBRARY_WITH_LOAD_FUNCTION', | 2784 "The library '{0}' defines a top-level function named 'loadLibrary' which
is hidden by deferring this library"); |
2965 "The library '{0}' defines a top-level function named 'loadLibrary' wh
ich is hidden by deferring this library"); | |
2966 | 2785 |
2967 /** | 2786 /** |
2968 * This hint is generated anywhere where the | 2787 * This hint is generated anywhere where the |
2969 * [StaticTypeWarningCode.INVALID_ASSIGNMENT] would have been generated, if we | 2788 * [StaticTypeWarningCode.INVALID_ASSIGNMENT] would have been generated, if we |
2970 * used propagated information for the warnings. | 2789 * used propagated information for the warnings. |
2971 * | 2790 * |
2972 * @param rhsTypeName the name of the right hand side type | 2791 * @param rhsTypeName the name of the right hand side type |
2973 * @param lhsTypeName the name of the left hand side type | 2792 * @param lhsTypeName the name of the left hand side type |
2974 */ | 2793 */ |
2975 static const HintCode INVALID_ASSIGNMENT = const HintCode( | 2794 static const HintCode INVALID_ASSIGNMENT = const HintCode( |
2976 'INVALID_ASSIGNMENT', | 2795 'INVALID_ASSIGNMENT', |
2977 "A value of type '{0}' cannot be assigned to a variable of type '{1}'"); | 2796 "A value of type '{0}' cannot be assigned to a variable of type '{1}'"); |
2978 | 2797 |
2979 /** | 2798 /** |
2980 * Generate a hint for methods or functions that have a return type, but do | 2799 * Generate a hint for methods or functions that have a return type, but do |
2981 * not have a non-void return statement on all branches. At the end of methods | 2800 * not have a non-void return statement on all branches. At the end of methods |
2982 * or functions with no return, Dart implicitly returns `null`, avoiding these | 2801 * or functions with no return, Dart implicitly returns `null`, avoiding these |
2983 * implicit returns is considered a best practice. | 2802 * implicit returns is considered a best practice. |
2984 * | 2803 * |
2985 * @param returnType the name of the declared return type | 2804 * @param returnType the name of the declared return type |
2986 */ | 2805 */ |
2987 static const HintCode MISSING_RETURN = const HintCode( | 2806 static const HintCode MISSING_RETURN = const HintCode('MISSING_RETURN', |
2988 'MISSING_RETURN', | |
2989 "This function declares a return type of '{0}', but does not end with a re
turn statement", | 2807 "This function declares a return type of '{0}', but does not end with a re
turn statement", |
2990 "Either add a return statement or change the return type to 'void'"); | 2808 "Either add a return statement or change the return type to 'void'"); |
2991 | 2809 |
2992 /** | 2810 /** |
2993 * A getter with the override annotation does not override an existing getter. | 2811 * A getter with the override annotation does not override an existing getter. |
2994 */ | 2812 */ |
2995 static const HintCode OVERRIDE_ON_NON_OVERRIDING_GETTER = const HintCode( | 2813 static const HintCode OVERRIDE_ON_NON_OVERRIDING_GETTER = const HintCode( |
2996 'OVERRIDE_ON_NON_OVERRIDING_GETTER', | 2814 'OVERRIDE_ON_NON_OVERRIDING_GETTER', |
2997 "Getter does not override an inherited getter"); | 2815 "Getter does not override an inherited getter"); |
2998 | 2816 |
(...skipping 24 matching lines...) Expand all Loading... |
3023 * Type checks of the type `x is! Null` should be done with `x != null`. | 2841 * Type checks of the type `x is! Null` should be done with `x != null`. |
3024 */ | 2842 */ |
3025 static const HintCode TYPE_CHECK_IS_NOT_NULL = const HintCode( | 2843 static const HintCode TYPE_CHECK_IS_NOT_NULL = const HintCode( |
3026 'TYPE_CHECK_IS_NOT_NULL', | 2844 'TYPE_CHECK_IS_NOT_NULL', |
3027 "Tests for non-null should be done with '!= null'"); | 2845 "Tests for non-null should be done with '!= null'"); |
3028 | 2846 |
3029 /** | 2847 /** |
3030 * Type checks of the type `x is Null` should be done with `x == null`. | 2848 * Type checks of the type `x is Null` should be done with `x == null`. |
3031 */ | 2849 */ |
3032 static const HintCode TYPE_CHECK_IS_NULL = const HintCode( | 2850 static const HintCode TYPE_CHECK_IS_NULL = const HintCode( |
3033 'TYPE_CHECK_IS_NULL', | 2851 'TYPE_CHECK_IS_NULL', "Tests for null should be done with '== null'"); |
3034 "Tests for null should be done with '== null'"); | |
3035 | 2852 |
3036 /** | 2853 /** |
3037 * This hint is generated anywhere where the | 2854 * This hint is generated anywhere where the |
3038 * [StaticTypeWarningCode.UNDEFINED_GETTER] or | 2855 * [StaticTypeWarningCode.UNDEFINED_GETTER] or |
3039 * [StaticWarningCode.UNDEFINED_GETTER] would have been generated, if we used | 2856 * [StaticWarningCode.UNDEFINED_GETTER] would have been generated, if we used |
3040 * propagated information for the warnings. | 2857 * propagated information for the warnings. |
3041 * | 2858 * |
3042 * @param getterName the name of the getter | 2859 * @param getterName the name of the getter |
3043 * @param enclosingType the name of the enclosing type where the getter is | 2860 * @param enclosingType the name of the enclosing type where the getter is |
3044 * being looked for | 2861 * being looked for |
3045 */ | 2862 */ |
3046 static const HintCode UNDEFINED_GETTER = const HintCode( | 2863 static const HintCode UNDEFINED_GETTER = const HintCode('UNDEFINED_GETTER', |
3047 'UNDEFINED_GETTER', | |
3048 "The getter '{0}' is not defined for the class '{1}'"); | 2864 "The getter '{0}' is not defined for the class '{1}'"); |
3049 | 2865 |
3050 /** | 2866 /** |
3051 * This hint is generated anywhere where the | 2867 * This hint is generated anywhere where the |
3052 * [StaticTypeWarningCode.UNDEFINED_METHOD] would have been generated, if we | 2868 * [StaticTypeWarningCode.UNDEFINED_METHOD] would have been generated, if we |
3053 * used propagated information for the warnings. | 2869 * used propagated information for the warnings. |
3054 * | 2870 * |
3055 * @param methodName the name of the method that is undefined | 2871 * @param methodName the name of the method that is undefined |
3056 * @param typeName the resolved type name that the method lookup is happening | 2872 * @param typeName the resolved type name that the method lookup is happening |
3057 * on | 2873 * on |
3058 */ | 2874 */ |
3059 static const HintCode UNDEFINED_METHOD = const HintCode( | 2875 static const HintCode UNDEFINED_METHOD = const HintCode('UNDEFINED_METHOD', |
3060 'UNDEFINED_METHOD', | |
3061 "The method '{0}' is not defined for the class '{1}'"); | 2876 "The method '{0}' is not defined for the class '{1}'"); |
3062 | 2877 |
3063 /** | 2878 /** |
3064 * This hint is generated anywhere where the | 2879 * This hint is generated anywhere where the |
3065 * [StaticTypeWarningCode.UNDEFINED_OPERATOR] would have been generated, if we | 2880 * [StaticTypeWarningCode.UNDEFINED_OPERATOR] would have been generated, if we |
3066 * used propagated information for the warnings. | 2881 * used propagated information for the warnings. |
3067 * | 2882 * |
3068 * @param operator the name of the operator | 2883 * @param operator the name of the operator |
3069 * @param enclosingType the name of the enclosing type where the operator is | 2884 * @param enclosingType the name of the enclosing type where the operator is |
3070 * being looked for | 2885 * being looked for |
3071 */ | 2886 */ |
3072 static const HintCode UNDEFINED_OPERATOR = const HintCode( | 2887 static const HintCode UNDEFINED_OPERATOR = const HintCode( |
3073 'UNDEFINED_OPERATOR', | 2888 'UNDEFINED_OPERATOR', |
3074 "The operator '{0}' is not defined for the class '{1}'"); | 2889 "The operator '{0}' is not defined for the class '{1}'"); |
3075 | 2890 |
3076 /** | 2891 /** |
3077 * This hint is generated anywhere where the | 2892 * This hint is generated anywhere where the |
3078 * [StaticTypeWarningCode.UNDEFINED_SETTER] or | 2893 * [StaticTypeWarningCode.UNDEFINED_SETTER] or |
3079 * [StaticWarningCode.UNDEFINED_SETTER] would have been generated, if we used | 2894 * [StaticWarningCode.UNDEFINED_SETTER] would have been generated, if we used |
3080 * propagated information for the warnings. | 2895 * propagated information for the warnings. |
3081 * | 2896 * |
3082 * @param setterName the name of the setter | 2897 * @param setterName the name of the setter |
3083 * @param enclosingType the name of the enclosing type where the setter is | 2898 * @param enclosingType the name of the enclosing type where the setter is |
3084 * being looked for | 2899 * being looked for |
3085 */ | 2900 */ |
3086 static const HintCode UNDEFINED_SETTER = const HintCode( | 2901 static const HintCode UNDEFINED_SETTER = const HintCode('UNDEFINED_SETTER', |
3087 'UNDEFINED_SETTER', | |
3088 "The setter '{0}' is not defined for the class '{1}'"); | 2902 "The setter '{0}' is not defined for the class '{1}'"); |
3089 | 2903 |
3090 /** | 2904 /** |
3091 * Unnecessary cast. | 2905 * Unnecessary cast. |
3092 */ | 2906 */ |
3093 static const HintCode UNNECESSARY_CAST = | 2907 static const HintCode UNNECESSARY_CAST = |
3094 const HintCode('UNNECESSARY_CAST', "Unnecessary cast"); | 2908 const HintCode('UNNECESSARY_CAST', "Unnecessary cast"); |
3095 | 2909 |
3096 /** | 2910 /** |
3097 * Unnecessary type checks, the result is always true. | 2911 * Unnecessary type checks, the result is always true. |
(...skipping 11 matching lines...) Expand all Loading... |
3109 | 2923 |
3110 /** | 2924 /** |
3111 * See [Modifier.IS_USED_IN_LIBRARY]. | 2925 * See [Modifier.IS_USED_IN_LIBRARY]. |
3112 */ | 2926 */ |
3113 static const HintCode UNUSED_ELEMENT = | 2927 static const HintCode UNUSED_ELEMENT = |
3114 const HintCode('UNUSED_ELEMENT', "The {0} '{1}' is not used"); | 2928 const HintCode('UNUSED_ELEMENT', "The {0} '{1}' is not used"); |
3115 | 2929 |
3116 /** | 2930 /** |
3117 * Unused fields are fields which are never read. | 2931 * Unused fields are fields which are never read. |
3118 */ | 2932 */ |
3119 static const HintCode UNUSED_FIELD = | 2933 static const HintCode UNUSED_FIELD = const HintCode( |
3120 const HintCode('UNUSED_FIELD', "The value of the field '{0}' is not used")
; | 2934 'UNUSED_FIELD', "The value of the field '{0}' is not used"); |
3121 | 2935 |
3122 /** | 2936 /** |
3123 * Unused imports are imports which are never used. | 2937 * Unused imports are imports which are never used. |
3124 */ | 2938 */ |
3125 static const HintCode UNUSED_IMPORT = | 2939 static const HintCode UNUSED_IMPORT = |
3126 const HintCode('UNUSED_IMPORT', "Unused import"); | 2940 const HintCode('UNUSED_IMPORT', "Unused import"); |
3127 | 2941 |
3128 /** | 2942 /** |
3129 * Unused local variables are local varaibles which are never read. | 2943 * Unused local variables are local varaibles which are never read. |
3130 */ | 2944 */ |
(...skipping 12 matching lines...) Expand all Loading... |
3143 "The result of '{0}' is being used, even though it is declared to be 'void
'"); | 2957 "The result of '{0}' is being used, even though it is declared to be 'void
'"); |
3144 | 2958 |
3145 /** | 2959 /** |
3146 * It is a bad practice for a source file in a package "lib" directory | 2960 * It is a bad practice for a source file in a package "lib" directory |
3147 * hierarchy to traverse outside that directory hierarchy. For example, a | 2961 * hierarchy to traverse outside that directory hierarchy. For example, a |
3148 * source file in the "lib" directory should not contain a directive such as | 2962 * source file in the "lib" directory should not contain a directive such as |
3149 * `import '../web/some.dart'` which references a file outside the lib | 2963 * `import '../web/some.dart'` which references a file outside the lib |
3150 * directory. | 2964 * directory. |
3151 */ | 2965 */ |
3152 static const HintCode FILE_IMPORT_INSIDE_LIB_REFERENCES_FILE_OUTSIDE = | 2966 static const HintCode FILE_IMPORT_INSIDE_LIB_REFERENCES_FILE_OUTSIDE = |
3153 const HintCode( | 2967 const HintCode('FILE_IMPORT_INSIDE_LIB_REFERENCES_FILE_OUTSIDE', |
3154 'FILE_IMPORT_INSIDE_LIB_REFERENCES_FILE_OUTSIDE', | |
3155 "A file in the 'lib' directory hierarchy should not reference a file o
utside that hierarchy"); | 2968 "A file in the 'lib' directory hierarchy should not reference a file o
utside that hierarchy"); |
3156 | 2969 |
3157 /** | 2970 /** |
3158 * It is a bad practice for a source file ouside a package "lib" directory | 2971 * It is a bad practice for a source file ouside a package "lib" directory |
3159 * hierarchy to traverse into that directory hierarchy. For example, a source | 2972 * hierarchy to traverse into that directory hierarchy. For example, a source |
3160 * file in the "web" directory should not contain a directive such as | 2973 * file in the "web" directory should not contain a directive such as |
3161 * `import '../lib/some.dart'` which references a file inside the lib | 2974 * `import '../lib/some.dart'` which references a file inside the lib |
3162 * directory. | 2975 * directory. |
3163 */ | 2976 */ |
3164 static const HintCode FILE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSIDE = | 2977 static const HintCode FILE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSIDE = |
3165 const HintCode( | 2978 const HintCode('FILE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSIDE', |
3166 'FILE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSIDE', | |
3167 "A file outside the 'lib' directory hierarchy should not reference a f
ile inside that hierarchy. Use a package: reference instead."); | 2979 "A file outside the 'lib' directory hierarchy should not reference a f
ile inside that hierarchy. Use a package: reference instead."); |
3168 | 2980 |
3169 /** | 2981 /** |
3170 * It is a bad practice for a package import to reference anything outside the | 2982 * It is a bad practice for a package import to reference anything outside the |
3171 * given package, or more generally, it is bad practice for a package import | 2983 * given package, or more generally, it is bad practice for a package import |
3172 * to contain a "..". For example, a source file should not contain a | 2984 * to contain a "..". For example, a source file should not contain a |
3173 * directive such as `import 'package:foo/../some.dart'`. | 2985 * directive such as `import 'package:foo/../some.dart'`. |
3174 */ | 2986 */ |
3175 static const HintCode PACKAGE_IMPORT_CONTAINS_DOT_DOT = const HintCode( | 2987 static const HintCode PACKAGE_IMPORT_CONTAINS_DOT_DOT = const HintCode( |
3176 'PACKAGE_IMPORT_CONTAINS_DOT_DOT', | 2988 'PACKAGE_IMPORT_CONTAINS_DOT_DOT', |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3209 static const HtmlWarningCode INVALID_URI = | 3021 static const HtmlWarningCode INVALID_URI = |
3210 const HtmlWarningCode('INVALID_URI', "Invalid URI syntax: '{0}'"); | 3022 const HtmlWarningCode('INVALID_URI', "Invalid URI syntax: '{0}'"); |
3211 | 3023 |
3212 /** | 3024 /** |
3213 * An error code indicating that the value of the 'src' attribute of a Dart | 3025 * An error code indicating that the value of the 'src' attribute of a Dart |
3214 * script tag references a file that does not exist. | 3026 * script tag references a file that does not exist. |
3215 * | 3027 * |
3216 * @param uri the URI pointing to a non-existent file | 3028 * @param uri the URI pointing to a non-existent file |
3217 */ | 3029 */ |
3218 static const HtmlWarningCode URI_DOES_NOT_EXIST = const HtmlWarningCode( | 3030 static const HtmlWarningCode URI_DOES_NOT_EXIST = const HtmlWarningCode( |
3219 'URI_DOES_NOT_EXIST', | 3031 'URI_DOES_NOT_EXIST', "Target of URI does not exist: '{0}'"); |
3220 "Target of URI does not exist: '{0}'"); | |
3221 | 3032 |
3222 /** | 3033 /** |
3223 * Initialize a newly created error code to have the given [name]. The message | 3034 * Initialize a newly created error code to have the given [name]. The message |
3224 * associated with the error will be created from the given [message] | 3035 * associated with the error will be created from the given [message] |
3225 * template. The correction associated with the error will be created from the | 3036 * template. The correction associated with the error will be created from the |
3226 * given [correction] template. | 3037 * given [correction] template. |
3227 */ | 3038 */ |
3228 const HtmlWarningCode(String name, String message, [String correction]) | 3039 const HtmlWarningCode(String name, String message, [String correction]) |
3229 : super(name, message, correction); | 3040 : super(name, message, correction); |
3230 | 3041 |
3231 @override | 3042 @override |
3232 ErrorSeverity get errorSeverity => ErrorSeverity.WARNING; | 3043 ErrorSeverity get errorSeverity => ErrorSeverity.WARNING; |
3233 | 3044 |
3234 @override | 3045 @override |
3235 ErrorType get type => ErrorType.STATIC_WARNING; | 3046 ErrorType get type => ErrorType.STATIC_WARNING; |
3236 } | 3047 } |
3237 | 3048 |
3238 /** | 3049 /** |
3239 * Defines style and best practice recommendations. | 3050 * Defines style and best practice recommendations. |
3240 * | 3051 * |
3241 * Unlike [HintCode]s, which are akin to traditional static warnings from a comp
iler, lint recommendations focus on | 3052 * Unlike [HintCode]s, which are akin to traditional static warnings from a comp
iler, lint recommendations focus on |
3242 * matters of style and practices that might aggregated to define a project's st
yle guide. | 3053 * matters of style and practices that might aggregated to define a project's st
yle guide. |
3243 */ | 3054 */ |
3244 class LintCode extends ErrorCode { | 3055 class LintCode extends ErrorCode { |
3245 | |
3246 const LintCode(String name, String message, [String correction]) | 3056 const LintCode(String name, String message, [String correction]) |
3247 : super(name, message, correction); | 3057 : super(name, message, correction); |
3248 | 3058 |
3249 @override | 3059 @override |
3250 ErrorSeverity get errorSeverity => ErrorSeverity.INFO; | 3060 ErrorSeverity get errorSeverity => ErrorSeverity.INFO; |
3251 | 3061 |
3252 @override | 3062 @override |
3253 ErrorType get type => ErrorType.LINT; | 3063 ErrorType get type => ErrorType.LINT; |
3254 } | 3064 } |
3255 | 3065 |
3256 /** | 3066 /** |
3257 * The class `StaticTypeWarningCode` defines the error codes used for static | 3067 * The class `StaticTypeWarningCode` defines the error codes used for static |
3258 * type warnings. The convention for this class is for the name of the error | 3068 * type warnings. The convention for this class is for the name of the error |
3259 * code to indicate the problem that caused the error to be generated and for | 3069 * code to indicate the problem that caused the error to be generated and for |
3260 * the error message to explain what is wrong and, when appropriate, how the | 3070 * the error message to explain what is wrong and, when appropriate, how the |
3261 * problem can be corrected. | 3071 * problem can be corrected. |
3262 */ | 3072 */ |
3263 class StaticTypeWarningCode extends ErrorCode { | 3073 class StaticTypeWarningCode extends ErrorCode { |
3264 /** | 3074 /** |
3265 * 12.7 Lists: A fresh instance (7.6.1) <i>a</i>, of size <i>n</i>, whose | 3075 * 12.7 Lists: A fresh instance (7.6.1) <i>a</i>, of size <i>n</i>, whose |
3266 * class implements the built-in class <i>List<E></i> is allocated. | 3076 * class implements the built-in class <i>List<E></i> is allocated. |
3267 * | 3077 * |
3268 * @param numTypeArgument the number of provided type arguments | 3078 * @param numTypeArgument the number of provided type arguments |
3269 */ | 3079 */ |
3270 static const StaticTypeWarningCode EXPECTED_ONE_LIST_TYPE_ARGUMENTS = | 3080 static const StaticTypeWarningCode EXPECTED_ONE_LIST_TYPE_ARGUMENTS = |
3271 const StaticTypeWarningCode( | 3081 const StaticTypeWarningCode('EXPECTED_ONE_LIST_TYPE_ARGUMENTS', |
3272 'EXPECTED_ONE_LIST_TYPE_ARGUMENTS', | |
3273 "List literal requires exactly one type arguments or none, but {0} fou
nd"); | 3082 "List literal requires exactly one type arguments or none, but {0} fou
nd"); |
3274 | 3083 |
3275 /** | 3084 /** |
3276 * 12.8 Maps: A fresh instance (7.6.1) <i>m</i>, of size <i>n</i>, whose class | 3085 * 12.8 Maps: A fresh instance (7.6.1) <i>m</i>, of size <i>n</i>, whose class |
3277 * implements the built-in class <i>Map<K, V></i> is allocated. | 3086 * implements the built-in class <i>Map<K, V></i> is allocated. |
3278 * | 3087 * |
3279 * @param numTypeArgument the number of provided type arguments | 3088 * @param numTypeArgument the number of provided type arguments |
3280 */ | 3089 */ |
3281 static const StaticTypeWarningCode EXPECTED_TWO_MAP_TYPE_ARGUMENTS = | 3090 static const StaticTypeWarningCode EXPECTED_TWO_MAP_TYPE_ARGUMENTS = |
3282 const StaticTypeWarningCode( | 3091 const StaticTypeWarningCode('EXPECTED_TWO_MAP_TYPE_ARGUMENTS', |
3283 'EXPECTED_TWO_MAP_TYPE_ARGUMENTS', | |
3284 "Map literal requires exactly two type arguments or none, but {0} foun
d"); | 3092 "Map literal requires exactly two type arguments or none, but {0} foun
d"); |
3285 | 3093 |
3286 /** | 3094 /** |
3287 * 9 Functions: It is a static warning if the declared return type of a | 3095 * 9 Functions: It is a static warning if the declared return type of a |
3288 * function marked async* may not be assigned to Stream. | 3096 * function marked async* may not be assigned to Stream. |
3289 */ | 3097 */ |
3290 static const StaticTypeWarningCode ILLEGAL_ASYNC_GENERATOR_RETURN_TYPE = | 3098 static const StaticTypeWarningCode ILLEGAL_ASYNC_GENERATOR_RETURN_TYPE = |
3291 const StaticTypeWarningCode( | 3099 const StaticTypeWarningCode('ILLEGAL_ASYNC_GENERATOR_RETURN_TYPE', |
3292 'ILLEGAL_ASYNC_GENERATOR_RETURN_TYPE', | |
3293 "Functions marked 'async*' must have a return type assignable to 'Stre
am'"); | 3100 "Functions marked 'async*' must have a return type assignable to 'Stre
am'"); |
3294 | 3101 |
3295 /** | 3102 /** |
3296 * 9 Functions: It is a static warning if the declared return type of a | 3103 * 9 Functions: It is a static warning if the declared return type of a |
3297 * function marked async may not be assigned to Future. | 3104 * function marked async may not be assigned to Future. |
3298 */ | 3105 */ |
3299 static const StaticTypeWarningCode ILLEGAL_ASYNC_RETURN_TYPE = | 3106 static const StaticTypeWarningCode ILLEGAL_ASYNC_RETURN_TYPE = |
3300 const StaticTypeWarningCode( | 3107 const StaticTypeWarningCode('ILLEGAL_ASYNC_RETURN_TYPE', |
3301 'ILLEGAL_ASYNC_RETURN_TYPE', | |
3302 "Functions marked 'async' must have a return type assignable to 'Futur
e'"); | 3108 "Functions marked 'async' must have a return type assignable to 'Futur
e'"); |
3303 | 3109 |
3304 /** | 3110 /** |
3305 * 9 Functions: It is a static warning if the declared return type of a | 3111 * 9 Functions: It is a static warning if the declared return type of a |
3306 * function marked sync* may not be assigned to Iterable. | 3112 * function marked sync* may not be assigned to Iterable. |
3307 */ | 3113 */ |
3308 static const StaticTypeWarningCode ILLEGAL_SYNC_GENERATOR_RETURN_TYPE = | 3114 static const StaticTypeWarningCode ILLEGAL_SYNC_GENERATOR_RETURN_TYPE = |
3309 const StaticTypeWarningCode( | 3115 const StaticTypeWarningCode('ILLEGAL_SYNC_GENERATOR_RETURN_TYPE', |
3310 'ILLEGAL_SYNC_GENERATOR_RETURN_TYPE', | |
3311 "Functions marked 'sync*' must have a return type assignable to 'Itera
ble'"); | 3116 "Functions marked 'sync*' must have a return type assignable to 'Itera
ble'"); |
3312 | 3117 |
3313 /** | 3118 /** |
3314 * 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i>. | 3119 * 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i>. |
3315 * It is a static type warning if <i>T</i> does not have an accessible | 3120 * It is a static type warning if <i>T</i> does not have an accessible |
3316 * instance setter named <i>v=</i>. | 3121 * instance setter named <i>v=</i>. |
3317 * | 3122 * |
3318 * See [UNDEFINED_SETTER]. | 3123 * See [UNDEFINED_SETTER]. |
3319 */ | 3124 */ |
3320 static const StaticTypeWarningCode INACCESSIBLE_SETTER = | 3125 static const StaticTypeWarningCode INACCESSIBLE_SETTER = |
(...skipping 21 matching lines...) Expand all Loading... |
3342 * * <i>h = max(numberOfPositionals(m<sub>i</sub>)),</i> | 3147 * * <i>h = max(numberOfPositionals(m<sub>i</sub>)),</i> |
3343 * * <i>r = min(numberOfRequiredParams(m<sub>i</sub>)), for all <i>i</i>, 1 <= | 3148 * * <i>r = min(numberOfRequiredParams(m<sub>i</sub>)), for all <i>i</i>, 1 <= |
3344 * i <= k.</i> If <i>r <= h</i> then <i>I</i> has a method named <i>n</i>, | 3149 * i <= k.</i> If <i>r <= h</i> then <i>I</i> has a method named <i>n</i>, |
3345 * with <i>r</i> required parameters of type <b>dynamic</b>, <i>h</i> | 3150 * with <i>r</i> required parameters of type <b>dynamic</b>, <i>h</i> |
3346 * positional parameters of type <b>dynamic</b>, named parameters <i>s</i> | 3151 * positional parameters of type <b>dynamic</b>, named parameters <i>s</i> |
3347 * of type <b>dynamic</b> and return type <b>dynamic</b>. | 3152 * of type <b>dynamic</b> and return type <b>dynamic</b>. |
3348 * * Otherwise none of the members <i>m<sub>1</sub>, …, | 3153 * * Otherwise none of the members <i>m<sub>1</sub>, …, |
3349 * m<sub>k</sub></i> is inherited. | 3154 * m<sub>k</sub></i> is inherited. |
3350 */ | 3155 */ |
3351 static const StaticTypeWarningCode INCONSISTENT_METHOD_INHERITANCE = | 3156 static const StaticTypeWarningCode INCONSISTENT_METHOD_INHERITANCE = |
3352 const StaticTypeWarningCode( | 3157 const StaticTypeWarningCode('INCONSISTENT_METHOD_INHERITANCE', |
3353 'INCONSISTENT_METHOD_INHERITANCE', | |
3354 "'{0}' is inherited by at least two interfaces inconsistently, from {1
}"); | 3158 "'{0}' is inherited by at least two interfaces inconsistently, from {1
}"); |
3355 | 3159 |
3356 /** | 3160 /** |
3357 * 12.15.1 Ordinary Invocation: It is a static type warning if <i>T</i> does | 3161 * 12.15.1 Ordinary Invocation: It is a static type warning if <i>T</i> does |
3358 * not have an accessible (3.2) instance member named <i>m</i>. | 3162 * not have an accessible (3.2) instance member named <i>m</i>. |
3359 * | 3163 * |
3360 * @param memberName the name of the static member | 3164 * @param memberName the name of the static member |
3361 * See [UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER]. | 3165 * See [UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER]. |
3362 */ | 3166 */ |
3363 static const StaticTypeWarningCode INSTANCE_ACCESS_TO_STATIC_MEMBER = | 3167 static const StaticTypeWarningCode INSTANCE_ACCESS_TO_STATIC_MEMBER = |
3364 const StaticTypeWarningCode( | 3168 const StaticTypeWarningCode('INSTANCE_ACCESS_TO_STATIC_MEMBER', |
3365 'INSTANCE_ACCESS_TO_STATIC_MEMBER', | |
3366 "Static member '{0}' cannot be accessed using instance access"); | 3169 "Static member '{0}' cannot be accessed using instance access"); |
3367 | 3170 |
3368 /** | 3171 /** |
3369 * 12.18 Assignment: It is a static type warning if the static type of | 3172 * 12.18 Assignment: It is a static type warning if the static type of |
3370 * <i>e</i> may not be assigned to the static type of <i>v</i>. The static | 3173 * <i>e</i> may not be assigned to the static type of <i>v</i>. The static |
3371 * type of the expression <i>v = e</i> is the static type of <i>e</i>. | 3174 * type of the expression <i>v = e</i> is the static type of <i>e</i>. |
3372 * | 3175 * |
3373 * 12.18 Assignment: It is a static type warning if the static type of | 3176 * 12.18 Assignment: It is a static type warning if the static type of |
3374 * <i>e</i> may not be assigned to the static type of <i>C.v</i>. The static | 3177 * <i>e</i> may not be assigned to the static type of <i>C.v</i>. The static |
3375 * type of the expression <i>C.v = e</i> is the static type of <i>e</i>. | 3178 * type of the expression <i>C.v = e</i> is the static type of <i>e</i>. |
3376 * | 3179 * |
3377 * 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i>. | 3180 * 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i>. |
3378 * It is a static type warning if the static type of <i>e<sub>2</sub></i> may | 3181 * It is a static type warning if the static type of <i>e<sub>2</sub></i> may |
3379 * not be assigned to <i>T</i>. | 3182 * not be assigned to <i>T</i>. |
3380 * | 3183 * |
3381 * @param rhsTypeName the name of the right hand side type | 3184 * @param rhsTypeName the name of the right hand side type |
3382 * @param lhsTypeName the name of the left hand side type | 3185 * @param lhsTypeName the name of the left hand side type |
3383 */ | 3186 */ |
3384 static const StaticTypeWarningCode INVALID_ASSIGNMENT = | 3187 static const StaticTypeWarningCode INVALID_ASSIGNMENT = |
3385 const StaticTypeWarningCode( | 3188 const StaticTypeWarningCode('INVALID_ASSIGNMENT', |
3386 'INVALID_ASSIGNMENT', | |
3387 "A value of type '{0}' cannot be assigned to a variable of type '{1}'"
); | 3189 "A value of type '{0}' cannot be assigned to a variable of type '{1}'"
); |
3388 | 3190 |
3389 /** | 3191 /** |
3390 * 12.15.1 Ordinary Invocation: An ordinary method invocation <i>i</i> has the | 3192 * 12.15.1 Ordinary Invocation: An ordinary method invocation <i>i</i> has the |
3391 * form <i>o.m(a<sub>1</sub>, …, a<sub>n</sub>, x<sub>n+1</sub>: | 3193 * form <i>o.m(a<sub>1</sub>, …, a<sub>n</sub>, x<sub>n+1</sub>: |
3392 * a<sub>n+1</sub>, … x<sub>n+k</sub>: a<sub>n+k</sub>)</i>. | 3194 * a<sub>n+1</sub>, … x<sub>n+k</sub>: a<sub>n+k</sub>)</i>. |
3393 * | 3195 * |
3394 * Let <i>T</i> be the static type of <i>o</i>. It is a static type warning if | 3196 * Let <i>T</i> be the static type of <i>o</i>. It is a static type warning if |
3395 * <i>T</i> does not have an accessible instance member named <i>m</i>. If | 3197 * <i>T</i> does not have an accessible instance member named <i>m</i>. If |
3396 * <i>T.m</i> exists, it is a static warning if the type <i>F</i> of | 3198 * <i>T.m</i> exists, it is a static warning if the type <i>F</i> of |
3397 * <i>T.m</i> may not be assigned to a function type. If <i>T.m</i> does not | 3199 * <i>T.m</i> may not be assigned to a function type. If <i>T.m</i> does not |
3398 * exist, or if <i>F</i> is not a function type, the static type of <i>i</i> | 3200 * exist, or if <i>F</i> is not a function type, the static type of <i>i</i> |
3399 * is dynamic. | 3201 * is dynamic. |
3400 * | 3202 * |
3401 * 12.15.3 Static Invocation: It is a static type warning if the type <i>F</i> | 3203 * 12.15.3 Static Invocation: It is a static type warning if the type <i>F</i> |
3402 * of <i>C.m</i> may not be assigned to a function type. | 3204 * of <i>C.m</i> may not be assigned to a function type. |
3403 * | 3205 * |
3404 * 12.15.4 Super Invocation: A super method invocation <i>i</i> has the form | 3206 * 12.15.4 Super Invocation: A super method invocation <i>i</i> has the form |
3405 * <i>super.m(a<sub>1</sub>, …, a<sub>n</sub>, x<sub>n+1</sub>: | 3207 * <i>super.m(a<sub>1</sub>, …, a<sub>n</sub>, x<sub>n+1</sub>: |
3406 * a<sub>n+1</sub>, … x<sub>n+k</sub>: a<sub>n+k</sub>)</i>. If | 3208 * a<sub>n+1</sub>, … x<sub>n+k</sub>: a<sub>n+k</sub>)</i>. If |
3407 * <i>S.m</i> exists, it is a static warning if the type <i>F</i> of | 3209 * <i>S.m</i> exists, it is a static warning if the type <i>F</i> of |
3408 * <i>S.m</i> may not be assigned to a function type. | 3210 * <i>S.m</i> may not be assigned to a function type. |
3409 * | 3211 * |
3410 * @param nonFunctionIdentifier the name of the identifier that is not a | 3212 * @param nonFunctionIdentifier the name of the identifier that is not a |
3411 * function type | 3213 * function type |
3412 */ | 3214 */ |
3413 static const StaticTypeWarningCode INVOCATION_OF_NON_FUNCTION = | 3215 static const StaticTypeWarningCode INVOCATION_OF_NON_FUNCTION = |
3414 const StaticTypeWarningCode( | 3216 const StaticTypeWarningCode( |
3415 'INVOCATION_OF_NON_FUNCTION', | 3217 'INVOCATION_OF_NON_FUNCTION', "'{0}' is not a method"); |
3416 "'{0}' is not a method"); | |
3417 | 3218 |
3418 /** | 3219 /** |
3419 * 12.14.4 Function Expression Invocation: A function expression invocation | 3220 * 12.14.4 Function Expression Invocation: A function expression invocation |
3420 * <i>i</i> has the form <i>e<sub>f</sub>(a<sub>1</sub>, …, | 3221 * <i>i</i> has the form <i>e<sub>f</sub>(a<sub>1</sub>, …, |
3421 * a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n+1</sub>, …, x<sub>n+k</sub>: | 3222 * a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n+1</sub>, …, x<sub>n+k</sub>: |
3422 * a<sub>n+k</sub>)</i>, where <i>e<sub>f</sub></i> is an expression. | 3223 * a<sub>n+k</sub>)</i>, where <i>e<sub>f</sub></i> is an expression. |
3423 * | 3224 * |
3424 * It is a static type warning if the static type <i>F</i> of | 3225 * It is a static type warning if the static type <i>F</i> of |
3425 * <i>e<sub>f</sub></i> may not be assigned to a function type. | 3226 * <i>e<sub>f</sub></i> may not be assigned to a function type. |
3426 */ | 3227 */ |
3427 static const StaticTypeWarningCode INVOCATION_OF_NON_FUNCTION_EXPRESSION = | 3228 static const StaticTypeWarningCode INVOCATION_OF_NON_FUNCTION_EXPRESSION = |
3428 const StaticTypeWarningCode( | 3229 const StaticTypeWarningCode('INVOCATION_OF_NON_FUNCTION_EXPRESSION', |
3429 'INVOCATION_OF_NON_FUNCTION_EXPRESSION', | |
3430 "Cannot invoke a non-function"); | 3230 "Cannot invoke a non-function"); |
3431 | 3231 |
3432 /** | 3232 /** |
3433 * 12.20 Conditional: It is a static type warning if the type of | 3233 * 12.20 Conditional: It is a static type warning if the type of |
3434 * <i>e<sub>1</sub></i> may not be assigned to bool. | 3234 * <i>e<sub>1</sub></i> may not be assigned to bool. |
3435 * | 3235 * |
3436 * 13.5 If: It is a static type warning if the type of the expression <i>b</i> | 3236 * 13.5 If: It is a static type warning if the type of the expression <i>b</i> |
3437 * may not be assigned to bool. | 3237 * may not be assigned to bool. |
3438 * | 3238 * |
3439 * 13.7 While: It is a static type warning if the type of <i>e</i> may not be | 3239 * 13.7 While: It is a static type warning if the type of <i>e</i> may not be |
3440 * assigned to bool. | 3240 * assigned to bool. |
3441 * | 3241 * |
3442 * 13.8 Do: It is a static type warning if the type of <i>e</i> cannot be | 3242 * 13.8 Do: It is a static type warning if the type of <i>e</i> cannot be |
3443 * assigned to bool. | 3243 * assigned to bool. |
3444 */ | 3244 */ |
3445 static const StaticTypeWarningCode NON_BOOL_CONDITION = | 3245 static const StaticTypeWarningCode NON_BOOL_CONDITION = |
3446 const StaticTypeWarningCode( | 3246 const StaticTypeWarningCode( |
3447 'NON_BOOL_CONDITION', | 3247 'NON_BOOL_CONDITION', "Conditions must have a static type of 'bool'"); |
3448 "Conditions must have a static type of 'bool'"); | |
3449 | 3248 |
3450 /** | 3249 /** |
3451 * 13.15 Assert: It is a static type warning if the type of <i>e</i> may not | 3250 * 13.15 Assert: It is a static type warning if the type of <i>e</i> may not |
3452 * be assigned to either bool or () → bool | 3251 * be assigned to either bool or () → bool |
3453 */ | 3252 */ |
3454 static const StaticTypeWarningCode NON_BOOL_EXPRESSION = | 3253 static const StaticTypeWarningCode NON_BOOL_EXPRESSION = |
3455 const StaticTypeWarningCode( | 3254 const StaticTypeWarningCode('NON_BOOL_EXPRESSION', |
3456 'NON_BOOL_EXPRESSION', | |
3457 "Assertions must be on either a 'bool' or '() -> bool'"); | 3255 "Assertions must be on either a 'bool' or '() -> bool'"); |
3458 | 3256 |
3459 /** | 3257 /** |
3460 * 12.28 Unary Expressions: The expression !<i>e</i> is equivalent to the | 3258 * 12.28 Unary Expressions: The expression !<i>e</i> is equivalent to the |
3461 * expression <i>e</i>?<b>false<b> : <b>true</b>. | 3259 * expression <i>e</i>?<b>false<b> : <b>true</b>. |
3462 * | 3260 * |
3463 * 12.20 Conditional: It is a static type warning if the type of | 3261 * 12.20 Conditional: It is a static type warning if the type of |
3464 * <i>e<sub>1</sub></i> may not be assigned to bool. | 3262 * <i>e<sub>1</sub></i> may not be assigned to bool. |
3465 */ | 3263 */ |
3466 static const StaticTypeWarningCode NON_BOOL_NEGATION_EXPRESSION = | 3264 static const StaticTypeWarningCode NON_BOOL_NEGATION_EXPRESSION = |
3467 const StaticTypeWarningCode( | 3265 const StaticTypeWarningCode('NON_BOOL_NEGATION_EXPRESSION', |
3468 'NON_BOOL_NEGATION_EXPRESSION', | |
3469 "Negation argument must have a static type of 'bool'"); | 3266 "Negation argument must have a static type of 'bool'"); |
3470 | 3267 |
3471 /** | 3268 /** |
3472 * 12.21 Logical Boolean Expressions: It is a static type warning if the | 3269 * 12.21 Logical Boolean Expressions: It is a static type warning if the |
3473 * static types of both of <i>e<sub>1</sub></i> and <i>e<sub>2</sub></i> may | 3270 * static types of both of <i>e<sub>1</sub></i> and <i>e<sub>2</sub></i> may |
3474 * not be assigned to bool. | 3271 * not be assigned to bool. |
3475 * | 3272 * |
3476 * @param operator the lexeme of the logical operator | 3273 * @param operator the lexeme of the logical operator |
3477 */ | 3274 */ |
3478 static const StaticTypeWarningCode NON_BOOL_OPERAND = | 3275 static const StaticTypeWarningCode NON_BOOL_OPERAND = |
3479 const StaticTypeWarningCode( | 3276 const StaticTypeWarningCode('NON_BOOL_OPERAND', |
3480 'NON_BOOL_OPERAND', | |
3481 "The operands of the '{0}' operator must be assignable to 'bool'"); | 3277 "The operands of the '{0}' operator must be assignable to 'bool'"); |
3482 | 3278 |
3483 /** | 3279 /** |
3484 * 15.8 Parameterized Types: It is a static type warning if <i>A<sub>i</sub>, | 3280 * 15.8 Parameterized Types: It is a static type warning if <i>A<sub>i</sub>, |
3485 * 1 <= i <= n</i> does not denote a type in the enclosing lexical scope
. | 3281 * 1 <= i <= n</i> does not denote a type in the enclosing lexical scope
. |
3486 */ | 3282 */ |
3487 static const StaticTypeWarningCode NON_TYPE_AS_TYPE_ARGUMENT = | 3283 static const StaticTypeWarningCode NON_TYPE_AS_TYPE_ARGUMENT = |
3488 const StaticTypeWarningCode( | 3284 const StaticTypeWarningCode('NON_TYPE_AS_TYPE_ARGUMENT', |
3489 'NON_TYPE_AS_TYPE_ARGUMENT', | |
3490 "The name '{0}' is not a type and cannot be used as a parameterized ty
pe"); | 3285 "The name '{0}' is not a type and cannot be used as a parameterized ty
pe"); |
3491 | 3286 |
3492 /** | 3287 /** |
3493 * 13.11 Return: It is a static type warning if the type of <i>e</i> may not | 3288 * 13.11 Return: It is a static type warning if the type of <i>e</i> may not |
3494 * be assigned to the declared return type of the immediately enclosing | 3289 * be assigned to the declared return type of the immediately enclosing |
3495 * function. | 3290 * function. |
3496 * | 3291 * |
3497 * @param actualReturnType the return type as declared in the return statement | 3292 * @param actualReturnType the return type as declared in the return statement |
3498 * @param expectedReturnType the expected return type as defined by the method | 3293 * @param expectedReturnType the expected return type as defined by the method |
3499 * @param methodName the name of the method | 3294 * @param methodName the name of the method |
3500 */ | 3295 */ |
3501 static const StaticTypeWarningCode RETURN_OF_INVALID_TYPE = | 3296 static const StaticTypeWarningCode RETURN_OF_INVALID_TYPE = |
3502 const StaticTypeWarningCode( | 3297 const StaticTypeWarningCode('RETURN_OF_INVALID_TYPE', |
3503 'RETURN_OF_INVALID_TYPE', | |
3504 "The return type '{0}' is not a '{1}', as defined by the method '{2}'"
); | 3298 "The return type '{0}' is not a '{1}', as defined by the method '{2}'"
); |
3505 | 3299 |
3506 /** | 3300 /** |
3507 * 12.11 Instance Creation: It is a static type warning if any of the type | 3301 * 12.11 Instance Creation: It is a static type warning if any of the type |
3508 * arguments to a constructor of a generic type <i>G</i> invoked by a new | 3302 * arguments to a constructor of a generic type <i>G</i> invoked by a new |
3509 * expression or a constant object expression are not subtypes of the bounds | 3303 * expression or a constant object expression are not subtypes of the bounds |
3510 * of the corresponding formal type parameters of <i>G</i>. | 3304 * of the corresponding formal type parameters of <i>G</i>. |
3511 * | 3305 * |
3512 * 15.8 Parameterized Types: If <i>S</i> is the static type of a member | 3306 * 15.8 Parameterized Types: If <i>S</i> is the static type of a member |
3513 * <i>m</i> of <i>G</i>, then the static type of the member <i>m</i> of | 3307 * <i>m</i> of <i>G</i>, then the static type of the member <i>m</i> of |
(...skipping 11 matching lines...) Expand all Loading... |
3525 * type parameters of type. | 3319 * type parameters of type. |
3526 * | 3320 * |
3527 * @param boundedTypeName the name of the type used in the instance creation | 3321 * @param boundedTypeName the name of the type used in the instance creation |
3528 * that should be limited by the bound as specified in the class | 3322 * that should be limited by the bound as specified in the class |
3529 * declaration | 3323 * declaration |
3530 * @param boundingTypeName the name of the bounding type | 3324 * @param boundingTypeName the name of the bounding type |
3531 * See [TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND]. | 3325 * See [TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND]. |
3532 */ | 3326 */ |
3533 static const StaticTypeWarningCode TYPE_ARGUMENT_NOT_MATCHING_BOUNDS = | 3327 static const StaticTypeWarningCode TYPE_ARGUMENT_NOT_MATCHING_BOUNDS = |
3534 const StaticTypeWarningCode( | 3328 const StaticTypeWarningCode( |
3535 'TYPE_ARGUMENT_NOT_MATCHING_BOUNDS', | 3329 'TYPE_ARGUMENT_NOT_MATCHING_BOUNDS', "'{0}' does not extend '{1}'"); |
3536 "'{0}' does not extend '{1}'"); | |
3537 | 3330 |
3538 /** | 3331 /** |
3539 * 10 Generics: It is a static type warning if a type parameter is a supertype | 3332 * 10 Generics: It is a static type warning if a type parameter is a supertype |
3540 * of its upper bound. | 3333 * of its upper bound. |
3541 * | 3334 * |
3542 * @param typeParameterName the name of the type parameter | 3335 * @param typeParameterName the name of the type parameter |
3543 * See [TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]. | 3336 * See [TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]. |
3544 */ | 3337 */ |
3545 static const StaticTypeWarningCode TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND = | 3338 static const StaticTypeWarningCode TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND = |
3546 const StaticTypeWarningCode( | 3339 const StaticTypeWarningCode('TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND', |
3547 'TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND', | |
3548 "'{0}' cannot be a supertype of its upper bound"); | 3340 "'{0}' cannot be a supertype of its upper bound"); |
3549 | 3341 |
3550 /** | 3342 /** |
3551 * 12.17 Getter Invocation: It is a static warning if there is no class | 3343 * 12.17 Getter Invocation: It is a static warning if there is no class |
3552 * <i>C</i> in the enclosing lexical scope of <i>i</i>, or if <i>C</i> does | 3344 * <i>C</i> in the enclosing lexical scope of <i>i</i>, or if <i>C</i> does |
3553 * not declare, implicitly or explicitly, a getter named <i>m</i>. | 3345 * not declare, implicitly or explicitly, a getter named <i>m</i>. |
3554 * | 3346 * |
3555 * @param constantName the name of the enumeration constant that is not | 3347 * @param constantName the name of the enumeration constant that is not |
3556 * defined | 3348 * defined |
3557 * @param enumName the name of the enumeration used to access the constant | 3349 * @param enumName the name of the enumeration used to access the constant |
3558 */ | 3350 */ |
3559 static const StaticTypeWarningCode UNDEFINED_ENUM_CONSTANT = | 3351 static const StaticTypeWarningCode UNDEFINED_ENUM_CONSTANT = |
3560 const StaticTypeWarningCode( | 3352 const StaticTypeWarningCode('UNDEFINED_ENUM_CONSTANT', |
3561 'UNDEFINED_ENUM_CONSTANT', | |
3562 "There is no constant named '{0}' in '{1}'"); | 3353 "There is no constant named '{0}' in '{1}'"); |
3563 | 3354 |
3564 /** | 3355 /** |
3565 * 12.15.3 Unqualified Invocation: If there exists a lexically visible | 3356 * 12.15.3 Unqualified Invocation: If there exists a lexically visible |
3566 * declaration named <i>id</i>, let <i>f<sub>id</sub></i> be the innermost | 3357 * declaration named <i>id</i>, let <i>f<sub>id</sub></i> be the innermost |
3567 * such declaration. Then: [skip]. Otherwise, <i>f<sub>id</sub></i> is | 3358 * such declaration. Then: [skip]. Otherwise, <i>f<sub>id</sub></i> is |
3568 * considered equivalent to the ordinary method invocation | 3359 * considered equivalent to the ordinary method invocation |
3569 * <b>this</b>.<i>id</i>(<i>a<sub>1</sub></i>, ..., <i>a<sub>n</sub></i>, | 3360 * <b>this</b>.<i>id</i>(<i>a<sub>1</sub></i>, ..., <i>a<sub>n</sub></i>, |
3570 * <i>x<sub>n+1</sub></i> : <i>a<sub>n+1</sub></i>, ..., | 3361 * <i>x<sub>n+1</sub></i> : <i>a<sub>n+1</sub></i>, ..., |
3571 * <i>x<sub>n+k</sub></i> : <i>a<sub>n+k</sub></i>). | 3362 * <i>x<sub>n+k</sub></i> : <i>a<sub>n+k</sub></i>). |
3572 * | 3363 * |
3573 * @param methodName the name of the method that is undefined | 3364 * @param methodName the name of the method that is undefined |
3574 */ | 3365 */ |
3575 static const StaticTypeWarningCode UNDEFINED_FUNCTION = | 3366 static const StaticTypeWarningCode UNDEFINED_FUNCTION = |
3576 const StaticTypeWarningCode( | 3367 const StaticTypeWarningCode( |
3577 'UNDEFINED_FUNCTION', | 3368 'UNDEFINED_FUNCTION', "The function '{0}' is not defined"); |
3578 "The function '{0}' is not defined"); | |
3579 | 3369 |
3580 /** | 3370 /** |
3581 * 12.17 Getter Invocation: Let <i>T</i> be the static type of <i>e</i>. It is | 3371 * 12.17 Getter Invocation: Let <i>T</i> be the static type of <i>e</i>. It is |
3582 * a static type warning if <i>T</i> does not have a getter named <i>m</i>. | 3372 * a static type warning if <i>T</i> does not have a getter named <i>m</i>. |
3583 * | 3373 * |
3584 * @param getterName the name of the getter | 3374 * @param getterName the name of the getter |
3585 * @param enclosingType the name of the enclosing type where the getter is | 3375 * @param enclosingType the name of the enclosing type where the getter is |
3586 * being looked for | 3376 * being looked for |
3587 */ | 3377 */ |
3588 static const StaticTypeWarningCode UNDEFINED_GETTER = | 3378 static const StaticTypeWarningCode UNDEFINED_GETTER = |
3589 const StaticTypeWarningCode( | 3379 const StaticTypeWarningCode('UNDEFINED_GETTER', |
3590 'UNDEFINED_GETTER', | |
3591 "The getter '{0}' is not defined for the class '{1}'"); | 3380 "The getter '{0}' is not defined for the class '{1}'"); |
3592 | 3381 |
3593 /** | 3382 /** |
3594 * 12.15.1 Ordinary Invocation: Let <i>T</i> be the static type of <i>o</i>. | 3383 * 12.15.1 Ordinary Invocation: Let <i>T</i> be the static type of <i>o</i>. |
3595 * It is a static type warning if <i>T</i> does not have an accessible | 3384 * It is a static type warning if <i>T</i> does not have an accessible |
3596 * instance member named <i>m</i>. | 3385 * instance member named <i>m</i>. |
3597 * | 3386 * |
3598 * @param methodName the name of the method that is undefined | 3387 * @param methodName the name of the method that is undefined |
3599 * @param typeName the resolved type name that the method lookup is happening | 3388 * @param typeName the resolved type name that the method lookup is happening |
3600 * on | 3389 * on |
3601 */ | 3390 */ |
3602 static const StaticTypeWarningCode UNDEFINED_METHOD = | 3391 static const StaticTypeWarningCode UNDEFINED_METHOD = |
3603 const StaticTypeWarningCode( | 3392 const StaticTypeWarningCode('UNDEFINED_METHOD', |
3604 'UNDEFINED_METHOD', | |
3605 "The method '{0}' is not defined for the class '{1}'"); | 3393 "The method '{0}' is not defined for the class '{1}'"); |
3606 | 3394 |
3607 /** | 3395 /** |
3608 * 12.18 Assignment: Evaluation of an assignment of the form | 3396 * 12.18 Assignment: Evaluation of an assignment of the form |
3609 * <i>e<sub>1</sub></i>[<i>e<sub>2</sub></i>] = <i>e<sub>3</sub></i> is | 3397 * <i>e<sub>1</sub></i>[<i>e<sub>2</sub></i>] = <i>e<sub>3</sub></i> is |
3610 * equivalent to the evaluation of the expression (a, i, e){a.[]=(i, e); | 3398 * equivalent to the evaluation of the expression (a, i, e){a.[]=(i, e); |
3611 * return e;} (<i>e<sub>1</sub></i>, <i>e<sub>2</sub></i>, | 3399 * return e;} (<i>e<sub>1</sub></i>, <i>e<sub>2</sub></i>, |
3612 * <i>e<sub>2</sub></i>). | 3400 * <i>e<sub>2</sub></i>). |
3613 * | 3401 * |
3614 * 12.29 Assignable Expressions: An assignable expression of the form | 3402 * 12.29 Assignable Expressions: An assignable expression of the form |
3615 * <i>e<sub>1</sub></i>[<i>e<sub>2</sub></i>] is evaluated as a method | 3403 * <i>e<sub>1</sub></i>[<i>e<sub>2</sub></i>] is evaluated as a method |
3616 * invocation of the operator method [] on <i>e<sub>1</sub></i> with argument | 3404 * invocation of the operator method [] on <i>e<sub>1</sub></i> with argument |
3617 * <i>e<sub>2</sub></i>. | 3405 * <i>e<sub>2</sub></i>. |
3618 * | 3406 * |
3619 * 12.15.1 Ordinary Invocation: Let <i>T</i> be the static type of <i>o</i>. | 3407 * 12.15.1 Ordinary Invocation: Let <i>T</i> be the static type of <i>o</i>. |
3620 * It is a static type warning if <i>T</i> does not have an accessible | 3408 * It is a static type warning if <i>T</i> does not have an accessible |
3621 * instance member named <i>m</i>. | 3409 * instance member named <i>m</i>. |
3622 * | 3410 * |
3623 * @param operator the name of the operator | 3411 * @param operator the name of the operator |
3624 * @param enclosingType the name of the enclosing type where the operator is | 3412 * @param enclosingType the name of the enclosing type where the operator is |
3625 * being looked for | 3413 * being looked for |
3626 */ | 3414 */ |
3627 static const StaticTypeWarningCode UNDEFINED_OPERATOR = | 3415 static const StaticTypeWarningCode UNDEFINED_OPERATOR = |
3628 const StaticTypeWarningCode( | 3416 const StaticTypeWarningCode('UNDEFINED_OPERATOR', |
3629 'UNDEFINED_OPERATOR', | |
3630 "The operator '{0}' is not defined for the class '{1}'"); | 3417 "The operator '{0}' is not defined for the class '{1}'"); |
3631 | 3418 |
3632 /** | 3419 /** |
3633 * 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i>. | 3420 * 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i>. |
3634 * It is a static type warning if <i>T</i> does not have an accessible | 3421 * It is a static type warning if <i>T</i> does not have an accessible |
3635 * instance setter named <i>v=</i>. | 3422 * instance setter named <i>v=</i>. |
3636 * | 3423 * |
3637 * @param setterName the name of the setter | 3424 * @param setterName the name of the setter |
3638 * @param enclosingType the name of the enclosing type where the setter is | 3425 * @param enclosingType the name of the enclosing type where the setter is |
3639 * being looked for | 3426 * being looked for |
3640 * See [INACCESSIBLE_SETTER]. | 3427 * See [INACCESSIBLE_SETTER]. |
3641 */ | 3428 */ |
3642 static const StaticTypeWarningCode UNDEFINED_SETTER = | 3429 static const StaticTypeWarningCode UNDEFINED_SETTER = |
3643 const StaticTypeWarningCode( | 3430 const StaticTypeWarningCode('UNDEFINED_SETTER', |
3644 'UNDEFINED_SETTER', | |
3645 "The setter '{0}' is not defined for the class '{1}'"); | 3431 "The setter '{0}' is not defined for the class '{1}'"); |
3646 | 3432 |
3647 /** | 3433 /** |
3648 * 12.17 Getter Invocation: Let <i>T</i> be the static type of <i>e</i>. It is | 3434 * 12.17 Getter Invocation: Let <i>T</i> be the static type of <i>e</i>. It is |
3649 * a static type warning if <i>T</i> does not have a getter named <i>m</i>. | 3435 * a static type warning if <i>T</i> does not have a getter named <i>m</i>. |
3650 * | 3436 * |
3651 * @param getterName the name of the getter | 3437 * @param getterName the name of the getter |
3652 * @param enclosingType the name of the enclosing type where the getter is | 3438 * @param enclosingType the name of the enclosing type where the getter is |
3653 * being looked for | 3439 * being looked for |
3654 */ | 3440 */ |
3655 static const StaticTypeWarningCode UNDEFINED_SUPER_GETTER = | 3441 static const StaticTypeWarningCode UNDEFINED_SUPER_GETTER = |
3656 const StaticTypeWarningCode( | 3442 const StaticTypeWarningCode('UNDEFINED_SUPER_GETTER', |
3657 'UNDEFINED_SUPER_GETTER', | |
3658 "The getter '{0}' is not defined in a superclass of '{1}'"); | 3443 "The getter '{0}' is not defined in a superclass of '{1}'"); |
3659 | 3444 |
3660 /** | 3445 /** |
3661 * 12.15.4 Super Invocation: A super method invocation <i>i</i> has the form | 3446 * 12.15.4 Super Invocation: A super method invocation <i>i</i> has the form |
3662 * <i>super.m(a<sub>1</sub>, …, a<sub>n</sub>, x<sub>n+1</sub>: | 3447 * <i>super.m(a<sub>1</sub>, …, a<sub>n</sub>, x<sub>n+1</sub>: |
3663 * a<sub>n+1</sub>, … x<sub>n+k</sub>: a<sub>n+k</sub>)</i>. It is a | 3448 * a<sub>n+1</sub>, … x<sub>n+k</sub>: a<sub>n+k</sub>)</i>. It is a |
3664 * static type warning if <i>S</i> does not have an accessible instance member | 3449 * static type warning if <i>S</i> does not have an accessible instance member |
3665 * named <i>m</i>. | 3450 * named <i>m</i>. |
3666 * | 3451 * |
3667 * @param methodName the name of the method that is undefined | 3452 * @param methodName the name of the method that is undefined |
3668 * @param typeName the resolved type name that the method lookup is happening | 3453 * @param typeName the resolved type name that the method lookup is happening |
3669 * on | 3454 * on |
3670 */ | 3455 */ |
3671 static const StaticTypeWarningCode UNDEFINED_SUPER_METHOD = | 3456 static const StaticTypeWarningCode UNDEFINED_SUPER_METHOD = |
3672 const StaticTypeWarningCode( | 3457 const StaticTypeWarningCode('UNDEFINED_SUPER_METHOD', |
3673 'UNDEFINED_SUPER_METHOD', | |
3674 "The method '{0}' is not defined in a superclass of '{1}'"); | 3458 "The method '{0}' is not defined in a superclass of '{1}'"); |
3675 | 3459 |
3676 /** | 3460 /** |
3677 * 12.18 Assignment: Evaluation of an assignment of the form | 3461 * 12.18 Assignment: Evaluation of an assignment of the form |
3678 * <i>e<sub>1</sub></i>[<i>e<sub>2</sub></i>] = <i>e<sub>3</sub></i> is | 3462 * <i>e<sub>1</sub></i>[<i>e<sub>2</sub></i>] = <i>e<sub>3</sub></i> is |
3679 * equivalent to the evaluation of the expression (a, i, e){a.[]=(i, e); | 3463 * equivalent to the evaluation of the expression (a, i, e){a.[]=(i, e); |
3680 * return e;} (<i>e<sub>1</sub></i>, <i>e<sub>2</sub></i>, | 3464 * return e;} (<i>e<sub>1</sub></i>, <i>e<sub>2</sub></i>, |
3681 * <i>e<sub>2</sub></i>). | 3465 * <i>e<sub>2</sub></i>). |
3682 * | 3466 * |
3683 * 12.29 Assignable Expressions: An assignable expression of the form | 3467 * 12.29 Assignable Expressions: An assignable expression of the form |
3684 * <i>e<sub>1</sub></i>[<i>e<sub>2</sub></i>] is evaluated as a method | 3468 * <i>e<sub>1</sub></i>[<i>e<sub>2</sub></i>] is evaluated as a method |
3685 * invocation of the operator method [] on <i>e<sub>1</sub></i> with argument | 3469 * invocation of the operator method [] on <i>e<sub>1</sub></i> with argument |
3686 * <i>e<sub>2</sub></i>. | 3470 * <i>e<sub>2</sub></i>. |
3687 * | 3471 * |
3688 * 12.15.1 Ordinary Invocation: Let <i>T</i> be the static type of <i>o</i>. | 3472 * 12.15.1 Ordinary Invocation: Let <i>T</i> be the static type of <i>o</i>. |
3689 * It is a static type warning if <i>T</i> does not have an accessible | 3473 * It is a static type warning if <i>T</i> does not have an accessible |
3690 * instance member named <i>m</i>. | 3474 * instance member named <i>m</i>. |
3691 * | 3475 * |
3692 * @param operator the name of the operator | 3476 * @param operator the name of the operator |
3693 * @param enclosingType the name of the enclosing type where the operator is | 3477 * @param enclosingType the name of the enclosing type where the operator is |
3694 * being looked for | 3478 * being looked for |
3695 */ | 3479 */ |
3696 static const StaticTypeWarningCode UNDEFINED_SUPER_OPERATOR = | 3480 static const StaticTypeWarningCode UNDEFINED_SUPER_OPERATOR = |
3697 const StaticTypeWarningCode( | 3481 const StaticTypeWarningCode('UNDEFINED_SUPER_OPERATOR', |
3698 'UNDEFINED_SUPER_OPERATOR', | |
3699 "The operator '{0}' is not defined in a superclass of '{1}'"); | 3482 "The operator '{0}' is not defined in a superclass of '{1}'"); |
3700 | 3483 |
3701 /** | 3484 /** |
3702 * 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i>. | 3485 * 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i>. |
3703 * It is a static type warning if <i>T</i> does not have an accessible | 3486 * It is a static type warning if <i>T</i> does not have an accessible |
3704 * instance setter named <i>v=</i>. | 3487 * instance setter named <i>v=</i>. |
3705 * | 3488 * |
3706 * @param setterName the name of the setter | 3489 * @param setterName the name of the setter |
3707 * @param enclosingType the name of the enclosing type where the setter is | 3490 * @param enclosingType the name of the enclosing type where the setter is |
3708 * being looked for | 3491 * being looked for |
3709 * See [INACCESSIBLE_SETTER]. | 3492 * See [INACCESSIBLE_SETTER]. |
3710 */ | 3493 */ |
3711 static const StaticTypeWarningCode UNDEFINED_SUPER_SETTER = | 3494 static const StaticTypeWarningCode UNDEFINED_SUPER_SETTER = |
3712 const StaticTypeWarningCode( | 3495 const StaticTypeWarningCode('UNDEFINED_SUPER_SETTER', |
3713 'UNDEFINED_SUPER_SETTER', | |
3714 "The setter '{0}' is not defined in a superclass of '{1}'"); | 3496 "The setter '{0}' is not defined in a superclass of '{1}'"); |
3715 | 3497 |
3716 /** | 3498 /** |
3717 * 12.15.1 Ordinary Invocation: It is a static type warning if <i>T</i> does | 3499 * 12.15.1 Ordinary Invocation: It is a static type warning if <i>T</i> does |
3718 * not have an accessible (3.2) instance member named <i>m</i>. | 3500 * not have an accessible (3.2) instance member named <i>m</i>. |
3719 * | 3501 * |
3720 * This is a specialization of [INSTANCE_ACCESS_TO_STATIC_MEMBER] that is used | 3502 * This is a specialization of [INSTANCE_ACCESS_TO_STATIC_MEMBER] that is used |
3721 * when we are able to find the name defined in a supertype. It exists to | 3503 * when we are able to find the name defined in a supertype. It exists to |
3722 * provide a more informative error message. | 3504 * provide a more informative error message. |
3723 */ | 3505 */ |
3724 static const StaticTypeWarningCode | 3506 static const StaticTypeWarningCode UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_M
EMBER = |
3725 UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER = | |
3726 const StaticTypeWarningCode( | 3507 const StaticTypeWarningCode( |
3727 'UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER', | 3508 'UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER', |
3728 "Static members from supertypes must be qualified by the name of the d
efining type"); | 3509 "Static members from supertypes must be qualified by the name of the d
efining type"); |
3729 | 3510 |
3730 /** | 3511 /** |
3731 * 15.8 Parameterized Types: It is a static type warning if <i>G</i> is not a | 3512 * 15.8 Parameterized Types: It is a static type warning if <i>G</i> is not a |
3732 * generic type with exactly <i>n</i> type parameters. | 3513 * generic type with exactly <i>n</i> type parameters. |
3733 * | 3514 * |
3734 * @param typeName the name of the type being referenced (<i>G</i>) | 3515 * @param typeName the name of the type being referenced (<i>G</i>) |
3735 * @param parameterCount the number of type parameters that were declared | 3516 * @param parameterCount the number of type parameters that were declared |
3736 * @param argumentCount the number of type arguments provided | 3517 * @param argumentCount the number of type arguments provided |
3737 * See [CompileTimeErrorCode.CONST_WITH_INVALID_TYPE_PARAMETERS], and | 3518 * See [CompileTimeErrorCode.CONST_WITH_INVALID_TYPE_PARAMETERS], and |
3738 * [CompileTimeErrorCode.NEW_WITH_INVALID_TYPE_PARAMETERS]. | 3519 * [CompileTimeErrorCode.NEW_WITH_INVALID_TYPE_PARAMETERS]. |
3739 */ | 3520 */ |
3740 static const StaticTypeWarningCode WRONG_NUMBER_OF_TYPE_ARGUMENTS = | 3521 static const StaticTypeWarningCode WRONG_NUMBER_OF_TYPE_ARGUMENTS = |
3741 const StaticTypeWarningCode( | 3522 const StaticTypeWarningCode('WRONG_NUMBER_OF_TYPE_ARGUMENTS', |
3742 'WRONG_NUMBER_OF_TYPE_ARGUMENTS', | |
3743 "The type '{0}' is declared with {1} type parameters, but {2} type arg
uments were given"); | 3523 "The type '{0}' is declared with {1} type parameters, but {2} type arg
uments were given"); |
3744 | 3524 |
3745 /** | 3525 /** |
3746 * 17.16.1 Yield: Let T be the static type of e [the expression to the right | 3526 * 17.16.1 Yield: Let T be the static type of e [the expression to the right |
3747 * of "yield"] and let f be the immediately enclosing function. It is a | 3527 * of "yield"] and let f be the immediately enclosing function. It is a |
3748 * static type warning if either: | 3528 * static type warning if either: |
3749 * | 3529 * |
3750 * - the body of f is marked async* and the type Stream<T> may not be | 3530 * - the body of f is marked async* and the type Stream<T> may not be |
3751 * assigned to the declared return type of f. | 3531 * assigned to the declared return type of f. |
3752 * | 3532 * |
3753 * - the body of f is marked sync* and the type Iterable<T> may not be | 3533 * - the body of f is marked sync* and the type Iterable<T> may not be |
3754 * assigned to the declared return type of f. | 3534 * assigned to the declared return type of f. |
3755 * | 3535 * |
3756 * 17.16.2 Yield-Each: Let T be the static type of e [the expression to the | 3536 * 17.16.2 Yield-Each: Let T be the static type of e [the expression to the |
3757 * right of "yield*"] and let f be the immediately enclosing function. It is | 3537 * right of "yield*"] and let f be the immediately enclosing function. It is |
3758 * a static type warning if T may not be assigned to the declared return type | 3538 * a static type warning if T may not be assigned to the declared return type |
3759 * of f. If f is synchronous it is a static type warning if T may not be | 3539 * of f. If f is synchronous it is a static type warning if T may not be |
3760 * assigned to Iterable. If f is asynchronous it is a static type warning if | 3540 * assigned to Iterable. If f is asynchronous it is a static type warning if |
3761 * T may not be assigned to Stream. | 3541 * T may not be assigned to Stream. |
3762 */ | 3542 */ |
3763 static const StaticTypeWarningCode YIELD_OF_INVALID_TYPE = | 3543 static const StaticTypeWarningCode YIELD_OF_INVALID_TYPE = |
3764 const StaticTypeWarningCode( | 3544 const StaticTypeWarningCode('YIELD_OF_INVALID_TYPE', |
3765 'YIELD_OF_INVALID_TYPE', | |
3766 "The type '{0}' implied by the 'yield' expression must be assignable t
o '{1}'"); | 3545 "The type '{0}' implied by the 'yield' expression must be assignable t
o '{1}'"); |
3767 | 3546 |
3768 /** | 3547 /** |
3769 * Initialize a newly created error code to have the given [name]. The message | 3548 * Initialize a newly created error code to have the given [name]. The message |
3770 * associated with the error will be created from the given [message] | 3549 * associated with the error will be created from the given [message] |
3771 * template. The correction associated with the error will be created from the | 3550 * template. The correction associated with the error will be created from the |
3772 * given [correction] template. | 3551 * given [correction] template. |
3773 */ | 3552 */ |
3774 const StaticTypeWarningCode(String name, String message, [String correction]) | 3553 const StaticTypeWarningCode(String name, String message, [String correction]) |
3775 : super(name, message, correction); | 3554 : super(name, message, correction); |
(...skipping 22 matching lines...) Expand all Loading... |
3798 * <i>NoSuchMethodError</i> is raised. | 3577 * <i>NoSuchMethodError</i> is raised. |
3799 * 3. If <i>N</i> is referenced as a type, it is treated as a malformed type. | 3578 * 3. If <i>N</i> is referenced as a type, it is treated as a malformed type. |
3800 * | 3579 * |
3801 * @param ambiguousTypeName the name of the ambiguous type | 3580 * @param ambiguousTypeName the name of the ambiguous type |
3802 * @param firstLibraryName the name of the first library that the type is | 3581 * @param firstLibraryName the name of the first library that the type is |
3803 * found | 3582 * found |
3804 * @param secondLibraryName the name of the second library that the type is | 3583 * @param secondLibraryName the name of the second library that the type is |
3805 * found | 3584 * found |
3806 */ | 3585 */ |
3807 static const StaticWarningCode AMBIGUOUS_IMPORT = const StaticWarningCode( | 3586 static const StaticWarningCode AMBIGUOUS_IMPORT = const StaticWarningCode( |
3808 'AMBIGUOUS_IMPORT', | 3587 'AMBIGUOUS_IMPORT', "The name '{0}' is defined in the libraries {1}", |
3809 "The name '{0}' is defined in the libraries {1}", | |
3810 "Consider using 'as prefix' for one of the import directives " | 3588 "Consider using 'as prefix' for one of the import directives " |
3811 "or hiding the name from all but one of the imports."); | 3589 "or hiding the name from all but one of the imports."); |
3812 | 3590 |
3813 /** | 3591 /** |
3814 * 12.11.1 New: It is a static warning if the static type of <i>a<sub>i</sub>, | 3592 * 12.11.1 New: It is a static warning if the static type of <i>a<sub>i</sub>, |
3815 * 1 <= i <= n+ k</i> may not be assigned to the type of the | 3593 * 1 <= i <= n+ k</i> may not be assigned to the type of the |
3816 * corresponding formal parameter of the constructor <i>T.id</i> (respectively | 3594 * corresponding formal parameter of the constructor <i>T.id</i> (respectively |
3817 * <i>T</i>). | 3595 * <i>T</i>). |
3818 * | 3596 * |
3819 * 12.11.2 Const: It is a static warning if the static type of | 3597 * 12.11.2 Const: It is a static warning if the static type of |
3820 * <i>a<sub>i</sub>, 1 <= i <= n+ k</i> may not be assigned to the type | 3598 * <i>a<sub>i</sub>, 1 <= i <= n+ k</i> may not be assigned to the type |
3821 * of the corresponding formal parameter of the constructor <i>T.id</i> | 3599 * of the corresponding formal parameter of the constructor <i>T.id</i> |
(...skipping 10 matching lines...) Expand all Loading... |
3832 * <= i <= l</i>, must have a corresponding named parameter in the set | 3610 * <= i <= l</i>, must have a corresponding named parameter in the set |
3833 * <i>{p<sub>n+1</sub>, … p<sub>n+k</sub>}</i> or a static warning | 3611 * <i>{p<sub>n+1</sub>, … p<sub>n+k</sub>}</i> or a static warning |
3834 * occurs. It is a static warning if <i>T<sub>m+j</sub></i> may not be | 3612 * occurs. It is a static warning if <i>T<sub>m+j</sub></i> may not be |
3835 * assigned to <i>S<sub>r</sub></i>, where <i>r = q<sub>j</sub>, 1 <= j | 3613 * assigned to <i>S<sub>r</sub></i>, where <i>r = q<sub>j</sub>, 1 <= j |
3836 * <= l</i>. | 3614 * <= l</i>. |
3837 * | 3615 * |
3838 * @param actualType the name of the actual argument type | 3616 * @param actualType the name of the actual argument type |
3839 * @param expectedType the name of the expected type | 3617 * @param expectedType the name of the expected type |
3840 */ | 3618 */ |
3841 static const StaticWarningCode ARGUMENT_TYPE_NOT_ASSIGNABLE = | 3619 static const StaticWarningCode ARGUMENT_TYPE_NOT_ASSIGNABLE = |
3842 const StaticWarningCode( | 3620 const StaticWarningCode('ARGUMENT_TYPE_NOT_ASSIGNABLE', |
3843 'ARGUMENT_TYPE_NOT_ASSIGNABLE', | |
3844 "The argument type '{0}' cannot be assigned to the parameter type '{1}
'"); | 3621 "The argument type '{0}' cannot be assigned to the parameter type '{1}
'"); |
3845 | 3622 |
3846 /** | 3623 /** |
3847 * 5 Variables: Attempting to assign to a final variable elsewhere will cause | 3624 * 5 Variables: Attempting to assign to a final variable elsewhere will cause |
3848 * a NoSuchMethodError to be thrown, because no setter is defined for it. The | 3625 * a NoSuchMethodError to be thrown, because no setter is defined for it. The |
3849 * assignment will also give rise to a static warning for the same reason. | 3626 * assignment will also give rise to a static warning for the same reason. |
3850 * | 3627 * |
3851 * A constant variable is always implicitly final. | 3628 * A constant variable is always implicitly final. |
3852 */ | 3629 */ |
3853 static const StaticWarningCode ASSIGNMENT_TO_CONST = const StaticWarningCode( | 3630 static const StaticWarningCode ASSIGNMENT_TO_CONST = const StaticWarningCode( |
3854 'ASSIGNMENT_TO_CONST', | 3631 'ASSIGNMENT_TO_CONST', "Constant variables cannot be assigned a value"); |
3855 "Constant variables cannot be assigned a value"); | |
3856 | 3632 |
3857 /** | 3633 /** |
3858 * 5 Variables: Attempting to assign to a final variable elsewhere will cause | 3634 * 5 Variables: Attempting to assign to a final variable elsewhere will cause |
3859 * a NoSuchMethodError to be thrown, because no setter is defined for it. The | 3635 * a NoSuchMethodError to be thrown, because no setter is defined for it. The |
3860 * assignment will also give rise to a static warning for the same reason. | 3636 * assignment will also give rise to a static warning for the same reason. |
3861 */ | 3637 */ |
3862 static const StaticWarningCode ASSIGNMENT_TO_FINAL = const StaticWarningCode( | 3638 static const StaticWarningCode ASSIGNMENT_TO_FINAL = const StaticWarningCode( |
3863 'ASSIGNMENT_TO_FINAL', | 3639 'ASSIGNMENT_TO_FINAL', "'{0}' cannot be used as a setter, it is final"); |
3864 "'{0}' cannot be used as a setter, it is final"); | |
3865 | 3640 |
3866 /** | 3641 /** |
3867 * 5 Variables: Attempting to assign to a final variable elsewhere will cause | 3642 * 5 Variables: Attempting to assign to a final variable elsewhere will cause |
3868 * a NoSuchMethodError to be thrown, because no setter is defined for it. The | 3643 * a NoSuchMethodError to be thrown, because no setter is defined for it. The |
3869 * assignment will also give rise to a static warning for the same reason. | 3644 * assignment will also give rise to a static warning for the same reason. |
3870 */ | 3645 */ |
3871 static const StaticWarningCode ASSIGNMENT_TO_FINAL_NO_SETTER = | 3646 static const StaticWarningCode ASSIGNMENT_TO_FINAL_NO_SETTER = |
3872 const StaticWarningCode( | 3647 const StaticWarningCode('ASSIGNMENT_TO_FINAL_NO_SETTER', |
3873 'ASSIGNMENT_TO_FINAL_NO_SETTER', | |
3874 "No setter named '{0}' in class '{1}'"); | 3648 "No setter named '{0}' in class '{1}'"); |
3875 | 3649 |
3876 /** | 3650 /** |
3877 * 12.18 Assignment: It is as static warning if an assignment of the form | 3651 * 12.18 Assignment: It is as static warning if an assignment of the form |
3878 * <i>v = e</i> occurs inside a top level or static function (be it function, | 3652 * <i>v = e</i> occurs inside a top level or static function (be it function, |
3879 * method, getter, or setter) or variable initializer and there is neither a | 3653 * method, getter, or setter) or variable initializer and there is neither a |
3880 * local variable declaration with name <i>v</i> nor setter declaration with | 3654 * local variable declaration with name <i>v</i> nor setter declaration with |
3881 * name <i>v=</i> in the lexical scope enclosing the assignment. | 3655 * name <i>v=</i> in the lexical scope enclosing the assignment. |
3882 */ | 3656 */ |
3883 static const StaticWarningCode ASSIGNMENT_TO_FUNCTION = | 3657 static const StaticWarningCode ASSIGNMENT_TO_FUNCTION = |
3884 const StaticWarningCode( | 3658 const StaticWarningCode( |
3885 'ASSIGNMENT_TO_FUNCTION', | 3659 'ASSIGNMENT_TO_FUNCTION', "Functions cannot be assigned a value"); |
3886 "Functions cannot be assigned a value"); | |
3887 | 3660 |
3888 /** | 3661 /** |
3889 * 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i> | 3662 * 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i> |
3890 * It is a static type warning if <i>T</i> does not have an accessible | 3663 * It is a static type warning if <i>T</i> does not have an accessible |
3891 * instance setter named <i>v=</i>. | 3664 * instance setter named <i>v=</i>. |
3892 */ | 3665 */ |
3893 static const StaticWarningCode ASSIGNMENT_TO_METHOD = const StaticWarningCode( | 3666 static const StaticWarningCode ASSIGNMENT_TO_METHOD = const StaticWarningCode( |
3894 'ASSIGNMENT_TO_METHOD', | 3667 'ASSIGNMENT_TO_METHOD', "Methods cannot be assigned a value"); |
3895 "Methods cannot be assigned a value"); | |
3896 | 3668 |
3897 /** | 3669 /** |
3898 * 13.9 Switch: It is a static warning if the last statement of the statement | 3670 * 13.9 Switch: It is a static warning if the last statement of the statement |
3899 * sequence <i>s<sub>k</sub></i> is not a break, continue, return or throw | 3671 * sequence <i>s<sub>k</sub></i> is not a break, continue, return or throw |
3900 * statement. | 3672 * statement. |
3901 */ | 3673 */ |
3902 static const StaticWarningCode CASE_BLOCK_NOT_TERMINATED = | 3674 static const StaticWarningCode CASE_BLOCK_NOT_TERMINATED = |
3903 const StaticWarningCode( | 3675 const StaticWarningCode('CASE_BLOCK_NOT_TERMINATED', |
3904 'CASE_BLOCK_NOT_TERMINATED', | |
3905 "The last statement of the 'case' should be 'break', 'continue', 'retu
rn' or 'throw'"); | 3676 "The last statement of the 'case' should be 'break', 'continue', 'retu
rn' or 'throw'"); |
3906 | 3677 |
3907 /** | 3678 /** |
3908 * 12.32 Type Cast: It is a static warning if <i>T</i> does not denote a type | 3679 * 12.32 Type Cast: It is a static warning if <i>T</i> does not denote a type |
3909 * available in the current lexical scope. | 3680 * available in the current lexical scope. |
3910 */ | 3681 */ |
3911 static const StaticWarningCode CAST_TO_NON_TYPE = const StaticWarningCode( | 3682 static const StaticWarningCode CAST_TO_NON_TYPE = const StaticWarningCode( |
3912 'CAST_TO_NON_TYPE', | 3683 'CAST_TO_NON_TYPE', |
3913 "The name '{0}' is not a type and cannot be used in an 'as' expression"); | 3684 "The name '{0}' is not a type and cannot be used in an 'as' expression"); |
3914 | 3685 |
3915 /** | 3686 /** |
3916 * 7.4 Abstract Instance Members: It is a static warning if an abstract member | 3687 * 7.4 Abstract Instance Members: It is a static warning if an abstract member |
3917 * is declared or inherited in a concrete class. | 3688 * is declared or inherited in a concrete class. |
3918 */ | 3689 */ |
3919 static const StaticWarningCode CONCRETE_CLASS_WITH_ABSTRACT_MEMBER = | 3690 static const StaticWarningCode CONCRETE_CLASS_WITH_ABSTRACT_MEMBER = |
3920 const StaticWarningCode( | 3691 const StaticWarningCode('CONCRETE_CLASS_WITH_ABSTRACT_MEMBER', |
3921 'CONCRETE_CLASS_WITH_ABSTRACT_MEMBER', | |
3922 "'{0}' must have a method body because '{1}' is not abstract"); | 3692 "'{0}' must have a method body because '{1}' is not abstract"); |
3923 | 3693 |
3924 /** | 3694 /** |
3925 * 14.1 Imports: If a name <i>N</i> is referenced by a library <i>L</i> and | 3695 * 14.1 Imports: If a name <i>N</i> is referenced by a library <i>L</i> and |
3926 * <i>N</i> would be introduced into the top level scope of <i>L</i> by an | 3696 * <i>N</i> would be introduced into the top level scope of <i>L</i> by an |
3927 * import from a library whose URI begins with <i>dart:</i> and an import from | 3697 * import from a library whose URI begins with <i>dart:</i> and an import from |
3928 * a library whose URI does not begin with <i>dart:</i>: | 3698 * a library whose URI does not begin with <i>dart:</i>: |
3929 * * The import from <i>dart:</i> is implicitly extended by a hide N clause. | 3699 * * The import from <i>dart:</i> is implicitly extended by a hide N clause. |
3930 * * A static warning is issued. | 3700 * * A static warning is issued. |
3931 * | 3701 * |
3932 * @param ambiguousName the ambiguous name | 3702 * @param ambiguousName the ambiguous name |
3933 * @param sdkLibraryName the name of the dart: library that the element is | 3703 * @param sdkLibraryName the name of the dart: library that the element is |
3934 * found | 3704 * found |
3935 * @param otherLibraryName the name of the non-dart: library that the element | 3705 * @param otherLibraryName the name of the non-dart: library that the element |
3936 * is found | 3706 * is found |
3937 */ | 3707 */ |
3938 static const StaticWarningCode CONFLICTING_DART_IMPORT = | 3708 static const StaticWarningCode CONFLICTING_DART_IMPORT = |
3939 const StaticWarningCode( | 3709 const StaticWarningCode('CONFLICTING_DART_IMPORT', |
3940 'CONFLICTING_DART_IMPORT', | |
3941 "Element '{0}' from SDK library '{1}' is implicitly hidden by '{2}'"); | 3710 "Element '{0}' from SDK library '{1}' is implicitly hidden by '{2}'"); |
3942 | 3711 |
3943 /** | 3712 /** |
3944 * 7.2 Getters: It is a static warning if a class <i>C</i> declares an | 3713 * 7.2 Getters: It is a static warning if a class <i>C</i> declares an |
3945 * instance getter named <i>v</i> and an accessible static member named | 3714 * instance getter named <i>v</i> and an accessible static member named |
3946 * <i>v</i> or <i>v=</i> is declared in a superclass of <i>C</i>. | 3715 * <i>v</i> or <i>v=</i> is declared in a superclass of <i>C</i>. |
3947 * | 3716 * |
3948 * @param superName the name of the super class declaring a static member | 3717 * @param superName the name of the super class declaring a static member |
3949 */ | 3718 */ |
3950 static const StaticWarningCode | 3719 static const StaticWarningCode CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_MEMB
ER = |
3951 CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_MEMBER = | |
3952 const StaticWarningCode( | 3720 const StaticWarningCode( |
3953 'CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_MEMBER', | 3721 'CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_MEMBER', |
3954 "Superclass '{0}' declares static member with the same name"); | 3722 "Superclass '{0}' declares static member with the same name"); |
3955 | 3723 |
3956 /** | 3724 /** |
3957 * 7.1 Instance Methods: It is a static warning if a class <i>C</i> declares | 3725 * 7.1 Instance Methods: It is a static warning if a class <i>C</i> declares |
3958 * an instance method named <i>n</i> and has a setter named <i>n=</i>. | 3726 * an instance method named <i>n</i> and has a setter named <i>n=</i>. |
3959 */ | 3727 */ |
3960 static const StaticWarningCode CONFLICTING_INSTANCE_METHOD_SETTER = | 3728 static const StaticWarningCode CONFLICTING_INSTANCE_METHOD_SETTER = |
3961 const StaticWarningCode( | 3729 const StaticWarningCode('CONFLICTING_INSTANCE_METHOD_SETTER', |
3962 'CONFLICTING_INSTANCE_METHOD_SETTER', | |
3963 "Class '{0}' declares instance method '{1}', but also has a setter wit
h the same name from '{2}'"); | 3730 "Class '{0}' declares instance method '{1}', but also has a setter wit
h the same name from '{2}'"); |
3964 | 3731 |
3965 /** | 3732 /** |
3966 * 7.1 Instance Methods: It is a static warning if a class <i>C</i> declares | 3733 * 7.1 Instance Methods: It is a static warning if a class <i>C</i> declares |
3967 * an instance method named <i>n</i> and has a setter named <i>n=</i>. | 3734 * an instance method named <i>n</i> and has a setter named <i>n=</i>. |
3968 */ | 3735 */ |
3969 static const StaticWarningCode CONFLICTING_INSTANCE_METHOD_SETTER2 = | 3736 static const StaticWarningCode CONFLICTING_INSTANCE_METHOD_SETTER2 = |
3970 const StaticWarningCode( | 3737 const StaticWarningCode('CONFLICTING_INSTANCE_METHOD_SETTER2', |
3971 'CONFLICTING_INSTANCE_METHOD_SETTER2', | |
3972 "Class '{0}' declares the setter '{1}', but also has an instance metho
d in the same class"); | 3738 "Class '{0}' declares the setter '{1}', but also has an instance metho
d in the same class"); |
3973 | 3739 |
3974 /** | 3740 /** |
3975 * 7.3 Setters: It is a static warning if a class <i>C</i> declares an | 3741 * 7.3 Setters: It is a static warning if a class <i>C</i> declares an |
3976 * instance setter named <i>v=</i> and an accessible static member named | 3742 * instance setter named <i>v=</i> and an accessible static member named |
3977 * <i>v=</i> or <i>v</i> is declared in a superclass of <i>C</i>. | 3743 * <i>v=</i> or <i>v</i> is declared in a superclass of <i>C</i>. |
3978 * | 3744 * |
3979 * @param superName the name of the super class declaring a static member | 3745 * @param superName the name of the super class declaring a static member |
3980 */ | 3746 */ |
3981 static const StaticWarningCode | 3747 static const StaticWarningCode CONFLICTING_INSTANCE_SETTER_AND_SUPERCLASS_MEMB
ER = |
3982 CONFLICTING_INSTANCE_SETTER_AND_SUPERCLASS_MEMBER = | |
3983 const StaticWarningCode( | 3748 const StaticWarningCode( |
3984 'CONFLICTING_INSTANCE_SETTER_AND_SUPERCLASS_MEMBER', | 3749 'CONFLICTING_INSTANCE_SETTER_AND_SUPERCLASS_MEMBER', |
3985 "Superclass '{0}' declares static member with the same name"); | 3750 "Superclass '{0}' declares static member with the same name"); |
3986 | 3751 |
3987 /** | 3752 /** |
3988 * 7.2 Getters: It is a static warning if a class declares a static getter | 3753 * 7.2 Getters: It is a static warning if a class declares a static getter |
3989 * named <i>v</i> and also has a non-static setter named <i>v=</i>. | 3754 * named <i>v</i> and also has a non-static setter named <i>v=</i>. |
3990 */ | 3755 */ |
3991 static const StaticWarningCode CONFLICTING_STATIC_GETTER_AND_INSTANCE_SETTER = | 3756 static const StaticWarningCode CONFLICTING_STATIC_GETTER_AND_INSTANCE_SETTER = |
3992 const StaticWarningCode( | 3757 const StaticWarningCode('CONFLICTING_STATIC_GETTER_AND_INSTANCE_SETTER', |
3993 'CONFLICTING_STATIC_GETTER_AND_INSTANCE_SETTER', | |
3994 "Class '{0}' declares non-static setter with the same name"); | 3758 "Class '{0}' declares non-static setter with the same name"); |
3995 | 3759 |
3996 /** | 3760 /** |
3997 * 7.3 Setters: It is a static warning if a class declares a static setter | 3761 * 7.3 Setters: It is a static warning if a class declares a static setter |
3998 * named <i>v=</i> and also has a non-static member named <i>v</i>. | 3762 * named <i>v=</i> and also has a non-static member named <i>v</i>. |
3999 */ | 3763 */ |
4000 static const StaticWarningCode CONFLICTING_STATIC_SETTER_AND_INSTANCE_MEMBER = | 3764 static const StaticWarningCode CONFLICTING_STATIC_SETTER_AND_INSTANCE_MEMBER = |
4001 const StaticWarningCode( | 3765 const StaticWarningCode('CONFLICTING_STATIC_SETTER_AND_INSTANCE_MEMBER', |
4002 'CONFLICTING_STATIC_SETTER_AND_INSTANCE_MEMBER', | |
4003 "Class '{0}' declares non-static member with the same name"); | 3766 "Class '{0}' declares non-static member with the same name"); |
4004 | 3767 |
4005 /** | 3768 /** |
4006 * 12.11.2 Const: Given an instance creation expression of the form <i>const | 3769 * 12.11.2 Const: Given an instance creation expression of the form <i>const |
4007 * q(a<sub>1</sub>, … a<sub>n</sub>)</i> it is a static warning if | 3770 * q(a<sub>1</sub>, … a<sub>n</sub>)</i> it is a static warning if |
4008 * <i>q</i> is the constructor of an abstract class but <i>q</i> is not a | 3771 * <i>q</i> is the constructor of an abstract class but <i>q</i> is not a |
4009 * factory constructor. | 3772 * factory constructor. |
4010 */ | 3773 */ |
4011 static const StaticWarningCode CONST_WITH_ABSTRACT_CLASS = | 3774 static const StaticWarningCode CONST_WITH_ABSTRACT_CLASS = |
4012 const StaticWarningCode( | 3775 const StaticWarningCode('CONST_WITH_ABSTRACT_CLASS', |
4013 'CONST_WITH_ABSTRACT_CLASS', | |
4014 "Abstract classes cannot be created with a 'const' expression"); | 3776 "Abstract classes cannot be created with a 'const' expression"); |
4015 | 3777 |
4016 /** | 3778 /** |
4017 * 12.7 Maps: It is a static warning if the values of any two keys in a map | 3779 * 12.7 Maps: It is a static warning if the values of any two keys in a map |
4018 * literal are equal. | 3780 * literal are equal. |
4019 */ | 3781 */ |
4020 static const StaticWarningCode EQUAL_KEYS_IN_MAP = | 3782 static const StaticWarningCode EQUAL_KEYS_IN_MAP = const StaticWarningCode( |
4021 const StaticWarningCode('EQUAL_KEYS_IN_MAP', "Keys in a map cannot be equa
l"); | 3783 'EQUAL_KEYS_IN_MAP', "Keys in a map cannot be equal"); |
4022 | 3784 |
4023 /** | 3785 /** |
4024 * 14.2 Exports: It is a static warning to export two different libraries with | 3786 * 14.2 Exports: It is a static warning to export two different libraries with |
4025 * the same name. | 3787 * the same name. |
4026 * | 3788 * |
4027 * @param uri1 the uri pointing to a first library | 3789 * @param uri1 the uri pointing to a first library |
4028 * @param uri2 the uri pointing to a second library | 3790 * @param uri2 the uri pointing to a second library |
4029 * @param name the shared name of the exported libraries | 3791 * @param name the shared name of the exported libraries |
4030 */ | 3792 */ |
4031 static const StaticWarningCode EXPORT_DUPLICATED_LIBRARY_NAMED = | 3793 static const StaticWarningCode EXPORT_DUPLICATED_LIBRARY_NAMED = |
4032 const StaticWarningCode( | 3794 const StaticWarningCode('EXPORT_DUPLICATED_LIBRARY_NAMED', |
4033 'EXPORT_DUPLICATED_LIBRARY_NAMED', | |
4034 "The exported libraries '{0}' and '{1}' cannot have the same name '{2}
'"); | 3795 "The exported libraries '{0}' and '{1}' cannot have the same name '{2}
'"); |
4035 | 3796 |
4036 /** | 3797 /** |
4037 * 14.2 Exports: It is a static warning to export two different libraries with | 3798 * 14.2 Exports: It is a static warning to export two different libraries with |
4038 * the same name. | 3799 * the same name. |
4039 * | 3800 * |
4040 * @param uri1 the uri pointing to a first library | 3801 * @param uri1 the uri pointing to a first library |
4041 * @param uri2 the uri pointing to a second library | 3802 * @param uri2 the uri pointing to a second library |
4042 */ | 3803 */ |
4043 static const StaticWarningCode EXPORT_DUPLICATED_LIBRARY_UNNAMED = | 3804 static const StaticWarningCode EXPORT_DUPLICATED_LIBRARY_UNNAMED = |
4044 const StaticWarningCode( | 3805 const StaticWarningCode('EXPORT_DUPLICATED_LIBRARY_UNNAMED', |
4045 'EXPORT_DUPLICATED_LIBRARY_UNNAMED', | |
4046 "The exported libraries '{0}' and '{1}' cannot both be unnamed"); | 3806 "The exported libraries '{0}' and '{1}' cannot both be unnamed"); |
4047 | 3807 |
4048 /** | 3808 /** |
4049 * 12.14.2 Binding Actuals to Formals: It is a static warning if <i>m < | 3809 * 12.14.2 Binding Actuals to Formals: It is a static warning if <i>m < |
4050 * h</i> or if <i>m > n</i>. | 3810 * h</i> or if <i>m > n</i>. |
4051 * | 3811 * |
4052 * @param requiredCount the maximum number of positional arguments | 3812 * @param requiredCount the maximum number of positional arguments |
4053 * @param argumentCount the actual number of positional arguments given | 3813 * @param argumentCount the actual number of positional arguments given |
4054 * See [NOT_ENOUGH_REQUIRED_ARGUMENTS]. | 3814 * See [NOT_ENOUGH_REQUIRED_ARGUMENTS]. |
4055 */ | 3815 */ |
4056 static const StaticWarningCode EXTRA_POSITIONAL_ARGUMENTS = | 3816 static const StaticWarningCode EXTRA_POSITIONAL_ARGUMENTS = |
4057 const StaticWarningCode( | 3817 const StaticWarningCode('EXTRA_POSITIONAL_ARGUMENTS', |
4058 'EXTRA_POSITIONAL_ARGUMENTS', | |
4059 "{0} positional arguments expected, but {1} found"); | 3818 "{0} positional arguments expected, but {1} found"); |
4060 | 3819 |
4061 /** | 3820 /** |
4062 * 5. Variables: It is a static warning if a final instance variable that has | 3821 * 5. Variables: It is a static warning if a final instance variable that has |
4063 * been initialized at its point of declaration is also initialized in a | 3822 * been initialized at its point of declaration is also initialized in a |
4064 * constructor. | 3823 * constructor. |
4065 */ | 3824 */ |
4066 static const StaticWarningCode | 3825 static const StaticWarningCode FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATIO
N = |
4067 FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION = | |
4068 const StaticWarningCode( | 3826 const StaticWarningCode( |
4069 'FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION', | 3827 'FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION', |
4070 "Values cannot be set in the constructor if they are final, and have a
lready been set"); | 3828 "Values cannot be set in the constructor if they are final, and have a
lready been set"); |
4071 | 3829 |
4072 /** | 3830 /** |
4073 * 5. Variables: It is a static warning if a final instance variable that has | 3831 * 5. Variables: It is a static warning if a final instance variable that has |
4074 * been initialized at its point of declaration is also initialized in a | 3832 * been initialized at its point of declaration is also initialized in a |
4075 * constructor. | 3833 * constructor. |
4076 * | 3834 * |
4077 * @param name the name of the field in question | 3835 * @param name the name of the field in question |
4078 */ | 3836 */ |
4079 static const StaticWarningCode | 3837 static const StaticWarningCode FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTO
R = |
4080 FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR = | |
4081 const StaticWarningCode( | 3838 const StaticWarningCode( |
4082 'FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR', | 3839 'FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR', |
4083 "'{0}' is final and was given a value when it was declared, so it cann
ot be set to a new value"); | 3840 "'{0}' is final and was given a value when it was declared, so it cann
ot be set to a new value"); |
4084 | 3841 |
4085 /** | 3842 /** |
4086 * 7.6.1 Generative Constructors: Execution of an initializer of the form | 3843 * 7.6.1 Generative Constructors: Execution of an initializer of the form |
4087 * <b>this</b>.<i>v</i> = <i>e</i> proceeds as follows: First, the expression | 3844 * <b>this</b>.<i>v</i> = <i>e</i> proceeds as follows: First, the expression |
4088 * <i>e</i> is evaluated to an object <i>o</i>. Then, the instance variable | 3845 * <i>e</i> is evaluated to an object <i>o</i>. Then, the instance variable |
4089 * <i>v</i> of the object denoted by this is bound to <i>o</i>. | 3846 * <i>v</i> of the object denoted by this is bound to <i>o</i>. |
4090 * | 3847 * |
4091 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static | 3848 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static |
4092 * type of <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of | 3849 * type of <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of |
4093 * <i>p<sub>i</sub>, 1 <= i <= n+k</i> and let <i>S<sub>q</sub></i> be | 3850 * <i>p<sub>i</sub>, 1 <= i <= n+k</i> and let <i>S<sub>q</sub></i> be |
4094 * the type of the named parameter <i>q</i> of <i>f</i>. It is a static | 3851 * the type of the named parameter <i>q</i> of <i>f</i>. It is a static |
4095 * warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<sub>j</sub>, 1 | 3852 * warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<sub>j</sub>, 1 |
4096 * <= j <= m</i>. | 3853 * <= j <= m</i>. |
4097 * | 3854 * |
4098 * @param initializerType the name of the type of the initializer expression | 3855 * @param initializerType the name of the type of the initializer expression |
4099 * @param fieldType the name of the type of the field | 3856 * @param fieldType the name of the type of the field |
4100 */ | 3857 */ |
4101 static const StaticWarningCode FIELD_INITIALIZER_NOT_ASSIGNABLE = | 3858 static const StaticWarningCode FIELD_INITIALIZER_NOT_ASSIGNABLE = |
4102 const StaticWarningCode( | 3859 const StaticWarningCode('FIELD_INITIALIZER_NOT_ASSIGNABLE', |
4103 'FIELD_INITIALIZER_NOT_ASSIGNABLE', | |
4104 "The initializer type '{0}' cannot be assigned to the field type '{1}'
"); | 3860 "The initializer type '{0}' cannot be assigned to the field type '{1}'
"); |
4105 | 3861 |
4106 /** | 3862 /** |
4107 * 7.6.1 Generative Constructors: An initializing formal has the form | 3863 * 7.6.1 Generative Constructors: An initializing formal has the form |
4108 * <i>this.id</i>. It is a static warning if the static type of <i>id</i> is | 3864 * <i>this.id</i>. It is a static warning if the static type of <i>id</i> is |
4109 * not assignable to <i>T<sub>id</sub></i>. | 3865 * not assignable to <i>T<sub>id</sub></i>. |
4110 * | 3866 * |
4111 * @param parameterType the name of the type of the field formal parameter | 3867 * @param parameterType the name of the type of the field formal parameter |
4112 * @param fieldType the name of the type of the field | 3868 * @param fieldType the name of the type of the field |
4113 */ | 3869 */ |
4114 static const StaticWarningCode FIELD_INITIALIZING_FORMAL_NOT_ASSIGNABLE = | 3870 static const StaticWarningCode FIELD_INITIALIZING_FORMAL_NOT_ASSIGNABLE = |
4115 const StaticWarningCode( | 3871 const StaticWarningCode('FIELD_INITIALIZING_FORMAL_NOT_ASSIGNABLE', |
4116 'FIELD_INITIALIZING_FORMAL_NOT_ASSIGNABLE', | |
4117 "The parameter type '{0}' is incompatable with the field type '{1}'"); | 3872 "The parameter type '{0}' is incompatable with the field type '{1}'"); |
4118 | 3873 |
4119 /** | 3874 /** |
4120 * 5 Variables: It is a static warning if a library, static or local variable | 3875 * 5 Variables: It is a static warning if a library, static or local variable |
4121 * <i>v</i> is final and <i>v</i> is not initialized at its point of | 3876 * <i>v</i> is final and <i>v</i> is not initialized at its point of |
4122 * declaration. | 3877 * declaration. |
4123 * | 3878 * |
4124 * 7.6.1 Generative Constructors: Each final instance variable <i>f</i> | 3879 * 7.6.1 Generative Constructors: Each final instance variable <i>f</i> |
4125 * declared in the immediately enclosing class must have an initializer in | 3880 * declared in the immediately enclosing class must have an initializer in |
4126 * <i>k</i>'s initializer list unless it has already been initialized by one | 3881 * <i>k</i>'s initializer list unless it has already been initialized by one |
4127 * of the following means: | 3882 * of the following means: |
4128 * * Initialization at the declaration of <i>f</i>. | 3883 * * Initialization at the declaration of <i>f</i>. |
4129 * * Initialization by means of an initializing formal of <i>k</i>. | 3884 * * Initialization by means of an initializing formal of <i>k</i>. |
4130 * or a static warning occurs. | 3885 * or a static warning occurs. |
4131 * | 3886 * |
4132 * @param name the name of the uninitialized final variable | 3887 * @param name the name of the uninitialized final variable |
4133 */ | 3888 */ |
4134 static const StaticWarningCode FINAL_NOT_INITIALIZED = | 3889 static const StaticWarningCode FINAL_NOT_INITIALIZED = |
4135 const StaticWarningCode( | 3890 const StaticWarningCode('FINAL_NOT_INITIALIZED', |
4136 'FINAL_NOT_INITIALIZED', | |
4137 "The final variable '{0}' must be initialized"); | 3891 "The final variable '{0}' must be initialized"); |
4138 | 3892 |
4139 /** | 3893 /** |
4140 * 15.5 Function Types: It is a static warning if a concrete class implements | 3894 * 15.5 Function Types: It is a static warning if a concrete class implements |
4141 * Function and does not have a concrete method named call(). | 3895 * Function and does not have a concrete method named call(). |
4142 */ | 3896 */ |
4143 static const StaticWarningCode FUNCTION_WITHOUT_CALL = | 3897 static const StaticWarningCode FUNCTION_WITHOUT_CALL = const StaticWarningCode
( |
4144 const StaticWarningCode( | 3898 'FUNCTION_WITHOUT_CALL', |
4145 'FUNCTION_WITHOUT_CALL', | 3899 "Concrete classes that implement Function must implement the method call()
"); |
4146 "Concrete classes that implement Function must implement the method ca
ll()"); | |
4147 | 3900 |
4148 /** | 3901 /** |
4149 * 14.1 Imports: It is a static warning to import two different libraries with | 3902 * 14.1 Imports: It is a static warning to import two different libraries with |
4150 * the same name. | 3903 * the same name. |
4151 * | 3904 * |
4152 * @param uri1 the uri pointing to a first library | 3905 * @param uri1 the uri pointing to a first library |
4153 * @param uri2 the uri pointing to a second library | 3906 * @param uri2 the uri pointing to a second library |
4154 * @param name the shared name of the imported libraries | 3907 * @param name the shared name of the imported libraries |
4155 */ | 3908 */ |
4156 static const StaticWarningCode IMPORT_DUPLICATED_LIBRARY_NAMED = | 3909 static const StaticWarningCode IMPORT_DUPLICATED_LIBRARY_NAMED = |
4157 const StaticWarningCode( | 3910 const StaticWarningCode('IMPORT_DUPLICATED_LIBRARY_NAMED', |
4158 'IMPORT_DUPLICATED_LIBRARY_NAMED', | |
4159 "The imported libraries '{0}' and '{1}' cannot have the same name '{2}
'"); | 3911 "The imported libraries '{0}' and '{1}' cannot have the same name '{2}
'"); |
4160 | 3912 |
4161 /** | 3913 /** |
4162 * 14.1 Imports: It is a static warning to import two different libraries with | 3914 * 14.1 Imports: It is a static warning to import two different libraries with |
4163 * the same name. | 3915 * the same name. |
4164 * | 3916 * |
4165 * @param uri1 the uri pointing to a first library | 3917 * @param uri1 the uri pointing to a first library |
4166 * @param uri2 the uri pointing to a second library | 3918 * @param uri2 the uri pointing to a second library |
4167 */ | 3919 */ |
4168 static const StaticWarningCode IMPORT_DUPLICATED_LIBRARY_UNNAMED = | 3920 static const StaticWarningCode IMPORT_DUPLICATED_LIBRARY_UNNAMED = |
4169 const StaticWarningCode( | 3921 const StaticWarningCode('IMPORT_DUPLICATED_LIBRARY_UNNAMED', |
4170 'IMPORT_DUPLICATED_LIBRARY_UNNAMED', | |
4171 "The imported libraries '{0}' and '{1}' cannot both be unnamed"); | 3922 "The imported libraries '{0}' and '{1}' cannot both be unnamed"); |
4172 | 3923 |
4173 /** | 3924 /** |
4174 * 14.1 Imports: It is a static warning if the specified URI of a deferred | 3925 * 14.1 Imports: It is a static warning if the specified URI of a deferred |
4175 * import does not refer to a library declaration. | 3926 * import does not refer to a library declaration. |
4176 * | 3927 * |
4177 * @param uri the uri pointing to a non-library declaration | 3928 * @param uri the uri pointing to a non-library declaration |
4178 * See [CompileTimeErrorCode.IMPORT_OF_NON_LIBRARY]. | 3929 * See [CompileTimeErrorCode.IMPORT_OF_NON_LIBRARY]. |
4179 */ | 3930 */ |
4180 static const StaticWarningCode IMPORT_OF_NON_LIBRARY = | 3931 static const StaticWarningCode IMPORT_OF_NON_LIBRARY = |
4181 const StaticWarningCode( | 3932 const StaticWarningCode('IMPORT_OF_NON_LIBRARY', |
4182 'IMPORT_OF_NON_LIBRARY', | |
4183 "The imported library '{0}' must not have a part-of directive"); | 3933 "The imported library '{0}' must not have a part-of directive"); |
4184 | 3934 |
4185 /** | 3935 /** |
4186 * 8.1.1 Inheritance and Overriding: However, if the above rules would cause | 3936 * 8.1.1 Inheritance and Overriding: However, if the above rules would cause |
4187 * multiple members <i>m<sub>1</sub>, …, m<sub>k</sub></i> with the | 3937 * multiple members <i>m<sub>1</sub>, …, m<sub>k</sub></i> with the |
4188 * same name <i>n</i> that would be inherited (because identically named | 3938 * same name <i>n</i> that would be inherited (because identically named |
4189 * members existed in several superinterfaces) then at most one member is | 3939 * members existed in several superinterfaces) then at most one member is |
4190 * inherited. | 3940 * inherited. |
4191 * | 3941 * |
4192 * If some but not all of the <i>m<sub>i</sub>, 1 <= i <= k</i> are | 3942 * If some but not all of the <i>m<sub>i</sub>, 1 <= i <= k</i> are |
4193 * getters none of the <i>m<sub>i</sub></i> are inherited, and a static | 3943 * getters none of the <i>m<sub>i</sub></i> are inherited, and a static |
4194 * warning is issued. | 3944 * warning is issued. |
4195 */ | 3945 */ |
4196 static const StaticWarningCode | 3946 static const StaticWarningCode INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_METH
OD = |
4197 INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_METHOD = | |
4198 const StaticWarningCode( | 3947 const StaticWarningCode( |
4199 'INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_METHOD', | 3948 'INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_METHOD', |
4200 "'{0}' is inherited as a getter and also a method"); | 3949 "'{0}' is inherited as a getter and also a method"); |
4201 | 3950 |
4202 /** | 3951 /** |
4203 * 7.1 Instance Methods: It is a static warning if a class <i>C</i> declares | 3952 * 7.1 Instance Methods: It is a static warning if a class <i>C</i> declares |
4204 * an instance method named <i>n</i> and an accessible static member named | 3953 * an instance method named <i>n</i> and an accessible static member named |
4205 * <i>n</i> is declared in a superclass of <i>C</i>. | 3954 * <i>n</i> is declared in a superclass of <i>C</i>. |
4206 * | 3955 * |
4207 * @param memberName the name of the member with the name conflict | 3956 * @param memberName the name of the member with the name conflict |
4208 * @param superclassName the name of the enclosing class that has the static | 3957 * @param superclassName the name of the enclosing class that has the static |
4209 * member | 3958 * member |
4210 */ | 3959 */ |
4211 static const StaticWarningCode | 3960 static const StaticWarningCode INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLASS_S
TATIC = |
4212 INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLASS_STATIC = | |
4213 const StaticWarningCode( | 3961 const StaticWarningCode( |
4214 'INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLASS_STATIC', | 3962 'INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLASS_STATIC', |
4215 "'{0}' collides with a static member in the superclass '{1}'"); | 3963 "'{0}' collides with a static member in the superclass '{1}'"); |
4216 | 3964 |
4217 /** | 3965 /** |
4218 * 7.2 Getters: It is a static warning if a getter <i>m1</i> overrides a | 3966 * 7.2 Getters: It is a static warning if a getter <i>m1</i> overrides a |
4219 * getter <i>m2</i> and the type of <i>m1</i> is not a subtype of the type of | 3967 * getter <i>m2</i> and the type of <i>m1</i> is not a subtype of the type of |
4220 * <i>m2</i>. | 3968 * <i>m2</i>. |
4221 * | 3969 * |
4222 * @param actualReturnTypeName the name of the expected return type | 3970 * @param actualReturnTypeName the name of the expected return type |
4223 * @param expectedReturnType the name of the actual return type, not | 3971 * @param expectedReturnType the name of the actual return type, not |
4224 * assignable to the actualReturnTypeName | 3972 * assignable to the actualReturnTypeName |
4225 * @param className the name of the class where the overridden getter is | 3973 * @param className the name of the class where the overridden getter is |
4226 * declared | 3974 * declared |
4227 * See [INVALID_METHOD_OVERRIDE_RETURN_TYPE]. | 3975 * See [INVALID_METHOD_OVERRIDE_RETURN_TYPE]. |
4228 */ | 3976 */ |
4229 static const StaticWarningCode INVALID_GETTER_OVERRIDE_RETURN_TYPE = | 3977 static const StaticWarningCode INVALID_GETTER_OVERRIDE_RETURN_TYPE = |
4230 const StaticWarningCode( | 3978 const StaticWarningCode('INVALID_GETTER_OVERRIDE_RETURN_TYPE', |
4231 'INVALID_GETTER_OVERRIDE_RETURN_TYPE', | |
4232 "The return type '{0}' is not assignable to '{1}' as required by the g
etter it is overriding from '{2}'"); | 3979 "The return type '{0}' is not assignable to '{1}' as required by the g
etter it is overriding from '{2}'"); |
4233 | 3980 |
4234 /** | 3981 /** |
4235 * 7.1 Instance Methods: It is a static warning if an instance method | 3982 * 7.1 Instance Methods: It is a static warning if an instance method |
4236 * <i>m1</i> overrides an instance method <i>m2</i> and the type of <i>m1</i> | 3983 * <i>m1</i> overrides an instance method <i>m2</i> and the type of <i>m1</i> |
4237 * is not a subtype of the type of <i>m2</i>. | 3984 * is not a subtype of the type of <i>m2</i>. |
4238 * | 3985 * |
4239 * @param actualParamTypeName the name of the expected parameter type | 3986 * @param actualParamTypeName the name of the expected parameter type |
4240 * @param expectedParamType the name of the actual parameter type, not | 3987 * @param expectedParamType the name of the actual parameter type, not |
4241 * assignable to the actualParamTypeName | 3988 * assignable to the actualParamTypeName |
4242 * @param className the name of the class where the overridden method is | 3989 * @param className the name of the class where the overridden method is |
4243 * declared | 3990 * declared |
4244 */ | 3991 */ |
4245 static const StaticWarningCode INVALID_METHOD_OVERRIDE_NAMED_PARAM_TYPE = | 3992 static const StaticWarningCode INVALID_METHOD_OVERRIDE_NAMED_PARAM_TYPE = |
4246 const StaticWarningCode( | 3993 const StaticWarningCode('INVALID_METHOD_OVERRIDE_NAMED_PARAM_TYPE', |
4247 'INVALID_METHOD_OVERRIDE_NAMED_PARAM_TYPE', | |
4248 "The parameter type '{0}' is not assignable to '{1}' as required by th
e method it is overriding from '{2}'"); | 3994 "The parameter type '{0}' is not assignable to '{1}' as required by th
e method it is overriding from '{2}'"); |
4249 | 3995 |
4250 /** | 3996 /** |
4251 * 7.1 Instance Methods: It is a static warning if an instance method | 3997 * 7.1 Instance Methods: It is a static warning if an instance method |
4252 * <i>m1</i> overrides an instance method <i>m2</i> and the type of <i>m1</i> | 3998 * <i>m1</i> overrides an instance method <i>m2</i> and the type of <i>m1</i> |
4253 * is not a subtype of the type of <i>m2</i>. | 3999 * is not a subtype of the type of <i>m2</i>. |
4254 * | 4000 * |
4255 * @param actualParamTypeName the name of the expected parameter type | 4001 * @param actualParamTypeName the name of the expected parameter type |
4256 * @param expectedParamType the name of the actual parameter type, not | 4002 * @param expectedParamType the name of the actual parameter type, not |
4257 * assignable to the actualParamTypeName | 4003 * assignable to the actualParamTypeName |
4258 * @param className the name of the class where the overridden method is | 4004 * @param className the name of the class where the overridden method is |
4259 * declared | 4005 * declared |
4260 * See [INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE]. | 4006 * See [INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE]. |
4261 */ | 4007 */ |
4262 static const StaticWarningCode INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE = | 4008 static const StaticWarningCode INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE = |
4263 const StaticWarningCode( | 4009 const StaticWarningCode('INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE', |
4264 'INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE', | |
4265 "The parameter type '{0}' is not assignable to '{1}' as required by th
e method it is overriding from '{2}'"); | 4010 "The parameter type '{0}' is not assignable to '{1}' as required by th
e method it is overriding from '{2}'"); |
4266 | 4011 |
4267 /** | 4012 /** |
4268 * 7.1 Instance Methods: It is a static warning if an instance method | 4013 * 7.1 Instance Methods: It is a static warning if an instance method |
4269 * <i>m1</i> overrides an instance method <i>m2</i> and the type of <i>m1</i> | 4014 * <i>m1</i> overrides an instance method <i>m2</i> and the type of <i>m1</i> |
4270 * is not a subtype of the type of <i>m2</i>. | 4015 * is not a subtype of the type of <i>m2</i>. |
4271 * | 4016 * |
4272 * @param actualParamTypeName the name of the expected parameter type | 4017 * @param actualParamTypeName the name of the expected parameter type |
4273 * @param expectedParamType the name of the actual parameter type, not | 4018 * @param expectedParamType the name of the actual parameter type, not |
4274 * assignable to the actualParamTypeName | 4019 * assignable to the actualParamTypeName |
4275 * @param className the name of the class where the overridden method is | 4020 * @param className the name of the class where the overridden method is |
4276 * declared | 4021 * declared |
4277 */ | 4022 */ |
4278 static const StaticWarningCode INVALID_METHOD_OVERRIDE_OPTIONAL_PARAM_TYPE = | 4023 static const StaticWarningCode INVALID_METHOD_OVERRIDE_OPTIONAL_PARAM_TYPE = |
4279 const StaticWarningCode( | 4024 const StaticWarningCode('INVALID_METHOD_OVERRIDE_OPTIONAL_PARAM_TYPE', |
4280 'INVALID_METHOD_OVERRIDE_OPTIONAL_PARAM_TYPE', | |
4281 "The parameter type '{0}' is not assignable to '{1}' as required by th
e method it is overriding from '{2}'"); | 4025 "The parameter type '{0}' is not assignable to '{1}' as required by th
e method it is overriding from '{2}'"); |
4282 | 4026 |
4283 /** | 4027 /** |
4284 * 7.1 Instance Methods: It is a static warning if an instance method | 4028 * 7.1 Instance Methods: It is a static warning if an instance method |
4285 * <i>m1</i> overrides an instance method <i>m2</i> and the type of <i>m1</i> | 4029 * <i>m1</i> overrides an instance method <i>m2</i> and the type of <i>m1</i> |
4286 * is not a subtype of the type of <i>m2</i>. | 4030 * is not a subtype of the type of <i>m2</i>. |
4287 * | 4031 * |
4288 * @param actualReturnTypeName the name of the expected return type | 4032 * @param actualReturnTypeName the name of the expected return type |
4289 * @param expectedReturnType the name of the actual return type, not | 4033 * @param expectedReturnType the name of the actual return type, not |
4290 * assignable to the actualReturnTypeName | 4034 * assignable to the actualReturnTypeName |
4291 * @param className the name of the class where the overridden method is | 4035 * @param className the name of the class where the overridden method is |
4292 * declared | 4036 * declared |
4293 * See [INVALID_GETTER_OVERRIDE_RETURN_TYPE]. | 4037 * See [INVALID_GETTER_OVERRIDE_RETURN_TYPE]. |
4294 */ | 4038 */ |
4295 static const StaticWarningCode INVALID_METHOD_OVERRIDE_RETURN_TYPE = | 4039 static const StaticWarningCode INVALID_METHOD_OVERRIDE_RETURN_TYPE = |
4296 const StaticWarningCode( | 4040 const StaticWarningCode('INVALID_METHOD_OVERRIDE_RETURN_TYPE', |
4297 'INVALID_METHOD_OVERRIDE_RETURN_TYPE', | |
4298 "The return type '{0}' is not assignable to '{1}' as required by the m
ethod it is overriding from '{2}'"); | 4041 "The return type '{0}' is not assignable to '{1}' as required by the m
ethod it is overriding from '{2}'"); |
4299 | 4042 |
4300 /** | 4043 /** |
4301 * 7.1 Instance Methods: It is a static warning if an instance method | 4044 * 7.1 Instance Methods: It is a static warning if an instance method |
4302 * <i>m1</i> overrides an instance member <i>m2</i>, the signature of | 4045 * <i>m1</i> overrides an instance member <i>m2</i>, the signature of |
4303 * <i>m2</i> explicitly specifies a default value for a formal parameter | 4046 * <i>m2</i> explicitly specifies a default value for a formal parameter |
4304 * <i>p</i> and the signature of <i>m1</i> specifies a different default value | 4047 * <i>p</i> and the signature of <i>m1</i> specifies a different default value |
4305 * for <i>p</i>. | 4048 * for <i>p</i>. |
4306 */ | 4049 */ |
4307 static const StaticWarningCode INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_NAMED | 4050 static const StaticWarningCode INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_NAMED
= |
4308 = | 4051 const StaticWarningCode('INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_NAMED', |
4309 const StaticWarningCode( | |
4310 'INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_NAMED', | |
4311 "Parameters cannot override default values, this method overrides '{0}
.{1}' where '{2}' has a different value"); | 4052 "Parameters cannot override default values, this method overrides '{0}
.{1}' where '{2}' has a different value"); |
4312 | 4053 |
4313 /** | 4054 /** |
4314 * 7.1 Instance Methods: It is a static warning if an instance method | 4055 * 7.1 Instance Methods: It is a static warning if an instance method |
4315 * <i>m1</i> overrides an instance member <i>m2</i>, the signature of | 4056 * <i>m1</i> overrides an instance member <i>m2</i>, the signature of |
4316 * <i>m2</i> explicitly specifies a default value for a formal parameter | 4057 * <i>m2</i> explicitly specifies a default value for a formal parameter |
4317 * <i>p</i> and the signature of <i>m1</i> specifies a different default value | 4058 * <i>p</i> and the signature of <i>m1</i> specifies a different default value |
4318 * for <i>p</i>. | 4059 * for <i>p</i>. |
4319 */ | 4060 */ |
4320 static const StaticWarningCode | 4061 static const StaticWarningCode INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_POSIT
IONAL = |
4321 INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_POSITIONAL = | |
4322 const StaticWarningCode( | 4062 const StaticWarningCode( |
4323 'INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_POSITIONAL', | 4063 'INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_POSITIONAL', |
4324 "Parameters cannot override default values, this method overrides '{0}
.{1}' where this positional parameter has a different value"); | 4064 "Parameters cannot override default values, this method overrides '{0}
.{1}' where this positional parameter has a different value"); |
4325 | 4065 |
4326 /** | 4066 /** |
4327 * 7.1 Instance Methods: It is a static warning if an instance method | 4067 * 7.1 Instance Methods: It is a static warning if an instance method |
4328 * <i>m1</i> overrides an instance member <i>m2</i> and <i>m1</i> does not | 4068 * <i>m1</i> overrides an instance member <i>m2</i> and <i>m1</i> does not |
4329 * declare all the named parameters declared by <i>m2</i>. | 4069 * declare all the named parameters declared by <i>m2</i>. |
4330 * | 4070 * |
4331 * @param paramCount the number of named parameters in the overridden member | 4071 * @param paramCount the number of named parameters in the overridden member |
4332 * @param className the name of the class from the overridden method | 4072 * @param className the name of the class from the overridden method |
4333 */ | 4073 */ |
4334 static const StaticWarningCode INVALID_OVERRIDE_NAMED = | 4074 static const StaticWarningCode INVALID_OVERRIDE_NAMED = const StaticWarningCod
e( |
4335 const StaticWarningCode( | 4075 'INVALID_OVERRIDE_NAMED', |
4336 'INVALID_OVERRIDE_NAMED', | 4076 "Missing the named parameter '{0}' to match the overridden method from '{1
}'"); |
4337 "Missing the named parameter '{0}' to match the overridden method from
'{1}'"); | |
4338 | 4077 |
4339 /** | 4078 /** |
4340 * 7.1 Instance Methods: It is a static warning if an instance method | 4079 * 7.1 Instance Methods: It is a static warning if an instance method |
4341 * <i>m1</i> overrides an instance member <i>m2</i> and <i>m1</i> has fewer | 4080 * <i>m1</i> overrides an instance member <i>m2</i> and <i>m1</i> has fewer |
4342 * positional parameters than <i>m2</i>. | 4081 * positional parameters than <i>m2</i>. |
4343 * | 4082 * |
4344 * @param paramCount the number of positional parameters in the overridden | 4083 * @param paramCount the number of positional parameters in the overridden |
4345 * member | 4084 * member |
4346 * @param className the name of the class from the overridden method | 4085 * @param className the name of the class from the overridden method |
4347 */ | 4086 */ |
4348 static const StaticWarningCode INVALID_OVERRIDE_POSITIONAL = | 4087 static const StaticWarningCode INVALID_OVERRIDE_POSITIONAL = |
4349 const StaticWarningCode( | 4088 const StaticWarningCode('INVALID_OVERRIDE_POSITIONAL', |
4350 'INVALID_OVERRIDE_POSITIONAL', | |
4351 "Must have at least {0} parameters to match the overridden method from
'{1}'"); | 4089 "Must have at least {0} parameters to match the overridden method from
'{1}'"); |
4352 | 4090 |
4353 /** | 4091 /** |
4354 * 7.1 Instance Methods: It is a static warning if an instance method | 4092 * 7.1 Instance Methods: It is a static warning if an instance method |
4355 * <i>m1</i> overrides an instance member <i>m2</i> and <i>m1</i> has a | 4093 * <i>m1</i> overrides an instance member <i>m2</i> and <i>m1</i> has a |
4356 * greater number of required parameters than <i>m2</i>. | 4094 * greater number of required parameters than <i>m2</i>. |
4357 * | 4095 * |
4358 * @param paramCount the number of required parameters in the overridden | 4096 * @param paramCount the number of required parameters in the overridden |
4359 * member | 4097 * member |
4360 * @param className the name of the class from the overridden method | 4098 * @param className the name of the class from the overridden method |
4361 */ | 4099 */ |
4362 static const StaticWarningCode INVALID_OVERRIDE_REQUIRED = | 4100 static const StaticWarningCode INVALID_OVERRIDE_REQUIRED = |
4363 const StaticWarningCode( | 4101 const StaticWarningCode('INVALID_OVERRIDE_REQUIRED', |
4364 'INVALID_OVERRIDE_REQUIRED', | |
4365 "Must have {0} required parameters or less to match the overridden met
hod from '{1}'"); | 4102 "Must have {0} required parameters or less to match the overridden met
hod from '{1}'"); |
4366 | 4103 |
4367 /** | 4104 /** |
4368 * 7.3 Setters: It is a static warning if a setter <i>m1</i> overrides a | 4105 * 7.3 Setters: It is a static warning if a setter <i>m1</i> overrides a |
4369 * setter <i>m2</i> and the type of <i>m1</i> is not a subtype of the type of | 4106 * setter <i>m2</i> and the type of <i>m1</i> is not a subtype of the type of |
4370 * <i>m2</i>. | 4107 * <i>m2</i>. |
4371 * | 4108 * |
4372 * @param actualParamTypeName the name of the expected parameter type | 4109 * @param actualParamTypeName the name of the expected parameter type |
4373 * @param expectedParamType the name of the actual parameter type, not | 4110 * @param expectedParamType the name of the actual parameter type, not |
4374 * assignable to the actualParamTypeName | 4111 * assignable to the actualParamTypeName |
4375 * @param className the name of the class where the overridden setter is | 4112 * @param className the name of the class where the overridden setter is |
4376 * declared | 4113 * declared |
4377 * See [INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE]. | 4114 * See [INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE]. |
4378 */ | 4115 */ |
4379 static const StaticWarningCode INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE = | 4116 static const StaticWarningCode INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE = |
4380 const StaticWarningCode( | 4117 const StaticWarningCode('INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE', |
4381 'INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE', | |
4382 "The parameter type '{0}' is not assignable to '{1}' as required by th
e setter it is overriding from '{2}'"); | 4118 "The parameter type '{0}' is not assignable to '{1}' as required by th
e setter it is overriding from '{2}'"); |
4383 | 4119 |
4384 /** | 4120 /** |
4385 * 12.6 Lists: A run-time list literal <<i>E</i>> [<i>e<sub>1</sub></i> | 4121 * 12.6 Lists: A run-time list literal <<i>E</i>> [<i>e<sub>1</sub></i> |
4386 * … <i>e<sub>n</sub></i>] is evaluated as follows: | 4122 * … <i>e<sub>n</sub></i>] is evaluated as follows: |
4387 * * The operator []= is invoked on <i>a</i> with first argument <i>i</i> and | 4123 * * The operator []= is invoked on <i>a</i> with first argument <i>i</i> and |
4388 * second argument <i>o<sub>i+1</sub></i><i>, 1 <= i <= n</i> | 4124 * second argument <i>o<sub>i+1</sub></i><i>, 1 <= i <= n</i> |
4389 * | 4125 * |
4390 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static | 4126 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static |
4391 * type of <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of | 4127 * type of <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of |
4392 * <i>p<sub>i</sub>, 1 <= i <= n+k</i> and let <i>S<sub>q</sub></i> be | 4128 * <i>p<sub>i</sub>, 1 <= i <= n+k</i> and let <i>S<sub>q</sub></i> be |
4393 * the type of the named parameter <i>q</i> of <i>f</i>. It is a static | 4129 * the type of the named parameter <i>q</i> of <i>f</i>. It is a static |
4394 * warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<sub>j</sub>, 1 | 4130 * warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<sub>j</sub>, 1 |
4395 * <= j <= m</i>. | 4131 * <= j <= m</i>. |
4396 */ | 4132 */ |
4397 static const StaticWarningCode LIST_ELEMENT_TYPE_NOT_ASSIGNABLE = | 4133 static const StaticWarningCode LIST_ELEMENT_TYPE_NOT_ASSIGNABLE = |
4398 const StaticWarningCode( | 4134 const StaticWarningCode('LIST_ELEMENT_TYPE_NOT_ASSIGNABLE', |
4399 'LIST_ELEMENT_TYPE_NOT_ASSIGNABLE', | |
4400 "The element type '{0}' cannot be assigned to the list type '{1}'"); | 4135 "The element type '{0}' cannot be assigned to the list type '{1}'"); |
4401 | 4136 |
4402 /** | 4137 /** |
4403 * 12.7 Map: A run-time map literal <<i>K</i>, <i>V</i>> | 4138 * 12.7 Map: A run-time map literal <<i>K</i>, <i>V</i>> |
4404 * [<i>k<sub>1</sub></i> : <i>e<sub>1</sub></i> … <i>k<sub>n</sub></i> | 4139 * [<i>k<sub>1</sub></i> : <i>e<sub>1</sub></i> … <i>k<sub>n</sub></i> |
4405 * : <i>e<sub>n</sub></i>] is evaluated as follows: | 4140 * : <i>e<sub>n</sub></i>] is evaluated as follows: |
4406 * * The operator []= is invoked on <i>m</i> with first argument | 4141 * * The operator []= is invoked on <i>m</i> with first argument |
4407 * <i>k<sub>i</sub></i> and second argument <i>e<sub>i</sub></i><i>, 1 <= | 4142 * <i>k<sub>i</sub></i> and second argument <i>e<sub>i</sub></i><i>, 1 <= |
4408 * i <= n</i> | 4143 * i <= n</i> |
4409 * | 4144 * |
4410 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static | 4145 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static |
4411 * type of <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of | 4146 * type of <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of |
4412 * <i>p<sub>i</sub>, 1 <= i <= n+k</i> and let <i>S<sub>q</sub></i> be | 4147 * <i>p<sub>i</sub>, 1 <= i <= n+k</i> and let <i>S<sub>q</sub></i> be |
4413 * the type of the named parameter <i>q</i> of <i>f</i>. It is a static | 4148 * the type of the named parameter <i>q</i> of <i>f</i>. It is a static |
4414 * warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<sub>j</sub>, 1 | 4149 * warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<sub>j</sub>, 1 |
4415 * <= j <= m</i>. | 4150 * <= j <= m</i>. |
4416 */ | 4151 */ |
4417 static const StaticWarningCode MAP_KEY_TYPE_NOT_ASSIGNABLE = | 4152 static const StaticWarningCode MAP_KEY_TYPE_NOT_ASSIGNABLE = |
4418 const StaticWarningCode( | 4153 const StaticWarningCode('MAP_KEY_TYPE_NOT_ASSIGNABLE', |
4419 'MAP_KEY_TYPE_NOT_ASSIGNABLE', | |
4420 "The element type '{0}' cannot be assigned to the map key type '{1}'")
; | 4154 "The element type '{0}' cannot be assigned to the map key type '{1}'")
; |
4421 | 4155 |
4422 /** | 4156 /** |
4423 * 12.7 Map: A run-time map literal <<i>K</i>, <i>V</i>> | 4157 * 12.7 Map: A run-time map literal <<i>K</i>, <i>V</i>> |
4424 * [<i>k<sub>1</sub></i> : <i>e<sub>1</sub></i> … <i>k<sub>n</sub></i> | 4158 * [<i>k<sub>1</sub></i> : <i>e<sub>1</sub></i> … <i>k<sub>n</sub></i> |
4425 * : <i>e<sub>n</sub></i>] is evaluated as follows: | 4159 * : <i>e<sub>n</sub></i>] is evaluated as follows: |
4426 * * The operator []= is invoked on <i>m</i> with first argument | 4160 * * The operator []= is invoked on <i>m</i> with first argument |
4427 * <i>k<sub>i</sub></i> and second argument <i>e<sub>i</sub></i><i>, 1 <= | 4161 * <i>k<sub>i</sub></i> and second argument <i>e<sub>i</sub></i><i>, 1 <= |
4428 * i <= n</i> | 4162 * i <= n</i> |
4429 * | 4163 * |
4430 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static | 4164 * 12.14.2 Binding Actuals to Formals: Let <i>T<sub>i</sub></i> be the static |
4431 * type of <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of | 4165 * type of <i>a<sub>i</sub></i>, let <i>S<sub>i</sub></i> be the type of |
4432 * <i>p<sub>i</sub>, 1 <= i <= n+k</i> and let <i>S<sub>q</sub></i> be | 4166 * <i>p<sub>i</sub>, 1 <= i <= n+k</i> and let <i>S<sub>q</sub></i> be |
4433 * the type of the named parameter <i>q</i> of <i>f</i>. It is a static | 4167 * the type of the named parameter <i>q</i> of <i>f</i>. It is a static |
4434 * warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<sub>j</sub>, 1 | 4168 * warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<sub>j</sub>, 1 |
4435 * <= j <= m</i>. | 4169 * <= j <= m</i>. |
4436 */ | 4170 */ |
4437 static const StaticWarningCode MAP_VALUE_TYPE_NOT_ASSIGNABLE = | 4171 static const StaticWarningCode MAP_VALUE_TYPE_NOT_ASSIGNABLE = |
4438 const StaticWarningCode( | 4172 const StaticWarningCode('MAP_VALUE_TYPE_NOT_ASSIGNABLE', |
4439 'MAP_VALUE_TYPE_NOT_ASSIGNABLE', | |
4440 "The element type '{0}' cannot be assigned to the map value type '{1}'
"); | 4173 "The element type '{0}' cannot be assigned to the map value type '{1}'
"); |
4441 | 4174 |
4442 /** | 4175 /** |
4443 * 7.3 Setters: It is a static warning if a class has a setter named <i>v=</i> | 4176 * 7.3 Setters: It is a static warning if a class has a setter named <i>v=</i> |
4444 * with argument type <i>T</i> and a getter named <i>v</i> with return type | 4177 * with argument type <i>T</i> and a getter named <i>v</i> with return type |
4445 * <i>S</i>, and <i>T</i> may not be assigned to <i>S</i>. | 4178 * <i>S</i>, and <i>T</i> may not be assigned to <i>S</i>. |
4446 */ | 4179 */ |
4447 static const StaticWarningCode MISMATCHED_GETTER_AND_SETTER_TYPES = | 4180 static const StaticWarningCode MISMATCHED_GETTER_AND_SETTER_TYPES = |
4448 const StaticWarningCode( | 4181 const StaticWarningCode('MISMATCHED_GETTER_AND_SETTER_TYPES', |
4449 'MISMATCHED_GETTER_AND_SETTER_TYPES', | |
4450 "The parameter type for setter '{0}' is '{1}' which is not assignable
to its getter (of type '{2}')"); | 4182 "The parameter type for setter '{0}' is '{1}' which is not assignable
to its getter (of type '{2}')"); |
4451 | 4183 |
4452 /** | 4184 /** |
4453 * 7.3 Setters: It is a static warning if a class has a setter named <i>v=</i> | 4185 * 7.3 Setters: It is a static warning if a class has a setter named <i>v=</i> |
4454 * with argument type <i>T</i> and a getter named <i>v</i> with return type | 4186 * with argument type <i>T</i> and a getter named <i>v</i> with return type |
4455 * <i>S</i>, and <i>T</i> may not be assigned to <i>S</i>. | 4187 * <i>S</i>, and <i>T</i> may not be assigned to <i>S</i>. |
4456 */ | 4188 */ |
4457 static const StaticWarningCode | 4189 static const StaticWarningCode MISMATCHED_GETTER_AND_SETTER_TYPES_FROM_SUPERTY
PE = |
4458 MISMATCHED_GETTER_AND_SETTER_TYPES_FROM_SUPERTYPE = | |
4459 const StaticWarningCode( | 4190 const StaticWarningCode( |
4460 'MISMATCHED_GETTER_AND_SETTER_TYPES_FROM_SUPERTYPE', | 4191 'MISMATCHED_GETTER_AND_SETTER_TYPES_FROM_SUPERTYPE', |
4461 "The parameter type for setter '{0}' is '{1}' which is not assignable
to its getter (of type '{2}'), from superclass '{3}'"); | 4192 "The parameter type for setter '{0}' is '{1}' which is not assignable
to its getter (of type '{2}'), from superclass '{3}'"); |
4462 | 4193 |
4463 /** | 4194 /** |
4464 * 13.12 Return: It is a static warning if a function contains both one or | 4195 * 13.12 Return: It is a static warning if a function contains both one or |
4465 * more return statements of the form <i>return;</i> and one or more return | 4196 * more return statements of the form <i>return;</i> and one or more return |
4466 * statements of the form <i>return e;</i>. | 4197 * statements of the form <i>return e;</i>. |
4467 */ | 4198 */ |
4468 static const StaticWarningCode MIXED_RETURN_TYPES = const StaticWarningCode( | 4199 static const StaticWarningCode MIXED_RETURN_TYPES = const StaticWarningCode( |
4469 'MIXED_RETURN_TYPES', | 4200 'MIXED_RETURN_TYPES', |
4470 "Methods and functions cannot use return both with and without values"); | 4201 "Methods and functions cannot use return both with and without values"); |
4471 | 4202 |
4472 /** | 4203 /** |
4473 * 12.11.1 New: It is a static warning if <i>q</i> is a constructor of an | 4204 * 12.11.1 New: It is a static warning if <i>q</i> is a constructor of an |
4474 * abstract class and <i>q</i> is not a factory constructor. | 4205 * abstract class and <i>q</i> is not a factory constructor. |
4475 */ | 4206 */ |
4476 static const StaticWarningCode NEW_WITH_ABSTRACT_CLASS = | 4207 static const StaticWarningCode NEW_WITH_ABSTRACT_CLASS = |
4477 const StaticWarningCode( | 4208 const StaticWarningCode('NEW_WITH_ABSTRACT_CLASS', |
4478 'NEW_WITH_ABSTRACT_CLASS', | |
4479 "Abstract classes cannot be created with a 'new' expression"); | 4209 "Abstract classes cannot be created with a 'new' expression"); |
4480 | 4210 |
4481 /** | 4211 /** |
4482 * 15.8 Parameterized Types: Any use of a malbounded type gives rise to a | 4212 * 15.8 Parameterized Types: Any use of a malbounded type gives rise to a |
4483 * static warning. | 4213 * static warning. |
4484 * | 4214 * |
4485 * @param typeName the name of the type being referenced (<i>S</i>) | 4215 * @param typeName the name of the type being referenced (<i>S</i>) |
4486 * @param parameterCount the number of type parameters that were declared | 4216 * @param parameterCount the number of type parameters that were declared |
4487 * @param argumentCount the number of type arguments provided | 4217 * @param argumentCount the number of type arguments provided |
4488 * See [CompileTimeErrorCode.CONST_WITH_INVALID_TYPE_PARAMETERS], and | 4218 * See [CompileTimeErrorCode.CONST_WITH_INVALID_TYPE_PARAMETERS], and |
4489 * [StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]. | 4219 * [StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]. |
4490 */ | 4220 */ |
4491 static const StaticWarningCode NEW_WITH_INVALID_TYPE_PARAMETERS = | 4221 static const StaticWarningCode NEW_WITH_INVALID_TYPE_PARAMETERS = |
4492 const StaticWarningCode( | 4222 const StaticWarningCode('NEW_WITH_INVALID_TYPE_PARAMETERS', |
4493 'NEW_WITH_INVALID_TYPE_PARAMETERS', | |
4494 "The type '{0}' is declared with {1} type parameters, but {2} type arg
uments were given"); | 4223 "The type '{0}' is declared with {1} type parameters, but {2} type arg
uments were given"); |
4495 | 4224 |
4496 /** | 4225 /** |
4497 * 12.11.1 New: It is a static warning if <i>T</i> is not a class accessible | 4226 * 12.11.1 New: It is a static warning if <i>T</i> is not a class accessible |
4498 * in the current scope, optionally followed by type arguments. | 4227 * in the current scope, optionally followed by type arguments. |
4499 * | 4228 * |
4500 * @param name the name of the non-type element | 4229 * @param name the name of the non-type element |
4501 */ | 4230 */ |
4502 static const StaticWarningCode NEW_WITH_NON_TYPE = | 4231 static const StaticWarningCode NEW_WITH_NON_TYPE = const StaticWarningCode( |
4503 const StaticWarningCode('NEW_WITH_NON_TYPE', "The name '{0}' is not a clas
s"); | 4232 'NEW_WITH_NON_TYPE', "The name '{0}' is not a class"); |
4504 | 4233 |
4505 /** | 4234 /** |
4506 * 12.11.1 New: If <i>T</i> is a class or parameterized type accessible in the | 4235 * 12.11.1 New: If <i>T</i> is a class or parameterized type accessible in the |
4507 * current scope then: | 4236 * current scope then: |
4508 * 1. If <i>e</i> is of the form <i>new T.id(a<sub>1</sub>, …, | 4237 * 1. If <i>e</i> is of the form <i>new T.id(a<sub>1</sub>, …, |
4509 * a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n+1</sub>, …, | 4238 * a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n+1</sub>, …, |
4510 * x<sub>n+k</sub>: a<sub>n+k</sub>)</i> it is a static warning if | 4239 * x<sub>n+k</sub>: a<sub>n+k</sub>)</i> it is a static warning if |
4511 * <i>T.id</i> is not the name of a constructor declared by the type | 4240 * <i>T.id</i> is not the name of a constructor declared by the type |
4512 * <i>T</i>. | 4241 * <i>T</i>. |
4513 * If <i>e</i> of the form <i>new T(a<sub>1</sub>, …, a<sub>n</sub>, | 4242 * If <i>e</i> of the form <i>new T(a<sub>1</sub>, …, a<sub>n</sub>, |
4514 * x<sub>n+1</sub>: a<sub>n+1</sub>, …, x<sub>n+k</sub>: | 4243 * x<sub>n+1</sub>: a<sub>n+1</sub>, …, x<sub>n+k</sub>: |
4515 * a<sub>n+kM/sub>)</i> it is a static warning if the type <i>T</i> does not | 4244 * a<sub>n+kM/sub>)</i> it is a static warning if the type <i>T</i> does not |
4516 * declare a constructor with the same name as the declaration of <i>T</i>. | 4245 * declare a constructor with the same name as the declaration of <i>T</i>. |
4517 */ | 4246 */ |
4518 static const StaticWarningCode NEW_WITH_UNDEFINED_CONSTRUCTOR = | 4247 static const StaticWarningCode NEW_WITH_UNDEFINED_CONSTRUCTOR = |
4519 const StaticWarningCode( | 4248 const StaticWarningCode('NEW_WITH_UNDEFINED_CONSTRUCTOR', |
4520 'NEW_WITH_UNDEFINED_CONSTRUCTOR', | |
4521 "The class '{0}' does not have a constructor '{1}'"); | 4249 "The class '{0}' does not have a constructor '{1}'"); |
4522 | 4250 |
4523 /** | 4251 /** |
4524 * 12.11.1 New: If <i>T</i> is a class or parameterized type accessible in the | 4252 * 12.11.1 New: If <i>T</i> is a class or parameterized type accessible in the |
4525 * current scope then: | 4253 * current scope then: |
4526 * 1. If <i>e</i> is of the form <i>new T.id(a<sub>1</sub>, …, | 4254 * 1. If <i>e</i> is of the form <i>new T.id(a<sub>1</sub>, …, |
4527 * a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n+1</sub>, …, x<sub>n+k</sub>: | 4255 * a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n+1</sub>, …, x<sub>n+k</sub>: |
4528 * a<sub>n+k</sub>)</i> it is a static warning if <i>T.id</i> is not the name | 4256 * a<sub>n+k</sub>)</i> it is a static warning if <i>T.id</i> is not the name |
4529 * of a constructor declared by the type <i>T</i>. If <i>e</i> of the form | 4257 * of a constructor declared by the type <i>T</i>. If <i>e</i> of the form |
4530 * <i>new T(a<sub>1</sub>, …, a<sub>n</sub>, x<sub>n+1</sub>: | 4258 * <i>new T(a<sub>1</sub>, …, a<sub>n</sub>, x<sub>n+1</sub>: |
4531 * a<sub>n+1</sub>, …, x<sub>n+k</sub>: a<sub>n+kM/sub>)</i> it is a | 4259 * a<sub>n+1</sub>, …, x<sub>n+k</sub>: a<sub>n+kM/sub>)</i> it is a |
4532 * static warning if the type <i>T</i> does not declare a constructor with the | 4260 * static warning if the type <i>T</i> does not declare a constructor with the |
4533 * same name as the declaration of <i>T</i>. | 4261 * same name as the declaration of <i>T</i>. |
4534 */ | 4262 */ |
4535 static const StaticWarningCode NEW_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT = | 4263 static const StaticWarningCode NEW_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT = |
4536 const StaticWarningCode( | 4264 const StaticWarningCode('NEW_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT', |
4537 'NEW_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT', | |
4538 "The class '{0}' does not have a default constructor"); | 4265 "The class '{0}' does not have a default constructor"); |
4539 | 4266 |
4540 /** | 4267 /** |
4541 * 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract | 4268 * 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract |
4542 * class inherits an abstract method. | 4269 * class inherits an abstract method. |
4543 * | 4270 * |
4544 * 7.10 Superinterfaces: Let <i>C</i> be a concrete class that does not | 4271 * 7.10 Superinterfaces: Let <i>C</i> be a concrete class that does not |
4545 * declare its own <i>noSuchMethod()</i> method. It is a static warning if the | 4272 * declare its own <i>noSuchMethod()</i> method. It is a static warning if the |
4546 * implicit interface of <i>C</i> includes an instance member <i>m</i> of type | 4273 * implicit interface of <i>C</i> includes an instance member <i>m</i> of type |
4547 * <i>F</i> and <i>C</i> does not declare or inherit a corresponding instance | 4274 * <i>F</i> and <i>C</i> does not declare or inherit a corresponding instance |
4548 * member <i>m</i> of type <i>F'</i> such that <i>F' <: F</i>. | 4275 * member <i>m</i> of type <i>F'</i> such that <i>F' <: F</i>. |
4549 * | 4276 * |
4550 * 7.4 Abstract Instance Members: It is a static warning if an abstract member | 4277 * 7.4 Abstract Instance Members: It is a static warning if an abstract member |
4551 * is declared or inherited in a concrete class unless that member overrides a | 4278 * is declared or inherited in a concrete class unless that member overrides a |
4552 * concrete one. | 4279 * concrete one. |
4553 * | 4280 * |
4554 * @param memberName the name of the first member | 4281 * @param memberName the name of the first member |
4555 * @param memberName the name of the second member | 4282 * @param memberName the name of the second member |
4556 * @param memberName the name of the third member | 4283 * @param memberName the name of the third member |
4557 * @param memberName the name of the fourth member | 4284 * @param memberName the name of the fourth member |
4558 * @param additionalCount the number of additional missing members that aren't | 4285 * @param additionalCount the number of additional missing members that aren't |
4559 * listed | 4286 * listed |
4560 */ | 4287 */ |
4561 static const StaticWarningCode | 4288 static const StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FIV
E_PLUS = |
4562 NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FIVE_PLUS = | |
4563 const StaticWarningCode( | 4289 const StaticWarningCode( |
4564 'NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FIVE_PLUS', | 4290 'NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FIVE_PLUS', |
4565 "Missing concrete implementation of {0}, {1}, {2}, {3} and {4} more"); | 4291 "Missing concrete implementation of {0}, {1}, {2}, {3} and {4} more"); |
4566 | 4292 |
4567 /** | 4293 /** |
4568 * 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract | 4294 * 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract |
4569 * class inherits an abstract method. | 4295 * class inherits an abstract method. |
4570 * | 4296 * |
4571 * 7.10 Superinterfaces: Let <i>C</i> be a concrete class that does not | 4297 * 7.10 Superinterfaces: Let <i>C</i> be a concrete class that does not |
4572 * declare its own <i>noSuchMethod()</i> method. It is a static warning if the | 4298 * declare its own <i>noSuchMethod()</i> method. It is a static warning if the |
4573 * implicit interface of <i>C</i> includes an instance member <i>m</i> of type | 4299 * implicit interface of <i>C</i> includes an instance member <i>m</i> of type |
4574 * <i>F</i> and <i>C</i> does not declare or inherit a corresponding instance | 4300 * <i>F</i> and <i>C</i> does not declare or inherit a corresponding instance |
4575 * member <i>m</i> of type <i>F'</i> such that <i>F' <: F</i>. | 4301 * member <i>m</i> of type <i>F'</i> such that <i>F' <: F</i>. |
4576 * | 4302 * |
4577 * 7.4 Abstract Instance Members: It is a static warning if an abstract member | 4303 * 7.4 Abstract Instance Members: It is a static warning if an abstract member |
4578 * is declared or inherited in a concrete class unless that member overrides a | 4304 * is declared or inherited in a concrete class unless that member overrides a |
4579 * concrete one. | 4305 * concrete one. |
4580 * | 4306 * |
4581 * @param memberName the name of the first member | 4307 * @param memberName the name of the first member |
4582 * @param memberName the name of the second member | 4308 * @param memberName the name of the second member |
4583 * @param memberName the name of the third member | 4309 * @param memberName the name of the third member |
4584 * @param memberName the name of the fourth member | 4310 * @param memberName the name of the fourth member |
4585 */ | 4311 */ |
4586 static const StaticWarningCode | 4312 static const StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FOU
R = |
4587 NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FOUR = | |
4588 const StaticWarningCode( | 4313 const StaticWarningCode( |
4589 'NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FOUR', | 4314 'NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FOUR', |
4590 "Missing concrete implementation of {0}, {1}, {2} and {3}"); | 4315 "Missing concrete implementation of {0}, {1}, {2} and {3}"); |
4591 | 4316 |
4592 /** | 4317 /** |
4593 * 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract | 4318 * 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract |
4594 * class inherits an abstract method. | 4319 * class inherits an abstract method. |
4595 * | 4320 * |
4596 * 7.10 Superinterfaces: Let <i>C</i> be a concrete class that does not | 4321 * 7.10 Superinterfaces: Let <i>C</i> be a concrete class that does not |
4597 * declare its own <i>noSuchMethod()</i> method. It is a static warning if the | 4322 * declare its own <i>noSuchMethod()</i> method. It is a static warning if the |
4598 * implicit interface of <i>C</i> includes an instance member <i>m</i> of type | 4323 * implicit interface of <i>C</i> includes an instance member <i>m</i> of type |
4599 * <i>F</i> and <i>C</i> does not declare or inherit a corresponding instance | 4324 * <i>F</i> and <i>C</i> does not declare or inherit a corresponding instance |
4600 * member <i>m</i> of type <i>F'</i> such that <i>F' <: F</i>. | 4325 * member <i>m</i> of type <i>F'</i> such that <i>F' <: F</i>. |
4601 * | 4326 * |
4602 * 7.4 Abstract Instance Members: It is a static warning if an abstract member | 4327 * 7.4 Abstract Instance Members: It is a static warning if an abstract member |
4603 * is declared or inherited in a concrete class unless that member overrides a | 4328 * is declared or inherited in a concrete class unless that member overrides a |
4604 * concrete one. | 4329 * concrete one. |
4605 * | 4330 * |
4606 * @param memberName the name of the member | 4331 * @param memberName the name of the member |
4607 */ | 4332 */ |
4608 static const StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE | 4333 static const StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE
= |
4609 = | 4334 const StaticWarningCode('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE', |
4610 const StaticWarningCode( | |
4611 'NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE', | |
4612 "Missing concrete implementation of {0}"); | 4335 "Missing concrete implementation of {0}"); |
4613 | 4336 |
4614 /** | 4337 /** |
4615 * 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract | 4338 * 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract |
4616 * class inherits an abstract method. | 4339 * class inherits an abstract method. |
4617 * | 4340 * |
4618 * 7.10 Superinterfaces: Let <i>C</i> be a concrete class that does not | 4341 * 7.10 Superinterfaces: Let <i>C</i> be a concrete class that does not |
4619 * declare its own <i>noSuchMethod()</i> method. It is a static warning if the | 4342 * declare its own <i>noSuchMethod()</i> method. It is a static warning if the |
4620 * implicit interface of <i>C</i> includes an instance member <i>m</i> of type | 4343 * implicit interface of <i>C</i> includes an instance member <i>m</i> of type |
4621 * <i>F</i> and <i>C</i> does not declare or inherit a corresponding instance | 4344 * <i>F</i> and <i>C</i> does not declare or inherit a corresponding instance |
4622 * member <i>m</i> of type <i>F'</i> such that <i>F' <: F</i>. | 4345 * member <i>m</i> of type <i>F'</i> such that <i>F' <: F</i>. |
4623 * | 4346 * |
4624 * 7.4 Abstract Instance Members: It is a static warning if an abstract member | 4347 * 7.4 Abstract Instance Members: It is a static warning if an abstract member |
4625 * is declared or inherited in a concrete class unless that member overrides a | 4348 * is declared or inherited in a concrete class unless that member overrides a |
4626 * concrete one. | 4349 * concrete one. |
4627 * | 4350 * |
4628 * @param memberName the name of the first member | 4351 * @param memberName the name of the first member |
4629 * @param memberName the name of the second member | 4352 * @param memberName the name of the second member |
4630 * @param memberName the name of the third member | 4353 * @param memberName the name of the third member |
4631 */ | 4354 */ |
4632 static const StaticWarningCode | 4355 static const StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_THR
EE = |
4633 NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_THREE = | |
4634 const StaticWarningCode( | 4356 const StaticWarningCode( |
4635 'NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_THREE', | 4357 'NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_THREE', |
4636 "Missing concrete implementation of {0}, {1} and {2}"); | 4358 "Missing concrete implementation of {0}, {1} and {2}"); |
4637 | 4359 |
4638 /** | 4360 /** |
4639 * 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract | 4361 * 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract |
4640 * class inherits an abstract method. | 4362 * class inherits an abstract method. |
4641 * | 4363 * |
4642 * 7.10 Superinterfaces: Let <i>C</i> be a concrete class that does not | 4364 * 7.10 Superinterfaces: Let <i>C</i> be a concrete class that does not |
4643 * declare its own <i>noSuchMethod()</i> method. It is a static warning if the | 4365 * declare its own <i>noSuchMethod()</i> method. It is a static warning if the |
4644 * implicit interface of <i>C</i> includes an instance member <i>m</i> of type | 4366 * implicit interface of <i>C</i> includes an instance member <i>m</i> of type |
4645 * <i>F</i> and <i>C</i> does not declare or inherit a corresponding instance | 4367 * <i>F</i> and <i>C</i> does not declare or inherit a corresponding instance |
4646 * member <i>m</i> of type <i>F'</i> such that <i>F' <: F</i>. | 4368 * member <i>m</i> of type <i>F'</i> such that <i>F' <: F</i>. |
4647 * | 4369 * |
4648 * 7.4 Abstract Instance Members: It is a static warning if an abstract member | 4370 * 7.4 Abstract Instance Members: It is a static warning if an abstract member |
4649 * is declared or inherited in a concrete class unless that member overrides a | 4371 * is declared or inherited in a concrete class unless that member overrides a |
4650 * concrete one. | 4372 * concrete one. |
4651 * | 4373 * |
4652 * @param memberName the name of the first member | 4374 * @param memberName the name of the first member |
4653 * @param memberName the name of the second member | 4375 * @param memberName the name of the second member |
4654 */ | 4376 */ |
4655 static const StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_TWO | 4377 static const StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_TWO
= |
4656 = | 4378 const StaticWarningCode('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_TWO', |
4657 const StaticWarningCode( | |
4658 'NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_TWO', | |
4659 "Missing concrete implementation of {0} and {1}"); | 4379 "Missing concrete implementation of {0} and {1}"); |
4660 | 4380 |
4661 /** | 4381 /** |
4662 * 13.11 Try: An on-catch clause of the form <i>on T catch (p<sub>1</sub>, | 4382 * 13.11 Try: An on-catch clause of the form <i>on T catch (p<sub>1</sub>, |
4663 * p<sub>2</sub>) s</i> or <i>on T s</i> matches an object <i>o</i> if the | 4383 * p<sub>2</sub>) s</i> or <i>on T s</i> matches an object <i>o</i> if the |
4664 * type of <i>o</i> is a subtype of <i>T</i>. It is a static warning if | 4384 * type of <i>o</i> is a subtype of <i>T</i>. It is a static warning if |
4665 * <i>T</i> does not denote a type available in the lexical scope of the | 4385 * <i>T</i> does not denote a type available in the lexical scope of the |
4666 * catch clause. | 4386 * catch clause. |
4667 * | 4387 * |
4668 * @param name the name of the non-type element | 4388 * @param name the name of the non-type element |
4669 */ | 4389 */ |
4670 static const StaticWarningCode NON_TYPE_IN_CATCH_CLAUSE = | 4390 static const StaticWarningCode NON_TYPE_IN_CATCH_CLAUSE = |
4671 const StaticWarningCode( | 4391 const StaticWarningCode('NON_TYPE_IN_CATCH_CLAUSE', |
4672 'NON_TYPE_IN_CATCH_CLAUSE', | |
4673 "The name '{0}' is not a type and cannot be used in an on-catch clause
"); | 4392 "The name '{0}' is not a type and cannot be used in an on-catch clause
"); |
4674 | 4393 |
4675 /** | 4394 /** |
4676 * 7.1.1 Operators: It is a static warning if the return type of the | 4395 * 7.1.1 Operators: It is a static warning if the return type of the |
4677 * user-declared operator []= is explicitly declared and not void. | 4396 * user-declared operator []= is explicitly declared and not void. |
4678 */ | 4397 */ |
4679 static const StaticWarningCode NON_VOID_RETURN_FOR_OPERATOR = | 4398 static const StaticWarningCode NON_VOID_RETURN_FOR_OPERATOR = |
4680 const StaticWarningCode( | 4399 const StaticWarningCode('NON_VOID_RETURN_FOR_OPERATOR', |
4681 'NON_VOID_RETURN_FOR_OPERATOR', | |
4682 "The return type of the operator []= must be 'void'"); | 4400 "The return type of the operator []= must be 'void'"); |
4683 | 4401 |
4684 /** | 4402 /** |
4685 * 7.3 Setters: It is a static warning if a setter declares a return type | 4403 * 7.3 Setters: It is a static warning if a setter declares a return type |
4686 * other than void. | 4404 * other than void. |
4687 */ | 4405 */ |
4688 static const StaticWarningCode NON_VOID_RETURN_FOR_SETTER = | 4406 static const StaticWarningCode NON_VOID_RETURN_FOR_SETTER = |
4689 const StaticWarningCode( | 4407 const StaticWarningCode('NON_VOID_RETURN_FOR_SETTER', |
4690 'NON_VOID_RETURN_FOR_SETTER', | |
4691 "The return type of the setter must be 'void'"); | 4408 "The return type of the setter must be 'void'"); |
4692 | 4409 |
4693 /** | 4410 /** |
4694 * 15.1 Static Types: A type <i>T</i> is malformed iff: | 4411 * 15.1 Static Types: A type <i>T</i> is malformed iff: |
4695 * * <i>T</i> has the form <i>id</i> or the form <i>prefix.id</i>, and in the | 4412 * * <i>T</i> has the form <i>id</i> or the form <i>prefix.id</i>, and in the |
4696 * enclosing lexical scope, the name <i>id</i> (respectively | 4413 * enclosing lexical scope, the name <i>id</i> (respectively |
4697 * <i>prefix.id</i>) does not denote a type. | 4414 * <i>prefix.id</i>) does not denote a type. |
4698 * * <i>T</i> denotes a type parameter in the enclosing lexical scope, but | 4415 * * <i>T</i> denotes a type parameter in the enclosing lexical scope, but |
4699 * occurs in the signature or body of a static member. | 4416 * occurs in the signature or body of a static member. |
4700 * * <i>T</i> is a parameterized type of the form <i>G<S<sub>1</sub>, .., | 4417 * * <i>T</i> is a parameterized type of the form <i>G<S<sub>1</sub>, .., |
4701 * S<sub>n</sub>></i>, | 4418 * S<sub>n</sub>></i>, |
4702 * | 4419 * |
4703 * Any use of a malformed type gives rise to a static warning. | 4420 * Any use of a malformed type gives rise to a static warning. |
4704 * | 4421 * |
4705 * @param nonTypeName the name that is not a type | 4422 * @param nonTypeName the name that is not a type |
4706 */ | 4423 */ |
4707 static const StaticWarningCode NOT_A_TYPE = | 4424 static const StaticWarningCode NOT_A_TYPE = |
4708 const StaticWarningCode('NOT_A_TYPE', "{0} is not a type"); | 4425 const StaticWarningCode('NOT_A_TYPE', "{0} is not a type"); |
4709 | 4426 |
4710 /** | 4427 /** |
4711 * 12.14.2 Binding Actuals to Formals: It is a static warning if <i>m < | 4428 * 12.14.2 Binding Actuals to Formals: It is a static warning if <i>m < |
4712 * h</i> or if <i>m > n</i>. | 4429 * h</i> or if <i>m > n</i>. |
4713 * | 4430 * |
4714 * @param requiredCount the expected number of required arguments | 4431 * @param requiredCount the expected number of required arguments |
4715 * @param argumentCount the actual number of positional arguments given | 4432 * @param argumentCount the actual number of positional arguments given |
4716 * See [EXTRA_POSITIONAL_ARGUMENTS]. | 4433 * See [EXTRA_POSITIONAL_ARGUMENTS]. |
4717 */ | 4434 */ |
4718 static const StaticWarningCode NOT_ENOUGH_REQUIRED_ARGUMENTS = | 4435 static const StaticWarningCode NOT_ENOUGH_REQUIRED_ARGUMENTS = |
4719 const StaticWarningCode( | 4436 const StaticWarningCode('NOT_ENOUGH_REQUIRED_ARGUMENTS', |
4720 'NOT_ENOUGH_REQUIRED_ARGUMENTS', | |
4721 "{0} required argument(s) expected, but {1} found"); | 4437 "{0} required argument(s) expected, but {1} found"); |
4722 | 4438 |
4723 /** | 4439 /** |
4724 * 14.3 Parts: It is a static warning if the referenced part declaration | 4440 * 14.3 Parts: It is a static warning if the referenced part declaration |
4725 * <i>p</i> names a library other than the current library as the library to | 4441 * <i>p</i> names a library other than the current library as the library to |
4726 * which <i>p</i> belongs. | 4442 * which <i>p</i> belongs. |
4727 * | 4443 * |
4728 * @param expectedLibraryName the name of expected library name | 4444 * @param expectedLibraryName the name of expected library name |
4729 * @param actualLibraryName the non-matching actual library name from the | 4445 * @param actualLibraryName the non-matching actual library name from the |
4730 * "part of" declaration | 4446 * "part of" declaration |
4731 */ | 4447 */ |
4732 static const StaticWarningCode PART_OF_DIFFERENT_LIBRARY = | 4448 static const StaticWarningCode PART_OF_DIFFERENT_LIBRARY = |
4733 const StaticWarningCode( | 4449 const StaticWarningCode('PART_OF_DIFFERENT_LIBRARY', |
4734 'PART_OF_DIFFERENT_LIBRARY', | |
4735 "Expected this library to be part of '{0}', not '{1}'"); | 4450 "Expected this library to be part of '{0}', not '{1}'"); |
4736 | 4451 |
4737 /** | 4452 /** |
4738 * 7.6.2 Factories: It is a static warning if the function type of <i>k'</i> | 4453 * 7.6.2 Factories: It is a static warning if the function type of <i>k'</i> |
4739 * is not a subtype of the type of <i>k</i>. | 4454 * is not a subtype of the type of <i>k</i>. |
4740 * | 4455 * |
4741 * @param redirectedName the name of the redirected constructor | 4456 * @param redirectedName the name of the redirected constructor |
4742 * @param redirectingName the name of the redirecting constructor | 4457 * @param redirectingName the name of the redirecting constructor |
4743 */ | 4458 */ |
4744 static const StaticWarningCode REDIRECT_TO_INVALID_FUNCTION_TYPE = | 4459 static const StaticWarningCode REDIRECT_TO_INVALID_FUNCTION_TYPE = |
4745 const StaticWarningCode( | 4460 const StaticWarningCode('REDIRECT_TO_INVALID_FUNCTION_TYPE', |
4746 'REDIRECT_TO_INVALID_FUNCTION_TYPE', | |
4747 "The redirected constructor '{0}' has incompatible parameters with '{1
}'"); | 4461 "The redirected constructor '{0}' has incompatible parameters with '{1
}'"); |
4748 | 4462 |
4749 /** | 4463 /** |
4750 * 7.6.2 Factories: It is a static warning if the function type of <i>k'</i> | 4464 * 7.6.2 Factories: It is a static warning if the function type of <i>k'</i> |
4751 * is not a subtype of the type of <i>k</i>. | 4465 * is not a subtype of the type of <i>k</i>. |
4752 * | 4466 * |
4753 * @param redirectedName the name of the redirected constructor return type | 4467 * @param redirectedName the name of the redirected constructor return type |
4754 * @param redirectingName the name of the redirecting constructor return type | 4468 * @param redirectingName the name of the redirecting constructor return type |
4755 */ | 4469 */ |
4756 static const StaticWarningCode REDIRECT_TO_INVALID_RETURN_TYPE = | 4470 static const StaticWarningCode REDIRECT_TO_INVALID_RETURN_TYPE = |
4757 const StaticWarningCode( | 4471 const StaticWarningCode('REDIRECT_TO_INVALID_RETURN_TYPE', |
4758 'REDIRECT_TO_INVALID_RETURN_TYPE', | |
4759 "The return type '{0}' of the redirected constructor is not assignable
to '{1}'"); | 4472 "The return type '{0}' of the redirected constructor is not assignable
to '{1}'"); |
4760 | 4473 |
4761 /** | 4474 /** |
4762 * 7.6.2 Factories: It is a static warning if type does not denote a class | 4475 * 7.6.2 Factories: It is a static warning if type does not denote a class |
4763 * accessible in the current scope; if type does denote such a class <i>C</i> | 4476 * accessible in the current scope; if type does denote such a class <i>C</i> |
4764 * it is a static warning if the referenced constructor (be it <i>type</i> or | 4477 * it is a static warning if the referenced constructor (be it <i>type</i> or |
4765 * <i>type.id</i>) is not a constructor of <i>C</i>. | 4478 * <i>type.id</i>) is not a constructor of <i>C</i>. |
4766 */ | 4479 */ |
4767 static const StaticWarningCode REDIRECT_TO_MISSING_CONSTRUCTOR = | 4480 static const StaticWarningCode REDIRECT_TO_MISSING_CONSTRUCTOR = |
4768 const StaticWarningCode( | 4481 const StaticWarningCode('REDIRECT_TO_MISSING_CONSTRUCTOR', |
4769 'REDIRECT_TO_MISSING_CONSTRUCTOR', | |
4770 "The constructor '{0}' could not be found in '{1}'"); | 4482 "The constructor '{0}' could not be found in '{1}'"); |
4771 | 4483 |
4772 /** | 4484 /** |
4773 * 7.6.2 Factories: It is a static warning if type does not denote a class | 4485 * 7.6.2 Factories: It is a static warning if type does not denote a class |
4774 * accessible in the current scope; if type does denote such a class <i>C</i> | 4486 * accessible in the current scope; if type does denote such a class <i>C</i> |
4775 * it is a static warning if the referenced constructor (be it <i>type</i> or | 4487 * it is a static warning if the referenced constructor (be it <i>type</i> or |
4776 * <i>type.id</i>) is not a constructor of <i>C</i>. | 4488 * <i>type.id</i>) is not a constructor of <i>C</i>. |
4777 */ | 4489 */ |
4778 static const StaticWarningCode REDIRECT_TO_NON_CLASS = | 4490 static const StaticWarningCode REDIRECT_TO_NON_CLASS = const StaticWarningCode
( |
4779 const StaticWarningCode( | 4491 'REDIRECT_TO_NON_CLASS', |
4780 'REDIRECT_TO_NON_CLASS', | 4492 "The name '{0}' is not a type and cannot be used in a redirected construct
or"); |
4781 "The name '{0}' is not a type and cannot be used in a redirected const
ructor"); | |
4782 | 4493 |
4783 /** | 4494 /** |
4784 * 13.12 Return: Let <i>f</i> be the function immediately enclosing a return | 4495 * 13.12 Return: Let <i>f</i> be the function immediately enclosing a return |
4785 * statement of the form <i>return;</i> It is a static warning if both of the | 4496 * statement of the form <i>return;</i> It is a static warning if both of the |
4786 * following conditions hold: | 4497 * following conditions hold: |
4787 * * <i>f</i> is not a generative constructor. | 4498 * * <i>f</i> is not a generative constructor. |
4788 * * The return type of <i>f</i> may not be assigned to void. | 4499 * * The return type of <i>f</i> may not be assigned to void. |
4789 */ | 4500 */ |
4790 static const StaticWarningCode RETURN_WITHOUT_VALUE = const StaticWarningCode( | 4501 static const StaticWarningCode RETURN_WITHOUT_VALUE = const StaticWarningCode( |
4791 'RETURN_WITHOUT_VALUE', | 4502 'RETURN_WITHOUT_VALUE', "Missing return value after 'return'"); |
4792 "Missing return value after 'return'"); | |
4793 | 4503 |
4794 /** | 4504 /** |
4795 * 12.16.3 Static Invocation: It is a static warning if <i>C</i> does not | 4505 * 12.16.3 Static Invocation: It is a static warning if <i>C</i> does not |
4796 * declare a static method or getter <i>m</i>. | 4506 * declare a static method or getter <i>m</i>. |
4797 * | 4507 * |
4798 * @param memberName the name of the instance member | 4508 * @param memberName the name of the instance member |
4799 */ | 4509 */ |
4800 static const StaticWarningCode STATIC_ACCESS_TO_INSTANCE_MEMBER = | 4510 static const StaticWarningCode STATIC_ACCESS_TO_INSTANCE_MEMBER = |
4801 const StaticWarningCode( | 4511 const StaticWarningCode('STATIC_ACCESS_TO_INSTANCE_MEMBER', |
4802 'STATIC_ACCESS_TO_INSTANCE_MEMBER', | |
4803 "Instance member '{0}' cannot be accessed using static access"); | 4512 "Instance member '{0}' cannot be accessed using static access"); |
4804 | 4513 |
4805 /** | 4514 /** |
4806 * 13.9 Switch: It is a static warning if the type of <i>e</i> may not be | 4515 * 13.9 Switch: It is a static warning if the type of <i>e</i> may not be |
4807 * assigned to the type of <i>e<sub>k</sub></i>. | 4516 * assigned to the type of <i>e<sub>k</sub></i>. |
4808 */ | 4517 */ |
4809 static const StaticWarningCode SWITCH_EXPRESSION_NOT_ASSIGNABLE = | 4518 static const StaticWarningCode SWITCH_EXPRESSION_NOT_ASSIGNABLE = |
4810 const StaticWarningCode( | 4519 const StaticWarningCode('SWITCH_EXPRESSION_NOT_ASSIGNABLE', |
4811 'SWITCH_EXPRESSION_NOT_ASSIGNABLE', | |
4812 "Type '{0}' of the switch expression is not assignable to the type '{1
}' of case expressions"); | 4520 "Type '{0}' of the switch expression is not assignable to the type '{1
}' of case expressions"); |
4813 | 4521 |
4814 /** | 4522 /** |
4815 * 15.1 Static Types: It is a static warning to use a deferred type in a type | 4523 * 15.1 Static Types: It is a static warning to use a deferred type in a type |
4816 * annotation. | 4524 * annotation. |
4817 * | 4525 * |
4818 * @param name the name of the type that is deferred and being used in a type | 4526 * @param name the name of the type that is deferred and being used in a type |
4819 * annotation | 4527 * annotation |
4820 */ | 4528 */ |
4821 static const StaticWarningCode TYPE_ANNOTATION_DEFERRED_CLASS = | 4529 static const StaticWarningCode TYPE_ANNOTATION_DEFERRED_CLASS = |
4822 const StaticWarningCode( | 4530 const StaticWarningCode('TYPE_ANNOTATION_DEFERRED_CLASS', |
4823 'TYPE_ANNOTATION_DEFERRED_CLASS', | |
4824 "The deferred type '{0}' cannot be used in a declaration, cast or type
test"); | 4531 "The deferred type '{0}' cannot be used in a declaration, cast or type
test"); |
4825 | 4532 |
4826 /** | 4533 /** |
4827 * 12.31 Type Test: It is a static warning if <i>T</i> does not denote a type | 4534 * 12.31 Type Test: It is a static warning if <i>T</i> does not denote a type |
4828 * available in the current lexical scope. | 4535 * available in the current lexical scope. |
4829 */ | 4536 */ |
4830 static const StaticWarningCode TYPE_TEST_WITH_NON_TYPE = | 4537 static const StaticWarningCode TYPE_TEST_WITH_NON_TYPE = const StaticWarningCo
de( |
4831 const StaticWarningCode( | 4538 'TYPE_TEST_WITH_NON_TYPE', |
4832 'TYPE_TEST_WITH_NON_TYPE', | 4539 "The name '{0}' is not a type and cannot be used in an 'is' expression"); |
4833 "The name '{0}' is not a type and cannot be used in an 'is' expression
"); | |
4834 | 4540 |
4835 /** | 4541 /** |
4836 * 12.31 Type Test: It is a static warning if <i>T</i> does not denote a type | 4542 * 12.31 Type Test: It is a static warning if <i>T</i> does not denote a type |
4837 * available in the current lexical scope. | 4543 * available in the current lexical scope. |
4838 */ | 4544 */ |
4839 static const StaticWarningCode TYPE_TEST_WITH_UNDEFINED_NAME = | 4545 static const StaticWarningCode TYPE_TEST_WITH_UNDEFINED_NAME = |
4840 const StaticWarningCode( | 4546 const StaticWarningCode('TYPE_TEST_WITH_UNDEFINED_NAME', |
4841 'TYPE_TEST_WITH_UNDEFINED_NAME', | |
4842 "The name '{0}' is not defined and cannot be used in an 'is' expressio
n"); | 4547 "The name '{0}' is not defined and cannot be used in an 'is' expressio
n"); |
4843 | 4548 |
4844 /** | 4549 /** |
4845 * 10 Generics: However, a type parameter is considered to be a malformed type | 4550 * 10 Generics: However, a type parameter is considered to be a malformed type |
4846 * when referenced by a static member. | 4551 * when referenced by a static member. |
4847 * | 4552 * |
4848 * 15.1 Static Types: Any use of a malformed type gives rise to a static | 4553 * 15.1 Static Types: Any use of a malformed type gives rise to a static |
4849 * warning. A malformed type is then interpreted as dynamic by the static type | 4554 * warning. A malformed type is then interpreted as dynamic by the static type |
4850 * checker and the runtime. | 4555 * checker and the runtime. |
4851 */ | 4556 */ |
4852 static const StaticWarningCode TYPE_PARAMETER_REFERENCED_BY_STATIC = | 4557 static const StaticWarningCode TYPE_PARAMETER_REFERENCED_BY_STATIC = |
4853 const StaticWarningCode( | 4558 const StaticWarningCode('TYPE_PARAMETER_REFERENCED_BY_STATIC', |
4854 'TYPE_PARAMETER_REFERENCED_BY_STATIC', | |
4855 "Static members cannot reference type parameters"); | 4559 "Static members cannot reference type parameters"); |
4856 | 4560 |
4857 /** | 4561 /** |
4858 * 12.16.3 Static Invocation: A static method invocation <i>i</i> has the form | 4562 * 12.16.3 Static Invocation: A static method invocation <i>i</i> has the form |
4859 * <i>C.m(a<sub>1</sub>, …, a<sub>n</sub>, x<sub>n+1</sub>: | 4563 * <i>C.m(a<sub>1</sub>, …, a<sub>n</sub>, x<sub>n+1</sub>: |
4860 * a<sub>n+1</sub>, … x<sub>n+k</sub>: a<sub>n+k</sub>)</i>. It is a | 4564 * a<sub>n+1</sub>, … x<sub>n+k</sub>: a<sub>n+k</sub>)</i>. It is a |
4861 * static warning if <i>C</i> does not denote a class in the current scope. | 4565 * static warning if <i>C</i> does not denote a class in the current scope. |
4862 * | 4566 * |
4863 * @param undefinedClassName the name of the undefined class | 4567 * @param undefinedClassName the name of the undefined class |
4864 */ | 4568 */ |
4865 static const StaticWarningCode UNDEFINED_CLASS = | 4569 static const StaticWarningCode UNDEFINED_CLASS = |
4866 const StaticWarningCode('UNDEFINED_CLASS', "Undefined class '{0}'"); | 4570 const StaticWarningCode('UNDEFINED_CLASS', "Undefined class '{0}'"); |
4867 | 4571 |
4868 /** | 4572 /** |
4869 * Same as [UNDEFINED_CLASS], but to catch using "boolean" instead of "bool". | 4573 * Same as [UNDEFINED_CLASS], but to catch using "boolean" instead of "bool". |
4870 */ | 4574 */ |
4871 static const StaticWarningCode UNDEFINED_CLASS_BOOLEAN = | 4575 static const StaticWarningCode UNDEFINED_CLASS_BOOLEAN = |
4872 const StaticWarningCode( | 4576 const StaticWarningCode('UNDEFINED_CLASS_BOOLEAN', |
4873 'UNDEFINED_CLASS_BOOLEAN', | |
4874 "Undefined class 'boolean'; did you mean 'bool'?"); | 4577 "Undefined class 'boolean'; did you mean 'bool'?"); |
4875 | 4578 |
4876 /** | 4579 /** |
4877 * 12.17 Getter Invocation: It is a static warning if there is no class | 4580 * 12.17 Getter Invocation: It is a static warning if there is no class |
4878 * <i>C</i> in the enclosing lexical scope of <i>i</i>, or if <i>C</i> does | 4581 * <i>C</i> in the enclosing lexical scope of <i>i</i>, or if <i>C</i> does |
4879 * not declare, implicitly or explicitly, a getter named <i>m</i>. | 4582 * not declare, implicitly or explicitly, a getter named <i>m</i>. |
4880 * | 4583 * |
4881 * @param getterName the name of the getter | 4584 * @param getterName the name of the getter |
4882 * @param enclosingType the name of the enclosing type where the getter is | 4585 * @param enclosingType the name of the enclosing type where the getter is |
4883 * being looked for | 4586 * being looked for |
(...skipping 16 matching lines...) Expand all Loading... |
4900 | 4603 |
4901 /** | 4604 /** |
4902 * 12.14.2 Binding Actuals to Formals: Furthermore, each <i>q<sub>i</sub></i>, | 4605 * 12.14.2 Binding Actuals to Formals: Furthermore, each <i>q<sub>i</sub></i>, |
4903 * <i>1<=i<=l</i>, must have a corresponding named parameter in the set | 4606 * <i>1<=i<=l</i>, must have a corresponding named parameter in the set |
4904 * {<i>p<sub>n+1</sub></i> … <i>p<sub>n+k</sub></i>} or a static | 4607 * {<i>p<sub>n+1</sub></i> … <i>p<sub>n+k</sub></i>} or a static |
4905 * warning occurs. | 4608 * warning occurs. |
4906 * | 4609 * |
4907 * @param name the name of the requested named parameter | 4610 * @param name the name of the requested named parameter |
4908 */ | 4611 */ |
4909 static const StaticWarningCode UNDEFINED_NAMED_PARAMETER = | 4612 static const StaticWarningCode UNDEFINED_NAMED_PARAMETER = |
4910 const StaticWarningCode( | 4613 const StaticWarningCode('UNDEFINED_NAMED_PARAMETER', |
4911 'UNDEFINED_NAMED_PARAMETER', | |
4912 "The named parameter '{0}' is not defined"); | 4614 "The named parameter '{0}' is not defined"); |
4913 | 4615 |
4914 /** | 4616 /** |
4915 * 12.18 Assignment: It is as static warning if an assignment of the form | 4617 * 12.18 Assignment: It is as static warning if an assignment of the form |
4916 * <i>v = e</i> occurs inside a top level or static function (be it function, | 4618 * <i>v = e</i> occurs inside a top level or static function (be it function, |
4917 * method, getter, or setter) or variable initializer and there is no | 4619 * method, getter, or setter) or variable initializer and there is no |
4918 * declaration <i>d</i> with name <i>v=</i> in the lexical scope enclosing the | 4620 * declaration <i>d</i> with name <i>v=</i> in the lexical scope enclosing the |
4919 * assignment. | 4621 * assignment. |
4920 * | 4622 * |
4921 * 12.18 Assignment: It is a static warning if there is no class <i>C</i> in | 4623 * 12.18 Assignment: It is a static warning if there is no class <i>C</i> in |
(...skipping 10 matching lines...) Expand all Loading... |
4932 | 4634 |
4933 /** | 4635 /** |
4934 * 12.16.3 Static Invocation: It is a static warning if <i>C</i> does not | 4636 * 12.16.3 Static Invocation: It is a static warning if <i>C</i> does not |
4935 * declare a static method or getter <i>m</i>. | 4637 * declare a static method or getter <i>m</i>. |
4936 * | 4638 * |
4937 * @param methodName the name of the method | 4639 * @param methodName the name of the method |
4938 * @param enclosingType the name of the enclosing type where the method is | 4640 * @param enclosingType the name of the enclosing type where the method is |
4939 * being looked for | 4641 * being looked for |
4940 */ | 4642 */ |
4941 static const StaticWarningCode UNDEFINED_STATIC_METHOD_OR_GETTER = | 4643 static const StaticWarningCode UNDEFINED_STATIC_METHOD_OR_GETTER = |
4942 const StaticWarningCode( | 4644 const StaticWarningCode('UNDEFINED_STATIC_METHOD_OR_GETTER', |
4943 'UNDEFINED_STATIC_METHOD_OR_GETTER', | |
4944 "The static method, getter or setter '{0}' is not defined for the clas
s '{1}'"); | 4645 "The static method, getter or setter '{0}' is not defined for the clas
s '{1}'"); |
4945 | 4646 |
4946 /** | 4647 /** |
4947 * 12.17 Getter Invocation: It is a static warning if there is no class | 4648 * 12.17 Getter Invocation: It is a static warning if there is no class |
4948 * <i>C</i> in the enclosing lexical scope of <i>i</i>, or if <i>C</i> does | 4649 * <i>C</i> in the enclosing lexical scope of <i>i</i>, or if <i>C</i> does |
4949 * not declare, implicitly or explicitly, a getter named <i>m</i>. | 4650 * not declare, implicitly or explicitly, a getter named <i>m</i>. |
4950 * | 4651 * |
4951 * @param getterName the name of the getter | 4652 * @param getterName the name of the getter |
4952 * @param enclosingType the name of the enclosing type where the getter is | 4653 * @param enclosingType the name of the enclosing type where the getter is |
4953 * being looked for | 4654 * being looked for |
4954 */ | 4655 */ |
4955 static const StaticWarningCode UNDEFINED_SUPER_GETTER = | 4656 static const StaticWarningCode UNDEFINED_SUPER_GETTER = |
4956 const StaticWarningCode( | 4657 const StaticWarningCode('UNDEFINED_SUPER_GETTER', |
4957 'UNDEFINED_SUPER_GETTER', | |
4958 "The getter '{0}' is not defined in a superclass of '{1}'"); | 4658 "The getter '{0}' is not defined in a superclass of '{1}'"); |
4959 | 4659 |
4960 /** | 4660 /** |
4961 * 12.18 Assignment: It is as static warning if an assignment of the form | 4661 * 12.18 Assignment: It is as static warning if an assignment of the form |
4962 * <i>v = e</i> occurs inside a top level or static function (be it function, | 4662 * <i>v = e</i> occurs inside a top level or static function (be it function, |
4963 * method, getter, or setter) or variable initializer and there is no | 4663 * method, getter, or setter) or variable initializer and there is no |
4964 * declaration <i>d</i> with name <i>v=</i> in the lexical scope enclosing the | 4664 * declaration <i>d</i> with name <i>v=</i> in the lexical scope enclosing the |
4965 * assignment. | 4665 * assignment. |
4966 * | 4666 * |
4967 * 12.18 Assignment: It is a static warning if there is no class <i>C</i> in | 4667 * 12.18 Assignment: It is a static warning if there is no class <i>C</i> in |
4968 * the enclosing lexical scope of the assignment, or if <i>C</i> does not | 4668 * the enclosing lexical scope of the assignment, or if <i>C</i> does not |
4969 * declare, implicitly or explicitly, a setter <i>v=</i>. | 4669 * declare, implicitly or explicitly, a setter <i>v=</i>. |
4970 * | 4670 * |
4971 * @param setterName the name of the getter | 4671 * @param setterName the name of the getter |
4972 * @param enclosingType the name of the enclosing type where the setter is | 4672 * @param enclosingType the name of the enclosing type where the setter is |
4973 * being looked for | 4673 * being looked for |
4974 */ | 4674 */ |
4975 static const StaticWarningCode UNDEFINED_SUPER_SETTER = | 4675 static const StaticWarningCode UNDEFINED_SUPER_SETTER = |
4976 const StaticWarningCode( | 4676 const StaticWarningCode('UNDEFINED_SUPER_SETTER', |
4977 'UNDEFINED_SUPER_SETTER', | |
4978 "The setter '{0}' is not defined in a superclass of '{1}'"); | 4677 "The setter '{0}' is not defined in a superclass of '{1}'"); |
4979 | 4678 |
4980 /** | 4679 /** |
4981 * 7.2 Getters: It is a static warning if the return type of a getter is void. | 4680 * 7.2 Getters: It is a static warning if the return type of a getter is void. |
4982 */ | 4681 */ |
4983 static const StaticWarningCode VOID_RETURN_FOR_GETTER = | 4682 static const StaticWarningCode VOID_RETURN_FOR_GETTER = |
4984 const StaticWarningCode( | 4683 const StaticWarningCode('VOID_RETURN_FOR_GETTER', |
4985 'VOID_RETURN_FOR_GETTER', | |
4986 "The return type of the getter must not be 'void'"); | 4684 "The return type of the getter must not be 'void'"); |
4987 | 4685 |
4988 /** | 4686 /** |
4989 * Initialize a newly created error code to have the given [name]. The message | 4687 * Initialize a newly created error code to have the given [name]. The message |
4990 * associated with the error will be created from the given [message] | 4688 * associated with the error will be created from the given [message] |
4991 * template. The correction associated with the error will be created from the | 4689 * template. The correction associated with the error will be created from the |
4992 * given [correction] template. | 4690 * given [correction] template. |
4993 */ | 4691 */ |
4994 const StaticWarningCode(String name, String message, [String correction]) | 4692 const StaticWarningCode(String name, String message, [String correction]) |
4995 : super(name, message, correction); | 4693 : super(name, message, correction); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5030 * Initialize a newly created error code to have the given [name]. | 4728 * Initialize a newly created error code to have the given [name]. |
5031 */ | 4729 */ |
5032 const TodoCode(String name) : super(name, "{0}"); | 4730 const TodoCode(String name) : super(name, "{0}"); |
5033 | 4731 |
5034 @override | 4732 @override |
5035 ErrorSeverity get errorSeverity => ErrorSeverity.INFO; | 4733 ErrorSeverity get errorSeverity => ErrorSeverity.INFO; |
5036 | 4734 |
5037 @override | 4735 @override |
5038 ErrorType get type => ErrorType.TODO; | 4736 ErrorType get type => ErrorType.TODO; |
5039 } | 4737 } |
OLD | NEW |