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