| 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'; |
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 class H<T extends S, S extends T> {} | 550 class H<T extends S, S extends T> {} |
| 551 class I<T extends S, S extends U, U extends T> {} | 551 class I<T extends S, S extends U, U extends T> {} |
| 552 class J<T extends S, S extends U, U extends S> {} | 552 class J<T extends S, S extends U, U extends S> {} |
| 553 """).then((env) { | 553 """).then((env) { |
| 554 void expect(bool expectSubtype, DartType T, DartType S, | 554 void expect(bool expectSubtype, DartType T, DartType S, |
| 555 {bool expectMoreSpecific}) { | 555 {bool expectMoreSpecific}) { |
| 556 testTypes(env, T, S, expectSubtype, expectMoreSpecific); | 556 testTypes(env, T, S, expectSubtype, expectMoreSpecific); |
| 557 } | 557 } |
| 558 | 558 |
| 559 ClassElement A = env.getElement('A'); | 559 ClassElement A = env.getElement('A'); |
| 560 TypeVariableType A_T = A.thisType.typeArguments.head; | 560 TypeVariableType A_T = A.thisType.typeArguments[0]; |
| 561 ClassElement B = env.getElement('B'); | 561 ClassElement B = env.getElement('B'); |
| 562 TypeVariableType B_T = B.thisType.typeArguments.head; | 562 TypeVariableType B_T = B.thisType.typeArguments[0]; |
| 563 ClassElement C = env.getElement('C'); | 563 ClassElement C = env.getElement('C'); |
| 564 TypeVariableType C_T = C.thisType.typeArguments.head; | 564 TypeVariableType C_T = C.thisType.typeArguments[0]; |
| 565 ClassElement D = env.getElement('D'); | 565 ClassElement D = env.getElement('D'); |
| 566 TypeVariableType D_T = D.thisType.typeArguments.head; | 566 TypeVariableType D_T = D.thisType.typeArguments[0]; |
| 567 ClassElement E = env.getElement('E'); | 567 ClassElement E = env.getElement('E'); |
| 568 TypeVariableType E_T = E.thisType.typeArguments.head; | 568 TypeVariableType E_T = E.thisType.typeArguments[0]; |
| 569 TypeVariableType E_S = E.thisType.typeArguments.tail.head; | 569 TypeVariableType E_S = E.thisType.typeArguments[1]; |
| 570 ClassElement F = env.getElement('F'); | 570 ClassElement F = env.getElement('F'); |
| 571 TypeVariableType F_T = F.thisType.typeArguments.head; | 571 TypeVariableType F_T = F.thisType.typeArguments[0]; |
| 572 TypeVariableType F_S = F.thisType.typeArguments.tail.head; | 572 TypeVariableType F_S = F.thisType.typeArguments[1]; |
| 573 ClassElement G = env.getElement('G'); | 573 ClassElement G = env.getElement('G'); |
| 574 TypeVariableType G_T = G.thisType.typeArguments.head; | 574 TypeVariableType G_T = G.thisType.typeArguments[0]; |
| 575 ClassElement H = env.getElement('H'); | 575 ClassElement H = env.getElement('H'); |
| 576 TypeVariableType H_T = H.thisType.typeArguments.head; | 576 TypeVariableType H_T = H.thisType.typeArguments[0]; |
| 577 TypeVariableType H_S = H.thisType.typeArguments.tail.head; | 577 TypeVariableType H_S = H.thisType.typeArguments[1]; |
| 578 ClassElement I = env.getElement('I'); | 578 ClassElement I = env.getElement('I'); |
| 579 TypeVariableType I_T = I.thisType.typeArguments.head; | 579 TypeVariableType I_T = I.thisType.typeArguments[0]; |
| 580 TypeVariableType I_S = I.thisType.typeArguments.tail.head; | 580 TypeVariableType I_S = I.thisType.typeArguments[1]; |
| 581 TypeVariableType I_U = I.thisType.typeArguments.tail.tail.head; | 581 TypeVariableType I_U = I.thisType.typeArguments[2]; |
| 582 ClassElement J = env.getElement('J'); | 582 ClassElement J = env.getElement('J'); |
| 583 TypeVariableType J_T = J.thisType.typeArguments.head; | 583 TypeVariableType J_T = J.thisType.typeArguments[0]; |
| 584 TypeVariableType J_S = J.thisType.typeArguments.tail.head; | 584 TypeVariableType J_S = J.thisType.typeArguments[1]; |
| 585 TypeVariableType J_U = J.thisType.typeArguments.tail.tail.head; | 585 TypeVariableType J_U = J.thisType.typeArguments[2]; |
| 586 | 586 |
| 587 DartType Object_ = env['Object']; | 587 DartType Object_ = env['Object']; |
| 588 DartType num_ = env['num']; | 588 DartType num_ = env['num']; |
| 589 DartType int_ = env['int']; | 589 DartType int_ = env['int']; |
| 590 DartType String_ = env['String']; | 590 DartType String_ = env['String']; |
| 591 DartType dynamic_ = env['dynamic']; | 591 DartType dynamic_ = env['dynamic']; |
| 592 | 592 |
| 593 // class A<T> {} | 593 // class A<T> {} |
| 594 expect(true, A_T, Object_); | 594 expect(true, A_T, Object_); |
| 595 expect(false, A_T, num_); | 595 expect(false, A_T, num_); |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 748 expect(false, J_U, num_); | 748 expect(false, J_U, num_); |
| 749 expect(false, J_U, int_); | 749 expect(false, J_U, int_); |
| 750 expect(false, J_U, String_); | 750 expect(false, J_U, String_); |
| 751 expect(true, J_U, dynamic_); | 751 expect(true, J_U, dynamic_); |
| 752 expect(false, J_U, J_T); | 752 expect(false, J_U, J_T); |
| 753 expect(true, J_U, J_S); | 753 expect(true, J_U, J_S); |
| 754 expect(true, J_U, J_U); | 754 expect(true, J_U, J_U); |
| 755 expect(false, J_U, A_T); | 755 expect(false, J_U, A_T); |
| 756 })); | 756 })); |
| 757 } | 757 } |
| OLD | NEW |