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.compile_time_error_code_test; | 5 library engine.compile_time_error_code_test; |
6 | 6 |
7 import 'package:analyzer/src/generated/error.dart'; | 7 import 'package:analyzer/src/generated/error.dart'; |
8 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode; | 8 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode; |
9 import 'package:analyzer/src/generated/source_io.dart'; | 9 import 'package:analyzer/src/generated/source_io.dart'; |
10 import 'package:unittest/unittest.dart' as _ut; | 10 import 'package:unittest/unittest.dart' as _ut; |
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 Source source = addSource(''' | 569 Source source = addSource(''' |
570 f() sync* { | 570 f() sync* { |
571 var await = 1; | 571 var await = 1; |
572 } | 572 } |
573 '''); | 573 '''); |
574 resolve(source); | 574 resolve(source); |
575 assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]); | 575 assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]); |
576 verify([source]); | 576 verify([source]); |
577 } | 577 } |
578 | 578 |
| 579 void test_bug_23176() { |
| 580 Source source = addSource(''' |
| 581 class A { |
| 582 const A([x]); |
| 583 } |
| 584 class B { |
| 585 dynamic @A(const A()) x; |
| 586 } |
| 587 '''); |
| 588 resolve(source); |
| 589 assertErrors(source, [ |
| 590 ParserErrorCode.EXPECTED_CLASS_MEMBER, |
| 591 ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE |
| 592 ]); |
| 593 verify([source]); |
| 594 } |
| 595 |
579 void test_builtInIdentifierAsMixinName_classTypeAlias() { | 596 void test_builtInIdentifierAsMixinName_classTypeAlias() { |
580 Source source = addSource(r''' | 597 Source source = addSource(r''' |
581 class A {} | 598 class A {} |
582 class B {} | 599 class B {} |
583 class as = A with B;'''); | 600 class as = A with B;'''); |
584 resolve(source); | 601 resolve(source); |
585 assertErrors( | 602 assertErrors( |
586 source, [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME]); | 603 source, [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME]); |
587 verify([source]); | 604 verify([source]); |
588 } | 605 } |
(...skipping 5084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5673 source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR]); | 5690 source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR]); |
5674 verify([source]); | 5691 verify([source]); |
5675 reset(); | 5692 reset(); |
5676 } | 5693 } |
5677 | 5694 |
5678 void _check_wrongNumberOfParametersForOperator1(String name) { | 5695 void _check_wrongNumberOfParametersForOperator1(String name) { |
5679 _check_wrongNumberOfParametersForOperator(name, ""); | 5696 _check_wrongNumberOfParametersForOperator(name, ""); |
5680 _check_wrongNumberOfParametersForOperator(name, "a, b"); | 5697 _check_wrongNumberOfParametersForOperator(name, "a, b"); |
5681 } | 5698 } |
5682 } | 5699 } |
OLD | NEW |