OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 // An update to this file must be followed by regenerating the corresponding | 5 // An update to this file must be followed by regenerating the corresponding |
6 // json, dart2js and analyzer file. Use `publish.dart` in the bin directory. | 6 // json, dart2js and analyzer file. Use `publish.dart` in the bin directory. |
7 // | 7 // |
8 // Every message in this file must have an id. Use `message_id.dart` in the | 8 // Every message in this file must have an id. Use `message_id.dart` in the |
9 // bin directory to generate a fresh one. | 9 // bin directory to generate a fresh one. |
10 | 10 |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 "external foo; main(){}" | 293 "external foo; main(){}" |
294 ]), | 294 ]), |
295 | 295 |
296 'CONST_CLASS': new Message( | 296 'CONST_CLASS': new Message( |
297 id: 'GRKIQE', | 297 id: 'GRKIQE', |
298 subId: 2, | 298 subId: 2, |
299 // The specialization could also be 'EXTRANEOUS_MODIFIER_REPLACE', but the | 299 // The specialization could also be 'EXTRANEOUS_MODIFIER_REPLACE', but the |
300 // example below triggers 'EXTRANEOUS_MODIFIER'. | 300 // example below triggers 'EXTRANEOUS_MODIFIER'. |
301 specializationOf: 'EXTRANEOUS_MODIFIER', | 301 specializationOf: 'EXTRANEOUS_MODIFIER', |
302 categories: [Category.parserError], | 302 categories: [Category.parserError], |
303 template: "Classes can't be declared to be 'const'", | 303 template: "Classes can't be declared to be 'const'.", |
304 howToFix: "Try removing the 'const' keyword or moving to the class'" | 304 howToFix: "Try removing the 'const' keyword or moving to the class'" |
305 " constructor(s).", | 305 " constructor(s).", |
306 usedBy: [analyzer], | 306 usedBy: [analyzer], |
307 examples: const [ | 307 examples: const [ |
308 r""" | 308 r""" |
309 const class C {} | 309 const class C {} |
310 | 310 |
311 main() => new C(); | 311 main() => new C(); |
312 """ | 312 """ |
313 ]), | 313 ]), |
314 | 314 |
315 'CONST_METHOD': new Message( | 315 'CONST_METHOD': new Message( |
316 id: 'GRKIQE', | 316 id: 'GRKIQE', |
317 subId: 3, | 317 subId: 3, |
318 // The specialization could also be 'EXTRANEOUS_MODIFIER_REPLACE', but the | 318 // The specialization could also be 'EXTRANEOUS_MODIFIER_REPLACE', but the |
319 // example below triggers 'EXTRANEOUS_MODIFIER'. | 319 // example below triggers 'EXTRANEOUS_MODIFIER'. |
320 specializationOf: 'EXTRANEOUS_MODIFIER', | 320 specializationOf: 'EXTRANEOUS_MODIFIER', |
321 categories: [Category.parserError], | 321 categories: [Category.parserError], |
322 template: "Getters, setters and methods can't be declared to be 'const'", | 322 template: "Getters, setters and methods can't be declared to be 'const'.", |
323 howToFix: "Try removing the 'const' keyword.", | 323 howToFix: "Try removing the 'const' keyword.", |
324 usedBy: [analyzer], | 324 usedBy: [analyzer], |
325 examples: const [ | 325 examples: const [ |
326 "const int foo() => 499; main() {}", | 326 "const int foo() => 499; main() {}", |
327 "const int get foo => 499; main() {}", | 327 "const int get foo => 499; main() {}", |
328 "const set foo(v) => 499; main() {}", | 328 "const set foo(v) => 499; main() {}", |
329 "class A { const int foo() => 499; } main() { new A(); }", | 329 "class A { const int foo() => 499; } main() { new A(); }", |
330 "class A { const int get foo => 499; } main() { new A(); }", | 330 "class A { const int get foo => 499; } main() { new A(); }", |
331 "class A { const set foo(v) => 499; } main() { new A(); }", | 331 "class A { const set foo(v) => 499; } main() { new A(); }", |
332 ]), | 332 ]), |
333 | 333 |
334 'CONST_ENUM': new Message( | 334 'CONST_ENUM': new Message( |
335 id: 'GRKIQE', | 335 id: 'GRKIQE', |
336 subId: 4, | 336 subId: 4, |
337 // The specialization could also be 'EXTRANEOUS_MODIFIER_REPLACE', but the | 337 // The specialization could also be 'EXTRANEOUS_MODIFIER_REPLACE', but the |
338 // example below triggers 'EXTRANEOUS_MODIFIER'. | 338 // example below triggers 'EXTRANEOUS_MODIFIER'. |
339 specializationOf: 'EXTRANEOUS_MODIFIER', | 339 specializationOf: 'EXTRANEOUS_MODIFIER', |
340 categories: [Category.parserError], | 340 categories: [Category.parserError], |
341 template: "Enums can't be declared to be 'const'", | 341 template: "Enums can't be declared to be 'const'.", |
342 howToFix: "Try removing the 'const' keyword.", | 342 howToFix: "Try removing the 'const' keyword.", |
343 usedBy: [analyzer], | 343 usedBy: [analyzer], |
344 examples: const ["const enum Foo { x } main() {}",]), | 344 examples: const ["const enum Foo { x } main() {}",]), |
345 | 345 |
346 'CONST_TYPEDEF': new Message( | 346 'CONST_TYPEDEF': new Message( |
347 id: 'GRKIQE', | 347 id: 'GRKIQE', |
348 subId: 5, | 348 subId: 5, |
349 // The specialization could also be 'EXTRANEOUS_MODIFIER_REPLACE', but the | 349 // The specialization could also be 'EXTRANEOUS_MODIFIER_REPLACE', but the |
350 // example below triggers 'EXTRANEOUS_MODIFIER'. | 350 // example below triggers 'EXTRANEOUS_MODIFIER'. |
351 specializationOf: 'EXTRANEOUS_MODIFIER', | 351 specializationOf: 'EXTRANEOUS_MODIFIER', |
352 categories: [Category.parserError], | 352 categories: [Category.parserError], |
353 template: "Type aliases can't be declared to be 'const'", | 353 template: "Type aliases can't be declared to be 'const'.", |
354 howToFix: "Try removing the 'const' keyword.", | 354 howToFix: "Try removing the 'const' keyword.", |
355 usedBy: [analyzer], | 355 usedBy: [analyzer], |
356 examples: const ["const typedef void Foo(); main() {}",]), | 356 examples: const ["const typedef void Foo(); main() {}",]), |
357 | 357 |
358 'CONST_AND_FINAL': new Message( | 358 'CONST_AND_FINAL': new Message( |
359 id: 'GRKIQE', | 359 id: 'GRKIQE', |
360 subId: 6, | 360 subId: 6, |
361 // The specialization could also be 'EXTRANEOUS_MODIFIER_REPLACE', but the | 361 // The specialization could also be 'EXTRANEOUS_MODIFIER_REPLACE', but the |
362 // example below triggers 'EXTRANEOUS_MODIFIER'. | 362 // example below triggers 'EXTRANEOUS_MODIFIER'. |
363 specializationOf: 'EXTRANEOUS_MODIFIER', | 363 specializationOf: 'EXTRANEOUS_MODIFIER', |
364 categories: [Category.parserError], | 364 categories: [Category.parserError], |
365 template: "Members can't be declared to be both 'const' and 'final'", | 365 template: "Members can't be declared to be both 'const' and 'final'.", |
366 howToFix: "Try removing either the 'const' or 'final' keyword.", | 366 howToFix: "Try removing either the 'const' or 'final' keyword.", |
367 usedBy: [analyzer], | 367 usedBy: [analyzer], |
368 examples: const [ | 368 examples: const [ |
369 "final const int x = 499; main() {}", | 369 "final const int x = 499; main() {}", |
370 "const final int x = 499; main() {}", | 370 "const final int x = 499; main() {}", |
371 "class A { static final const int x = 499; } main() {}", | 371 "class A { static final const int x = 499; } main() {}", |
372 "class A { static const final int x = 499; } main() {}", | 372 "class A { static const final int x = 499; } main() {}", |
373 ]), | 373 ]), |
374 | 374 |
375 'CONST_AND_VAR': new Message( | 375 'CONST_AND_VAR': new Message( |
376 id: 'GRKIQE', | 376 id: 'GRKIQE', |
377 subId: 7, | 377 subId: 7, |
378 // The specialization could also be 'EXTRANEOUS_MODIFIER_REPLACE', but the | 378 // The specialization could also be 'EXTRANEOUS_MODIFIER_REPLACE', but the |
379 // example below triggers 'EXTRANEOUS_MODIFIER'. | 379 // example below triggers 'EXTRANEOUS_MODIFIER'. |
380 specializationOf: 'EXTRANEOUS_MODIFIER', | 380 specializationOf: 'EXTRANEOUS_MODIFIER', |
381 categories: [Category.parserError], | 381 categories: [Category.parserError], |
382 template: "Members can't be declared to be both 'const' and 'var'", | 382 template: "Members can't be declared to be both 'const' and 'var'.", |
383 howToFix: "Try removing either the 'const' or 'var' keyword.", | 383 howToFix: "Try removing either the 'const' or 'var' keyword.", |
384 usedBy: [analyzer], | 384 usedBy: [analyzer], |
385 examples: const [ | 385 examples: const [ |
386 "var const x = 499; main() {}", | 386 "var const x = 499; main() {}", |
387 "const var x = 499; main() {}", | 387 "const var x = 499; main() {}", |
388 "class A { var const x = 499; } main() {}", | 388 "class A { var const x = 499; } main() {}", |
389 "class A { const var x = 499; } main() {}", | 389 "class A { const var x = 499; } main() {}", |
390 ]), | 390 ]), |
391 | 391 |
392 'CLASS_IN_CLASS': new Message( | 392 'CLASS_IN_CLASS': new Message( |
393 // Dart2js currently reports this as an EXTRANEOUS_MODIFIER error. | 393 // Dart2js currently reports this as an EXTRANEOUS_MODIFIER error. |
394 // TODO(floitsch): make dart2js use this error instead. | 394 // TODO(floitsch): make dart2js use this error instead. |
395 id: 'DOTHQH', | 395 id: 'DOTHQH', |
396 categories: [Category.parserError], | 396 categories: [Category.parserError], |
397 template: "Classes can't be declared inside other classes.", | 397 template: "Classes can't be declared inside other classes.", |
398 howToFix: "Try moving the class to the top-level.", | 398 howToFix: "Try moving the class to the top-level.", |
399 usedBy: [analyzer], | 399 usedBy: [analyzer], |
400 examples: const ["class A { class B {} } main() { new A(); }",]), | 400 examples: const ["class A { class B {} } main() { new A(); }",]), |
401 | 401 |
402 'CONSTRUCTOR_WITH_RETURN_TYPE': new Message( | 402 'CONSTRUCTOR_WITH_RETURN_TYPE': new Message( |
403 id: 'VOJBWY', | 403 id: 'VOJBWY', |
404 categories: [Category.parserError], | 404 categories: [Category.parserError], |
405 template: "Constructors can't have a return type", | 405 template: "Constructors can't have a return type.", |
406 howToFix: "Try removing the return type.", | 406 howToFix: "Try removing the return type.", |
407 usedBy: [analyzer, dart2js], | 407 usedBy: [analyzer, dart2js], |
408 examples: const ["class A { int A() {} } main() { new A(); }",]), | 408 examples: const ["class A { int A() {} } main() { new A(); }",]), |
409 | 409 |
410 'MISSING_EXPRESSION_IN_THROW': new Message( | 410 'MISSING_EXPRESSION_IN_THROW': new Message( |
411 id: 'FTGGMJ', | 411 id: 'FTGGMJ', |
412 subId: 0, | 412 subId: 0, |
413 categories: [Category.parserError], | 413 categories: [Category.parserError], |
414 template: "Missing expression after 'throw'.", | 414 template: "Missing expression after 'throw'.", |
415 howToFix: "Did you mean 'rethrow'?", | 415 howToFix: "Did you mean 'rethrow'?", |
416 usedBy: [analyzer, dart2js], | 416 usedBy: [analyzer, dart2js], |
417 examples: const [ | 417 examples: const [ |
418 'main() { throw; }', | 418 'main() { throw; }', |
419 'main() { try { throw 0; } catch(e) { throw; } }' | 419 'main() { try { throw 0; } catch(e) { throw; } }' |
420 ]), | 420 ]), |
421 | 421 |
422 /** | 422 /** |
423 * 12.8.1 Rethrow: It is a compile-time error if an expression of the form | 423 * 12.8.1 Rethrow: It is a compile-time error if an expression of the form |
424 * <i>rethrow;</i> is not enclosed within a on-catch clause. | 424 * <i>rethrow;</i> is not enclosed within a on-catch clause. |
425 */ | 425 */ |
426 'RETHROW_OUTSIDE_CATCH': new Message( | 426 'RETHROW_OUTSIDE_CATCH': new Message( |
427 id: 'MWETLC', | 427 id: 'MWETLC', |
428 categories: [Category.compileTimeError], | 428 categories: [Category.compileTimeError], |
429 template: 'Rethrow must be inside of catch clause', | 429 template: 'Rethrow must be inside of catch clause.', |
430 howToFix: "Try moving the expression into a catch clause, or " | 430 howToFix: "Try moving the expression into a catch clause, or " |
431 "using a 'throw' expression.", | 431 "using a 'throw' expression.", |
432 usedBy: [analyzer, dart2js], | 432 usedBy: [analyzer, dart2js], |
433 examples: const ["main() { rethrow; }"]), | 433 examples: const ["main() { rethrow; }"]), |
434 | 434 |
435 /** | 435 /** |
436 * 13.12 Return: It is a compile-time error if a return statement of the form | 436 * 13.12 Return: It is a compile-time error if a return statement of the form |
437 * <i>return e;</i> appears in a generative constructor. | 437 * <i>return e;</i> appears in a generative constructor. |
438 */ | 438 */ |
439 'RETURN_IN_GENERATIVE_CONSTRUCTOR': new Message( | 439 'RETURN_IN_GENERATIVE_CONSTRUCTOR': new Message( |
(...skipping 18 matching lines...) Expand all Loading... |
458 * 13.12 Return: It is a compile-time error if a return statement of the form | 458 * 13.12 Return: It is a compile-time error if a return statement of the form |
459 * <i>return e;</i> appears in a generator function. | 459 * <i>return e;</i> appears in a generator function. |
460 */ | 460 */ |
461 'RETURN_IN_GENERATOR': new Message( | 461 'RETURN_IN_GENERATOR': new Message( |
462 id: 'JRUTUQ', | 462 id: 'JRUTUQ', |
463 subId: 0, | 463 subId: 0, |
464 categories: [Category.compileTimeError], | 464 categories: [Category.compileTimeError], |
465 template: "Can't return a value from a generator function " | 465 template: "Can't return a value from a generator function " |
466 "(using the '#{modifier}' modifier).", | 466 "(using the '#{modifier}' modifier).", |
467 howToFix: "Try removing the value, replacing 'return' with 'yield' or" | 467 howToFix: "Try removing the value, replacing 'return' with 'yield' or" |
468 " changing the method body modifier", | 468 " changing the method body modifier.", |
469 usedBy: [analyzer, dart2js], | 469 usedBy: [analyzer, dart2js], |
470 examples: const [ | 470 examples: const [ |
471 """ | 471 """ |
472 foo() async* { return 0; } | 472 foo() async* { return 0; } |
473 main() => foo(); | 473 main() => foo(); |
474 """, | 474 """, |
475 """ | 475 """ |
476 foo() sync* { return 0; } | 476 foo() sync* { return 0; } |
477 main() => foo(); | 477 main() => foo(); |
478 """ | 478 """ |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 id: 'FYQYXB', | 545 id: 'FYQYXB', |
546 subId: 3, | 546 subId: 3, |
547 specializationOf: 'NOT_ASSIGNABLE', | 547 specializationOf: 'NOT_ASSIGNABLE', |
548 categories: [Category.hint, Category.staticWarning], | 548 categories: [Category.hint, Category.staticWarning], |
549 template: "The argument type '#{fromType}' cannot be assigned to the " | 549 template: "The argument type '#{fromType}' cannot be assigned to the " |
550 "parameter type '#{toType}'.", | 550 "parameter type '#{toType}'.", |
551 usedBy: [analyzer], | 551 usedBy: [analyzer], |
552 // TODO(floitsch): support hint warnings and ways to specify which | 552 // TODO(floitsch): support hint warnings and ways to specify which |
553 // category an example should trigger for. | 553 // category an example should trigger for. |
554 examples: const ["foo(int x) => x; main() { foo('bar'); }"]), | 554 examples: const ["foo(int x) => x; main() { foo('bar'); }"]), |
| 555 |
| 556 'CANNOT_RESOLVE': new Message( |
| 557 id: 'ERUSKD', |
| 558 subId: 0, |
| 559 categories: [Category.staticTypeWarning], |
| 560 template: "Can't resolve '#{name}'.", |
| 561 usedBy: [dart2js]), |
| 562 |
| 563 /** |
| 564 * 12.15.1 Ordinary Invocation: Let <i>T</i> be the static type of <i>o</i>. |
| 565 * It is a static type warning if <i>T</i> does not have an accessible |
| 566 * instance member named <i>m</i>. |
| 567 */ |
| 568 'UNDEFINED_METHOD': new Message( |
| 569 id: 'ERUSKD', |
| 570 subId: 1, |
| 571 categories: [Category.staticTypeWarning, Category.hint], |
| 572 template: "The method '#{memberName}' is not defined for the class" |
| 573 " '#{className}'.", |
| 574 usedBy: [dart2js, analyzer], |
| 575 examples: const [ |
| 576 """ |
| 577 class A { |
| 578 foo() { bar(); } |
| 579 } |
| 580 main() { new A().foo(); } |
| 581 """, |
| 582 ]), |
| 583 |
| 584 /** |
| 585 * 12.15.1 Ordinary Invocation: Let <i>T</i> be the static type of <i>o</i>. |
| 586 * It is a static type warning if <i>T</i> does not have an accessible |
| 587 * instance member named <i>m</i>. |
| 588 */ |
| 589 'UNDEFINED_METHOD_WITH_CONSTRUCTOR': new Message( |
| 590 id: 'ERUSKD', |
| 591 subId: 2, |
| 592 specializationOf: "UNDEFINED_METHOD", |
| 593 categories: [Category.staticTypeWarning], |
| 594 template: "The method '#{memberName}' is not defined for the class" |
| 595 " '#{className}', but a constructor with that name is defined.", |
| 596 howToFix: "Try adding 'new' or 'const' to invoke the constuctor, or " |
| 597 "change the method name.", |
| 598 usedBy: [analyzer], |
| 599 examples: const [ |
| 600 """ |
| 601 class A { |
| 602 A.bar() {} |
| 603 } |
| 604 main() { A.bar(); } |
| 605 """, |
| 606 ]), |
| 607 |
| 608 /** |
| 609 * 12.17 Getter Invocation: Let <i>T</i> be the static type of <i>e</i>. It is |
| 610 * a static type warning if <i>T</i> does not have a getter named <i>m</i>. |
| 611 */ |
| 612 'UNDEFINED_GETTER': new Message( |
| 613 id: 'ERUSKD', |
| 614 subId: 3, |
| 615 categories: [ |
| 616 Category.staticTypeWarning, |
| 617 Category.staticWarning, |
| 618 Category.hint |
| 619 ], |
| 620 template: "The getter '#{memberName}' is not defined for the " |
| 621 "class '#{className}'.", |
| 622 usedBy: [dart2js, analyzer], |
| 623 examples: const [ |
| 624 "class A {} main() { new A().x; }", |
| 625 "class A {} main() { A.x; }" |
| 626 ]), |
| 627 |
| 628 /** |
| 629 * 12.17 Getter Invocation: It is a static warning if there is no class |
| 630 * <i>C</i> in the enclosing lexical scope of <i>i</i>, or if <i>C</i> does |
| 631 * not declare, implicitly or explicitly, a getter named <i>m</i>. |
| 632 */ |
| 633 'UNDEFINED_ENUM_CONSTANT': new Message( |
| 634 id: 'ERUSKD', |
| 635 subId: 4, |
| 636 specializationOf: 'UNDEFINED_GETTER', |
| 637 categories: [Category.staticTypeWarning], |
| 638 template: "There is no constant named '#{memberName}' in '#{className}'.", |
| 639 usedBy: [analyzer], |
| 640 examples: const [ |
| 641 """ |
| 642 enum E { ONE } |
| 643 E e() { return E.TWO; } |
| 644 main() { e(); } |
| 645 """ |
| 646 ]), |
| 647 |
| 648 'UNDEFINED_INSTANCE_GETTER_BUT_SETTER': new Message( |
| 649 id: 'ERUSKD', |
| 650 subId: 5, |
| 651 specializationOf: 'UNDEFINED_GETTER', |
| 652 categories: [Category.staticTypeWarning,], |
| 653 template: "The setter '#{memberName}' in class '#{className}' can" |
| 654 " not be used as a getter.", |
| 655 usedBy: [dart2js], |
| 656 examples: const ["class A { set x(y) {} } main() { new A().x; }",]), |
| 657 |
| 658 /** |
| 659 * 12.18 Assignment: Evaluation of an assignment of the form |
| 660 * <i>e<sub>1</sub></i>[<i>e<sub>2</sub></i>] = <i>e<sub>3</sub></i> is |
| 661 * equivalent to the evaluation of the expression (a, i, e){a.[]=(i, e); |
| 662 * return e;} (<i>e<sub>1</sub></i>, <i>e<sub>2</sub></i>, |
| 663 * <i>e<sub>2</sub></i>). |
| 664 * |
| 665 * 12.29 Assignable Expressions: An assignable expression of the form |
| 666 * <i>e<sub>1</sub></i>[<i>e<sub>2</sub></i>] is evaluated as a method |
| 667 * invocation of the operator method [] on <i>e<sub>1</sub></i> with argument |
| 668 * <i>e<sub>2</sub></i>. |
| 669 * |
| 670 * 12.15.1 Ordinary Invocation: Let <i>T</i> be the static type of <i>o</i>. |
| 671 * It is a static type warning if <i>T</i> does not have an accessible |
| 672 * instance member named <i>m</i>. |
| 673 */ |
| 674 'UNDEFINED_OPERATOR': new Message( |
| 675 id: 'ERUSKD', |
| 676 subId: 6, |
| 677 categories: [Category.staticTypeWarning, Category.hint], |
| 678 template: "The operator '#{memberName}' is not defined for the " |
| 679 "class '#{className}'.", |
| 680 usedBy: [dart2js, analyzer], |
| 681 examples: const ["class A {} main() { new A() + 3; }",]), |
| 682 |
| 683 /** |
| 684 * 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i>. |
| 685 * It is a static type warning if <i>T</i> does not have an accessible |
| 686 * instance setter named <i>v=</i>. |
| 687 * |
| 688 * 12.18 Assignment: It is as static warning if an assignment of the form |
| 689 * <i>v = e</i> occurs inside a top level or static function (be it function, |
| 690 * method, getter, or setter) or variable initializer and there is no |
| 691 * declaration <i>d</i> with name <i>v=</i> in the lexical scope enclosing the |
| 692 * assignment. |
| 693 * |
| 694 * 12.18 Assignment: It is a static warning if there is no class <i>C</i> in |
| 695 * the enclosing lexical scope of the assignment, or if <i>C</i> does not |
| 696 * declare, implicitly or explicitly, a setter <i>v=</i>. |
| 697 */ |
| 698 'UNDEFINED_SETTER': new Message( |
| 699 id: 'ERUSKD', |
| 700 subId: 7, |
| 701 categories: [ |
| 702 Category.staticTypeWarning, |
| 703 Category.staticWarning, |
| 704 Category.hint |
| 705 ], |
| 706 template: "The setter '#{memberName}' is not defined for the " |
| 707 "class '#{className}'.", |
| 708 usedBy: [dart2js, analyzer], |
| 709 examples: const ["class A {} main() { new A().x = 499; }",]), |
| 710 |
| 711 'NO_SUCH_SUPER_MEMBER': new Message( |
| 712 id: 'ERUSKD', |
| 713 subId: 8, |
| 714 categories: [Category.staticTypeWarning], |
| 715 template: |
| 716 "Can't resolve '#{memberName}' in a superclass of '#{className}'.", |
| 717 usedBy: [dart2js]), |
| 718 |
| 719 /** |
| 720 * 12.17 Getter Invocation: Let <i>T</i> be the static type of <i>e</i>. It is |
| 721 * a static type warning if <i>T</i> does not have a getter named <i>m</i>. |
| 722 * |
| 723 * 12.17 Getter Invocation: It is a static warning if there is no class |
| 724 * <i>C</i> in the enclosing lexical scope of <i>i</i>, or if <i>C</i> does |
| 725 * not declare, implicitly or explicitly, a getter named <i>m</i>. |
| 726 */ |
| 727 'UNDEFINED_SUPER_GETTER': new Message( |
| 728 id: 'ERUSKD', |
| 729 subId: 9, |
| 730 specializationOf: 'NO_SUCH_SUPER_MEMBER', |
| 731 categories: [Category.staticTypeWarning, Category.staticWarning], |
| 732 template: "The getter '#{memberName}' is not defined in a superclass " |
| 733 "of '#{className}'.", |
| 734 usedBy: [analyzer], |
| 735 examples: const [ |
| 736 """ |
| 737 class A {} |
| 738 class B extends A { |
| 739 foo() => super.x; |
| 740 } |
| 741 main() { new B().foo(); } |
| 742 """ |
| 743 ]), |
| 744 |
| 745 /** |
| 746 * 12.15.4 Super Invocation: A super method invocation <i>i</i> has the form |
| 747 * <i>super.m(a<sub>1</sub>, …, a<sub>n</sub>, x<sub>n+1</sub>: |
| 748 * a<sub>n+1</sub>, … x<sub>n+k</sub>: a<sub>n+k</sub>)</i>. It is a |
| 749 * static type warning if <i>S</i> does not have an accessible instance member |
| 750 * named <i>m</i>. |
| 751 */ |
| 752 'UNDEFINED_SUPER_METHOD': new Message( |
| 753 id: 'ERUSKD', |
| 754 subId: 10, |
| 755 specializationOf: 'NO_SUCH_SUPER_MEMBER', |
| 756 categories: [Category.staticTypeWarning], |
| 757 template: "The method '#{memberName}' is not defined in a superclass " |
| 758 "of '#{className}'.", |
| 759 usedBy: [analyzer], |
| 760 examples: const [ |
| 761 """ |
| 762 class A {} |
| 763 class B extends A { |
| 764 foo() => super.x(); |
| 765 } |
| 766 main() { new B().foo(); } |
| 767 """ |
| 768 ]), |
| 769 |
| 770 /** |
| 771 * 12.18 Assignment: Evaluation of an assignment of the form |
| 772 * <i>e<sub>1</sub></i>[<i>e<sub>2</sub></i>] = <i>e<sub>3</sub></i> is |
| 773 * equivalent to the evaluation of the expression (a, i, e){a.[]=(i, e); |
| 774 * return e;} (<i>e<sub>1</sub></i>, <i>e<sub>2</sub></i>, |
| 775 * <i>e<sub>2</sub></i>). |
| 776 * |
| 777 * 12.29 Assignable Expressions: An assignable expression of the form |
| 778 * <i>e<sub>1</sub></i>[<i>e<sub>2</sub></i>] is evaluated as a method |
| 779 * invocation of the operator method [] on <i>e<sub>1</sub></i> with argument |
| 780 * <i>e<sub>2</sub></i>. |
| 781 * |
| 782 * 12.15.1 Ordinary Invocation: Let <i>T</i> be the static type of <i>o</i>. |
| 783 * It is a static type warning if <i>T</i> does not have an accessible |
| 784 * instance member named <i>m</i>. |
| 785 */ |
| 786 'UNDEFINED_SUPER_OPERATOR': new Message( |
| 787 id: 'ERUSKD', |
| 788 subId: 11, |
| 789 specializationOf: 'NO_SUCH_SUPER_MEMBER', |
| 790 categories: [Category.staticTypeWarning], |
| 791 template: "The operator '#{memberName}' is not defined in a superclass " |
| 792 "of '#{className}'.", |
| 793 usedBy: [analyzer], |
| 794 examples: const [ |
| 795 """ |
| 796 class A {} |
| 797 class B extends A { |
| 798 foo() => super + 499; |
| 799 } |
| 800 main() { new B().foo(); } |
| 801 """ |
| 802 ]), |
| 803 |
| 804 /** |
| 805 * 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i>. |
| 806 * It is a static type warning if <i>T</i> does not have an accessible |
| 807 * instance setter named <i>v=</i>. |
| 808 * |
| 809 * 12.18 Assignment: It is as static warning if an assignment of the form |
| 810 * <i>v = e</i> occurs inside a top level or static function (be it function, |
| 811 * method, getter, or setter) or variable initializer and there is no |
| 812 * declaration <i>d</i> with name <i>v=</i> in the lexical scope enclosing the |
| 813 * assignment. |
| 814 * |
| 815 * 12.18 Assignment: It is a static warning if there is no class <i>C</i> in |
| 816 * the enclosing lexical scope of the assignment, or if <i>C</i> does not |
| 817 * declare, implicitly or explicitly, a setter <i>v=</i>. |
| 818 |
| 819 */ |
| 820 'UNDEFINED_SUPER_SETTER': new Message( |
| 821 id: 'ERUSKD', |
| 822 subId: 12, |
| 823 categories: [Category.staticTypeWarning, Category.staticWarning], |
| 824 template: "The setter '#{memberName}' is not defined in a superclass " |
| 825 "of '#{className}'.", |
| 826 usedBy: [analyzer, dart2js,], |
| 827 examples: const [ |
| 828 """ |
| 829 class A {} |
| 830 class B extends A { |
| 831 foo() { super.x = 499; } |
| 832 } |
| 833 main() { new B().foo(); } |
| 834 """, |
| 835 """ |
| 836 main() => new B().m(); |
| 837 class A { |
| 838 get x => 1; |
| 839 } |
| 840 class B extends A { |
| 841 m() { super.x = 2; } |
| 842 } |
| 843 """ |
| 844 ]), |
| 845 |
| 846 /** |
| 847 * 12.15.3 Unqualified Invocation: If there exists a lexically visible |
| 848 * declaration named <i>id</i>, let <i>f<sub>id</sub></i> be the innermost |
| 849 * such declaration. Then: [skip]. Otherwise, <i>f<sub>id</sub></i> is |
| 850 * considered equivalent to the ordinary method invocation |
| 851 * <b>this</b>.<i>id</i>(<i>a<sub>1</sub></i>, ..., <i>a<sub>n</sub></i>, |
| 852 * <i>x<sub>n+1</sub></i> : <i>a<sub>n+1</sub></i>, ..., |
| 853 * <i>x<sub>n+k</sub></i> : <i>a<sub>n+k</sub></i>). |
| 854 */ |
| 855 'UNDEFINED_FUNCTION': new Message( |
| 856 id: 'ERUSKD', |
| 857 subId: 13, |
| 858 specializationOf: 'CANNOT_RESOLVE', |
| 859 categories: [Category.staticTypeWarning], |
| 860 template: "The function '#{memberName}' is not defined.", |
| 861 usedBy: [analyzer], |
| 862 examples: const ["main() { foo(); }",]), |
| 863 |
| 864 'UNDEFINED_STATIC_GETTER_BUT_SETTER': new Message( |
| 865 id: 'ERUSKD', |
| 866 subId: 14, |
| 867 specializationOf: 'CANNOT_RESOLVE', |
| 868 categories: [Category.staticTypeWarning], |
| 869 template: "Cannot resolve getter '#{name}'.", |
| 870 usedBy: [dart2js], |
| 871 examples: const ["set foo(x) {} main() { foo; }",]), |
| 872 |
| 873 'UNDEFINED_STATIC_SETTER_BUT_GETTER': new Message( |
| 874 id: 'ERUSKD', |
| 875 subId: 15, |
| 876 specializationOf: 'CANNOT_RESOLVE', |
| 877 categories: [Category.staticTypeWarning], |
| 878 template: "Cannot resolve setter '#{name}'.", |
| 879 usedBy: [dart2js], |
| 880 examples: const [ |
| 881 """ |
| 882 main() { |
| 883 final x = 1; |
| 884 x = 2; |
| 885 }""", |
| 886 """ |
| 887 main() { |
| 888 const x = 1; |
| 889 x = 2; |
| 890 } |
| 891 """, |
| 892 """ |
| 893 final x = 1; |
| 894 main() { x = 3; } |
| 895 """, |
| 896 """ |
| 897 const x = 1; |
| 898 main() { x = 3; } |
| 899 """, |
| 900 "get foo => null main() { foo = 5; }", |
| 901 "const foo = 0 main() { foo = 5; }", |
| 902 ]), |
555 }; | 903 }; |
OLD | NEW |