| 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 library engine.declaration_resolver_test; | 5 library engine.declaration_resolver_test; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/dart/element/element.dart'; | 10 import 'package:analyzer/dart/element/element.dart'; |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 main(List<String> items) { | 527 main(List<String> items) { |
| 528 items.forEach((item) {}); | 528 items.forEach((item) {}); |
| 529 } | 529 } |
| 530 '''; | 530 '''; |
| 531 CompilationUnit unit = await resolveSource(code); | 531 CompilationUnit unit = await resolveSource(code); |
| 532 // re-resolve | 532 // re-resolve |
| 533 _cloneResolveUnit(unit); | 533 _cloneResolveUnit(unit); |
| 534 // no other validations than built into DeclarationResolver | 534 // no other validations than built into DeclarationResolver |
| 535 } | 535 } |
| 536 | 536 |
| 537 test_visitGenericTypeAlias_0() async { |
| 538 String code = r''' |
| 539 typedef F<T> = Function<S>(List<S> list, Function<A>(A), T); |
| 540 '''; |
| 541 CompilationUnit unit = await resolveSource(code); |
| 542 // re-resolve |
| 543 _cloneResolveUnit(unit); |
| 544 // no other validations than built into DeclarationResolver |
| 545 } |
| 546 |
| 547 test_visitGenericTypeAlias_1() async { |
| 548 String code = r''' |
| 549 typedef F = Function({int}); |
| 550 '''; |
| 551 CompilationUnit unit = await resolveSource(code); |
| 552 // re-resolve |
| 553 _cloneResolveUnit(unit); |
| 554 // no other validations than built into DeclarationResolver |
| 555 } |
| 556 |
| 557 test_visitGenericTypeAlias_2() async { |
| 558 String code = r''' |
| 559 typedef F = int; |
| 560 '''; |
| 561 CompilationUnit unit = await resolveSource(code); |
| 562 // re-resolve |
| 563 _cloneResolveUnit(unit); |
| 564 // no other validations than built into DeclarationResolver |
| 565 } |
| 566 |
| 537 test_visitImportDirective_notExistingSource() async { | 567 test_visitImportDirective_notExistingSource() async { |
| 538 String code = r''' | 568 String code = r''' |
| 539 import 'foo.dart'; | 569 import 'foo.dart'; |
| 540 '''; | 570 '''; |
| 541 CompilationUnit unit = await resolveSource(code); | 571 CompilationUnit unit = await resolveSource(code); |
| 542 // re-resolve | 572 // re-resolve |
| 543 _cloneResolveUnit(unit); | 573 _cloneResolveUnit(unit); |
| 544 // no other validations than built into DeclarationResolver | 574 // no other validations than built into DeclarationResolver |
| 545 } | 575 } |
| 546 | 576 |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 710 expect(element.type.toString(), "<T>(T, T) → T"); | 740 expect(element.type.toString(), "<T>(T, T) → T"); |
| 711 expect(t.element, same(tElement)); | 741 expect(t.element, same(tElement)); |
| 712 | 742 |
| 713 // re-resolve | 743 // re-resolve |
| 714 CompilationUnit unit2 = _cloneResolveUnit(unit); | 744 CompilationUnit unit2 = _cloneResolveUnit(unit); |
| 715 node = _findSimpleIdentifier(unit2, code, 'max').parent; | 745 node = _findSimpleIdentifier(unit2, code, 'max').parent; |
| 716 t = node.typeParameters.typeParameters[0]; | 746 t = node.typeParameters.typeParameters[0]; |
| 717 expect(t.element, same(tElement)); | 747 expect(t.element, same(tElement)); |
| 718 } | 748 } |
| 719 } | 749 } |
| OLD | NEW |