| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 subtype_test; | 5 library subtype_test; |
| 6 | 6 |
| 7 import 'package:expect/expect.dart'; | 7 import 'package:expect/expect.dart'; |
| 8 import 'package:async_helper/async_helper.dart'; | 8 import 'package:async_helper/async_helper.dart'; |
| 9 import 'type_test_helper.dart'; | 9 import 'type_test_helper.dart'; |
| 10 import '../../../sdk/lib/_internal/compiler/implementation/dart_types.dart'; | 10 import '../../../sdk/lib/_internal/compiler/implementation/dart_types.dart'; |
| 11 import "../../../sdk/lib/_internal/compiler/implementation/elements/elements.dar
t" | 11 import "../../../sdk/lib/_internal/compiler/implementation/elements/elements.dar
t" |
| 12 show Element, ClassElement; | 12 show Element, ClassElement; |
| 13 import '../../../sdk/lib/_internal/compiler/implementation/util/util.dart' | |
| 14 show Link; | |
| 15 | 13 |
| 16 void main() { | 14 void main() { |
| 17 testInterface1(); | 15 testInterface1(); |
| 18 testInterface2(); | 16 testInterface2(); |
| 19 testGeneric(); | 17 testGeneric(); |
| 20 testMixin(); | 18 testMixin(); |
| 21 testFunction(); | 19 testFunction(); |
| 22 testTypeVariable(); | 20 testTypeVariable(); |
| 23 } | 21 } |
| 24 | 22 |
| (...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 // / \ \ | 716 // / \ \ |
| 719 // V X U | 717 // V X U |
| 720 // / | 718 // / |
| 721 // W | 719 // W |
| 722 | 720 |
| 723 DartType Object_ = env['Object']; | 721 DartType Object_ = env['Object']; |
| 724 DartType A = env['A']; | 722 DartType A = env['A']; |
| 725 DartType B = env['B']; | 723 DartType B = env['B']; |
| 726 DartType C = env['C']; | 724 DartType C = env['C']; |
| 727 ClassElement I = env.getElement('I'); | 725 ClassElement I = env.getElement('I'); |
| 728 DartType S = I.typeVariables.head; | 726 DartType S = I.typeVariables[0]; |
| 729 DartType T = I.typeVariables.tail.head; | 727 DartType T = I.typeVariables[1]; |
| 730 DartType U = I.typeVariables.tail.tail.head; | 728 DartType U = I.typeVariables[2]; |
| 731 DartType V = I.typeVariables.tail.tail.tail.head; | 729 DartType V = I.typeVariables[3]; |
| 732 DartType W = I.typeVariables.tail.tail.tail.tail.head; | 730 DartType W = I.typeVariables[4]; |
| 733 DartType X = I.typeVariables.tail.tail.tail.tail.tail.head; | 731 DartType X = I.typeVariables[5]; |
| 734 | 732 |
| 735 checkLub(DartType a, DartType b, DartType expectedLub) { | 733 checkLub(DartType a, DartType b, DartType expectedLub) { |
| 736 DartType lub = env.computeLeastUpperBound(a, b); | 734 DartType lub = env.computeLeastUpperBound(a, b); |
| 737 Expect.equals(expectedLub, lub, | 735 Expect.equals(expectedLub, lub, |
| 738 'Unexpected lub($a,$b) = $lub, expected $expectedLub'); | 736 'Unexpected lub($a,$b) = $lub, expected $expectedLub'); |
| 739 } | 737 } |
| 740 | 738 |
| 741 checkLub(Object_, Object_, Object_); | 739 checkLub(Object_, Object_, Object_); |
| 742 checkLub(Object_, A, Object_); | 740 checkLub(Object_, A, Object_); |
| 743 checkLub(Object_, B, Object_); | 741 checkLub(Object_, B, Object_); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 844 checkLub(X, S, Object_); | 842 checkLub(X, S, Object_); |
| 845 checkLub(X, T, T); | 843 checkLub(X, T, T); |
| 846 checkLub(X, U, B); | 844 checkLub(X, U, B); |
| 847 checkLub(X, V, T); | 845 checkLub(X, V, T); |
| 848 checkLub(X, W, T); | 846 checkLub(X, W, T); |
| 849 checkLub(X, X, X); | 847 checkLub(X, X, X); |
| 850 })); | 848 })); |
| 851 } | 849 } |
| 852 | 850 |
| 853 | 851 |
| OLD | NEW |