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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 } | 181 } |
182 class C<S> extends B<S> {} | 182 class C<S> extends B<S> {} |
183 class D extends C<int> {} | 183 class D extends C<int> {} |
184 class E extends D {} | 184 class E extends D {} |
185 """, useMockCompiler: false).then((env) { | 185 """, useMockCompiler: false).then((env) { |
186 | 186 |
187 InterfaceType bool_ = env['bool']; | 187 InterfaceType bool_ = env['bool']; |
188 InterfaceType String_ = env['String']; | 188 InterfaceType String_ = env['String']; |
189 InterfaceType num_ = env['num']; | 189 InterfaceType num_ = env['num']; |
190 InterfaceType int_ = env['int']; | 190 InterfaceType int_ = env['int']; |
191 InterfaceType dynamic_ = env['dynamic']; | 191 DynamicType dynamic_ = env['dynamic']; |
192 VoidType void_ = env['void']; | 192 VoidType void_ = env['void']; |
193 InterfaceType Type_ = env['Type']; | 193 InterfaceType Type_ = env['Type']; |
194 InterfaceType Invocation_ = env['Invocation']; | 194 InterfaceType Invocation_ = env['Invocation']; |
195 | 195 |
196 InterfaceType Object_ = env['Object']; | 196 InterfaceType Object_ = env['Object']; |
197 checkMemberCount(Object_, 5 /*declared*/, interfaceMembers: true); | 197 checkMemberCount(Object_, 5 /*declared*/, interfaceMembers: true); |
198 checkMemberCount(Object_, 5 /*declared*/, interfaceMembers: false); | 198 checkMemberCount(Object_, 5 /*declared*/, interfaceMembers: false); |
199 | 199 |
200 checkMember(Object_, '==', | 200 checkMember(Object_, '==', |
201 functionType: env.functionType(bool_, [dynamic_])); | 201 functionType: env.functionType(bool_, [dynamic_])); |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 void set setter3(int _); | 393 void set setter3(int _); |
394 getterAndMethod(); | 394 getterAndMethod(); |
395 } | 395 } |
396 abstract class C { | 396 abstract class C { |
397 int method3(); | 397 int method3(); |
398 num method4(); | 398 num method4(); |
399 } | 399 } |
400 abstract class D implements A, B, C {} | 400 abstract class D implements A, B, C {} |
401 """).then((env) { | 401 """).then((env) { |
402 | 402 |
403 InterfaceType dynamic_ = env['dynamic']; | 403 DynamicType dynamic_ = env['dynamic']; |
404 VoidType void_ = env['void']; | 404 VoidType void_ = env['void']; |
405 InterfaceType num_ = env['num']; | 405 InterfaceType num_ = env['num']; |
406 InterfaceType int_ = env['int']; | 406 InterfaceType int_ = env['int']; |
407 | 407 |
408 InterfaceType A = env['A']; | 408 InterfaceType A = env['A']; |
409 InterfaceType B = env['B']; | 409 InterfaceType B = env['B']; |
410 InterfaceType C = env['C']; | 410 InterfaceType C = env['C']; |
411 InterfaceType D = env['D']; | 411 InterfaceType D = env['D']; |
412 | 412 |
413 // A: num method1() | 413 // A: num method1() |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 method1() {} | 559 method1() {} |
560 method2() {} | 560 method2() {} |
561 } | 561 } |
562 abstract class B { | 562 abstract class B { |
563 method1(); | 563 method1(); |
564 method2(a); | 564 method2(a); |
565 } | 565 } |
566 abstract class C extends A implements B {} | 566 abstract class C extends A implements B {} |
567 """).then((env) { | 567 """).then((env) { |
568 | 568 |
569 InterfaceType dynamic_ = env['dynamic']; | 569 DynamicType dynamic_ = env['dynamic']; |
570 VoidType void_ = env['void']; | 570 VoidType void_ = env['void']; |
571 InterfaceType num_ = env['num']; | 571 InterfaceType num_ = env['num']; |
572 InterfaceType int_ = env['int']; | 572 InterfaceType int_ = env['int']; |
573 | 573 |
574 InterfaceType A = env['A']; | 574 InterfaceType A = env['A']; |
575 InterfaceType B = env['B']; | 575 InterfaceType B = env['B']; |
576 InterfaceType C = env['C']; | 576 InterfaceType C = env['C']; |
577 | 577 |
578 // A: method1() | 578 // A: method1() |
579 // B: method1() | 579 // B: method1() |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 method4(T a) {} | 612 method4(T a) {} |
613 } | 613 } |
614 abstract class B<S> { | 614 abstract class B<S> { |
615 method1(); | 615 method1(); |
616 method2(a); | 616 method2(a); |
617 method3(S a) {} | 617 method3(S a) {} |
618 } | 618 } |
619 abstract class C<U, V> extends Object with A<U> implements B<V> {} | 619 abstract class C<U, V> extends Object with A<U> implements B<V> {} |
620 """).then((env) { | 620 """).then((env) { |
621 | 621 |
622 InterfaceType dynamic_ = env['dynamic']; | 622 DynamicType dynamic_ = env['dynamic']; |
623 VoidType void_ = env['void']; | 623 VoidType void_ = env['void']; |
624 InterfaceType num_ = env['num']; | 624 InterfaceType num_ = env['num']; |
625 InterfaceType int_ = env['int']; | 625 InterfaceType int_ = env['int']; |
626 | 626 |
627 ClassElement A = env.getElement('A'); | 627 ClassElement A = env.getElement('A'); |
628 ClassElement B = env.getElement('B'); | 628 ClassElement B = env.getElement('B'); |
629 ClassElement C = env.getElement('C'); | 629 ClassElement C = env.getElement('C'); |
630 InterfaceType C_this = C.thisType; | 630 InterfaceType C_this = C.thisType; |
631 TypeVariableType C_U = C_this.typeArguments.head; | 631 TypeVariableType C_U = C_this.typeArguments.head; |
632 TypeVariableType C_V = C_this.typeArguments.tail.head; | 632 TypeVariableType C_V = C_this.typeArguments.tail.head; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 Expect.notEquals(interfaceMember, classMember); | 674 Expect.notEquals(interfaceMember, classMember); |
675 | 675 |
676 // A: method4(U a) | 676 // A: method4(U a) |
677 // B: -- | 677 // B: -- |
678 // C class: method4(U a) -- inherited from A. | 678 // C class: method4(U a) -- inherited from A. |
679 // C interface: method4(U a) -- inherited from A. | 679 // C interface: method4(U a) -- inherited from A. |
680 checkMember(C_this, 'method4', checkType: ALSO_CLASS_MEMBER, | 680 checkMember(C_this, 'method4', checkType: ALSO_CLASS_MEMBER, |
681 inheritedFrom: A_U); | 681 inheritedFrom: A_U); |
682 })); | 682 })); |
683 } | 683 } |
OLD | NEW |