| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 import 'dart:async'; | 5 import 'dart:async'; |
| 6 import 'dart:collection'; | 6 import 'dart:collection'; |
| 7 | 7 |
| 8 import 'package:async_helper/async_helper.dart'; | 8 import 'package:async_helper/async_helper.dart'; |
| 9 import 'package:expect/expect.dart'; | 9 import 'package:expect/expect.dart'; |
| 10 import 'package:compiler/src/constants/expressions.dart'; | 10 import 'package:compiler/src/constants/expressions.dart'; |
| 11 import 'package:compiler/src/elements/modelx.dart'; |
| 11 import 'package:compiler/src/elements/resolution_types.dart'; | 12 import 'package:compiler/src/elements/resolution_types.dart'; |
| 12 import 'package:compiler/src/elements/modelx.dart'; | 13 import 'package:compiler/src/elements/types.dart'; |
| 13 import 'package:compiler/src/resolution/constructors.dart'; | 14 import 'package:compiler/src/resolution/constructors.dart'; |
| 14 import 'package:compiler/src/resolution/members.dart'; | 15 import 'package:compiler/src/resolution/members.dart'; |
| 15 import 'package:compiler/src/resolution/registry.dart'; | 16 import 'package:compiler/src/resolution/registry.dart'; |
| 16 import 'package:compiler/src/resolution/resolution_result.dart'; | 17 import 'package:compiler/src/resolution/resolution_result.dart'; |
| 17 import 'package:compiler/src/resolution/scope.dart'; | 18 import 'package:compiler/src/resolution/scope.dart'; |
| 18 import 'package:compiler/src/resolution/tree_elements.dart'; | 19 import 'package:compiler/src/resolution/tree_elements.dart'; |
| 19 import 'package:compiler/src/universe/use.dart'; | 20 import 'package:compiler/src/universe/use.dart'; |
| 20 import 'package:compiler/src/universe/world_impact.dart'; | 21 import 'package:compiler/src/universe/world_impact.dart'; |
| 21 | 22 |
| 22 import 'compiler_helper.dart'; | 23 import 'compiler_helper.dart'; |
| (...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 800 compiler.parseScript("""class A extends B {} | 801 compiler.parseScript("""class A extends B {} |
| 801 class B extends C {} | 802 class B extends C {} |
| 802 class C {} | 803 class C {} |
| 803 main() { return new A(); }"""); | 804 main() { return new A(); }"""); |
| 804 FunctionElement mainElement = compiler.mainApp.find(MAIN); | 805 FunctionElement mainElement = compiler.mainApp.find(MAIN); |
| 805 compiler.resolver.resolve(mainElement); | 806 compiler.resolver.resolve(mainElement); |
| 806 DiagnosticCollector collector = compiler.diagnosticCollector; | 807 DiagnosticCollector collector = compiler.diagnosticCollector; |
| 807 Expect.equals(0, collector.warnings.length); | 808 Expect.equals(0, collector.warnings.length); |
| 808 Expect.equals(0, collector.errors.length); | 809 Expect.equals(0, collector.errors.length); |
| 809 ClassElement aElement = compiler.mainApp.find("A"); | 810 ClassElement aElement = compiler.mainApp.find("A"); |
| 810 Link<ResolutionDartType> supertypes = aElement.allSupertypes; | 811 Link<InterfaceType> supertypes = aElement.allSupertypes; |
| 811 Expect.equals(<String>['B', 'C', 'Object'].toString(), | 812 Expect.equals(<String>['B', 'C', 'Object'].toString(), |
| 812 asSortedStrings(supertypes).toString()); | 813 asSortedStrings(supertypes).toString()); |
| 813 }), | 814 }), |
| 814 MockCompiler.create((MockCompiler compiler) { | 815 MockCompiler.create((MockCompiler compiler) { |
| 815 compiler.parseScript("""class A<T> {} | 816 compiler.parseScript("""class A<T> {} |
| 816 class B<Z,W> extends A<int> | 817 class B<Z,W> extends A<int> |
| 817 implements I<Z,List<W>> {} | 818 implements I<Z,List<W>> {} |
| 818 class I<X,Y> {} | 819 class I<X,Y> {} |
| 819 class C extends B<bool,String> {} | 820 class C extends B<bool,String> {} |
| 820 main() { return new C(); }"""); | 821 main() { return new C(); }"""); |
| 821 FunctionElement mainElement = compiler.mainApp.find(MAIN); | 822 FunctionElement mainElement = compiler.mainApp.find(MAIN); |
| 822 compiler.resolver.resolve(mainElement); | 823 compiler.resolver.resolve(mainElement); |
| 823 DiagnosticCollector collector = compiler.diagnosticCollector; | 824 DiagnosticCollector collector = compiler.diagnosticCollector; |
| 824 Expect.equals(0, collector.warnings.length); | 825 Expect.equals(0, collector.warnings.length); |
| 825 Expect.equals(0, collector.errors.length); | 826 Expect.equals(0, collector.errors.length); |
| 826 ClassElement aElement = compiler.mainApp.find("C"); | 827 ClassElement aElement = compiler.mainApp.find("C"); |
| 827 Link<ResolutionDartType> supertypes = aElement.allSupertypes; | 828 Link<InterfaceType> supertypes = aElement.allSupertypes; |
| 828 // Object is once per inheritance path, that is from both A and I. | 829 // Object is once per inheritance path, that is from both A and I. |
| 829 Expect.equals( | 830 Expect.equals( |
| 830 <String>[ | 831 <String>[ |
| 831 'A<int>', | 832 'A<int>', |
| 832 'B<bool, String>', | 833 'B<bool, String>', |
| 833 'I<bool, List<String>>', | 834 'I<bool, List<String>>', |
| 834 'Object' | 835 'Object' |
| 835 ].toString(), | 836 ].toString(), |
| 836 asSortedStrings(supertypes).toString()); | 837 asSortedStrings(supertypes).toString()); |
| 837 }), | 838 }), |
| 838 MockCompiler.create((MockCompiler compiler) { | 839 MockCompiler.create((MockCompiler compiler) { |
| 839 compiler.parseScript("""class A<T> {} | 840 compiler.parseScript("""class A<T> {} |
| 840 class D extends A<E> {} | 841 class D extends A<E> {} |
| 841 class E extends D {} | 842 class E extends D {} |
| 842 main() { return new E(); }"""); | 843 main() { return new E(); }"""); |
| 843 FunctionElement mainElement = compiler.mainApp.find(MAIN); | 844 FunctionElement mainElement = compiler.mainApp.find(MAIN); |
| 844 compiler.resolver.resolve(mainElement); | 845 compiler.resolver.resolve(mainElement); |
| 845 DiagnosticCollector collector = compiler.diagnosticCollector; | 846 DiagnosticCollector collector = compiler.diagnosticCollector; |
| 846 Expect.equals(0, collector.warnings.length); | 847 Expect.equals(0, collector.warnings.length); |
| 847 Expect.equals(0, collector.errors.length); | 848 Expect.equals(0, collector.errors.length); |
| 848 ClassElement aElement = compiler.mainApp.find("E"); | 849 ClassElement aElement = compiler.mainApp.find("E"); |
| 849 Link<ResolutionDartType> supertypes = aElement.allSupertypes; | 850 Link<InterfaceType> supertypes = aElement.allSupertypes; |
| 850 Expect.equals(<String>['A<E>', 'D', 'Object'].toString(), | 851 Expect.equals(<String>['A<E>', 'D', 'Object'].toString(), |
| 851 asSortedStrings(supertypes).toString()); | 852 asSortedStrings(supertypes).toString()); |
| 852 }), | 853 }), |
| 853 MockCompiler.create((MockCompiler compiler) { | 854 MockCompiler.create((MockCompiler compiler) { |
| 854 compiler.parseScript("""class A<T> {} | 855 compiler.parseScript("""class A<T> {} |
| 855 class D extends A<int> implements A<double> {} | 856 class D extends A<int> implements A<double> {} |
| 856 main() { return new D(); }"""); | 857 main() { return new D(); }"""); |
| 857 FunctionElement mainElement = compiler.mainApp.find(MAIN); | 858 FunctionElement mainElement = compiler.mainApp.find(MAIN); |
| 858 compiler.resolver.resolve(mainElement); | 859 compiler.resolver.resolve(mainElement); |
| 859 DiagnosticCollector collector = compiler.diagnosticCollector; | 860 DiagnosticCollector collector = compiler.diagnosticCollector; |
| (...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1540 functionName: 'm'); | 1541 functionName: 'm'); |
| 1541 check( | 1542 check( |
| 1542 ''' | 1543 ''' |
| 1543 class A { | 1544 class A { |
| 1544 m() => () => await - 3; | 1545 m() => () => await - 3; |
| 1545 } | 1546 } |
| 1546 main() => new A().m(); | 1547 main() => new A().m(); |
| 1547 ''', | 1548 ''', |
| 1548 className: 'A'); | 1549 className: 'A'); |
| 1549 } | 1550 } |
| OLD | NEW |