| 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'; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 class B<S> extends A<A<S>> { | 23 class B<S> extends A<A<S>> { |
| 24 S bar; | 24 S bar; |
| 25 } | 25 } |
| 26 class C<U> extends B<String> with D<B<U>> { | 26 class C<U> extends B<String> with D<B<U>> { |
| 27 U baz; | 27 U baz; |
| 28 } | 28 } |
| 29 class D<V> { | 29 class D<V> { |
| 30 V boz; | 30 V boz; |
| 31 } | 31 } |
| 32 """).then((env) { | 32 """).then((env) { |
| 33 void expect(DartType receiverType, String memberName, | 33 void expect(InterfaceType receiverType, String memberName, |
| 34 DartType expectedType) { | 34 DartType expectedType) { |
| 35 Member member = receiverType.lookupMember(memberName); | 35 InterfaceTypeMember member = receiverType.lookupMember(memberName); |
| 36 Expect.isNotNull(member); | 36 Expect.isNotNull(member); |
| 37 DartType memberType = member.computeType(env.compiler); | 37 DartType memberType = member.computeType(env.compiler); |
| 38 Expect.equals(expectedType, memberType, | 38 Expect.equals(expectedType, memberType, |
| 39 'Wrong member type for $receiverType.$memberName.'); | 39 'Wrong member type for $receiverType.$memberName.'); |
| 40 } | 40 } |
| 41 | 41 |
| 42 DartType int_ = env['int']; | 42 DartType int_ = env['int']; |
| 43 DartType String_ = env['String']; | 43 DartType String_ = env['String']; |
| 44 | 44 |
| 45 ClassElement A = env.getElement('A'); | 45 ClassElement A = env.getElement('A'); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 69 expect(C_U, 'boz', instantiate(B, [U])); | 69 expect(C_U, 'boz', instantiate(B, [U])); |
| 70 | 70 |
| 71 DartType C_int = instantiate(C, [int_]); | 71 DartType C_int = instantiate(C, [int_]); |
| 72 expect(C_int, 'foo', instantiate(A, [String_])); | 72 expect(C_int, 'foo', instantiate(A, [String_])); |
| 73 expect(C_int, 'bar', String_); | 73 expect(C_int, 'bar', String_); |
| 74 expect(C_int, 'baz', int_); | 74 expect(C_int, 'baz', int_); |
| 75 expect(C_int, 'boz', instantiate(B, [int_])); | 75 expect(C_int, 'boz', instantiate(B, [int_])); |
| 76 })); | 76 })); |
| 77 } | 77 } |
| 78 | 78 |
| OLD | NEW |