OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 members_test; | 5 library members_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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 final finalField = 0; | 161 final finalField = 0; |
162 static var staticField; | 162 static var staticField; |
163 | 163 |
164 int get getter => 0; | 164 int get getter => 0; |
165 get abstractGetter; | 165 get abstractGetter; |
166 void set setter(int _) {} | 166 void set setter(int _) {} |
167 set abstractSetter(_); | 167 set abstractSetter(_); |
168 | 168 |
169 method() {} | 169 method() {} |
170 abstractMethod(); | 170 abstractMethod(); |
171 static staticMethod() {} | 171 static staticMethod() {} |
172 } | 172 } |
173 class B<T> { | 173 class B<T> { |
174 T field; | 174 T field; |
175 void method(T t) {} | 175 void method(T t) {} |
176 static staticMethod() {} | 176 static staticMethod() {} |
177 toString([T t]) {} | 177 toString([T t]) {} |
178 } | 178 } |
179 class C<S> extends B<S> {} | 179 class C<S> extends B<S> {} |
180 class D extends C<int> {} | 180 class D extends C<int> {} |
181 class E extends D {} | 181 class E extends D {} |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 })); | 551 })); |
552 } | 552 } |
553 | 553 |
554 void testClassVsInterfaceMembers() { | 554 void testClassVsInterfaceMembers() { |
555 asyncTest(() => TypeEnvironment.create(r""" | 555 asyncTest(() => TypeEnvironment.create(r""" |
556 class A { | 556 class A { |
557 method1() {} | 557 method1() {} |
558 method2() {} | 558 method2() {} |
559 } | 559 } |
560 abstract class B { | 560 abstract class B { |
561 method1(); | 561 method1(); |
562 method2(a); | 562 method2(a); |
563 } | 563 } |
564 abstract class C extends A implements B {} | 564 abstract class C extends A implements B {} |
565 """).then((env) { | 565 """).then((env) { |
566 | 566 |
567 InterfaceType dynamic_ = env['dynamic']; | 567 InterfaceType dynamic_ = env['dynamic']; |
568 VoidType void_ = env['void']; | 568 VoidType void_ = env['void']; |
569 InterfaceType num_ = env['num']; | 569 InterfaceType num_ = env['num']; |
570 InterfaceType int_ = env['int']; | 570 InterfaceType int_ = env['int']; |
571 | 571 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 | 603 |
604 void testMixinMembers() { | 604 void testMixinMembers() { |
605 asyncTest(() => TypeEnvironment.create(r""" | 605 asyncTest(() => TypeEnvironment.create(r""" |
606 class A<T> { | 606 class A<T> { |
607 method1() {} | 607 method1() {} |
608 method2() {} | 608 method2() {} |
609 method3(T a) {} | 609 method3(T a) {} |
610 method4(T a) {} | 610 method4(T a) {} |
611 } | 611 } |
612 abstract class B<S> { | 612 abstract class B<S> { |
613 method1(); | 613 method1(); |
614 method2(a); | 614 method2(a); |
615 method3(S a) {} | 615 method3(S a) {} |
616 } | 616 } |
617 abstract class C<U, V> extends Object with A<U> implements B<V> {} | 617 abstract class C<U, V> extends Object with A<U> implements B<V> {} |
618 """).then((env) { | 618 """).then((env) { |
619 | 619 |
620 InterfaceType dynamic_ = env['dynamic']; | 620 InterfaceType dynamic_ = env['dynamic']; |
621 VoidType void_ = env['void']; | 621 VoidType void_ = env['void']; |
622 InterfaceType num_ = env['num']; | 622 InterfaceType num_ = env['num']; |
623 InterfaceType int_ = env['int']; | 623 InterfaceType int_ = env['int']; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 Expect.notEquals(interfaceMember, classMember); | 672 Expect.notEquals(interfaceMember, classMember); |
673 | 673 |
674 // A: method4(U a) | 674 // A: method4(U a) |
675 // B: -- | 675 // B: -- |
676 // C class: method4(U a) -- inherited from A. | 676 // C class: method4(U a) -- inherited from A. |
677 // C interface: method4(U a) -- inherited from A. | 677 // C interface: method4(U a) -- inherited from A. |
678 checkMember(C_this, 'method4', checkType: ALSO_CLASS_MEMBER, | 678 checkMember(C_this, 'method4', checkType: ALSO_CLASS_MEMBER, |
679 inheritedFrom: A_U); | 679 inheritedFrom: A_U); |
680 })); | 680 })); |
681 } | 681 } |
OLD | NEW |