| 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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 checkMember(A, 'method', functionType: env.functionType(dynamic_, [])); | 246 checkMember(A, 'method', functionType: env.functionType(dynamic_, [])); |
| 247 checkMember(A, 'abstractMethod', | 247 checkMember(A, 'abstractMethod', |
| 248 checkType: NO_CLASS_MEMBER, | 248 checkType: NO_CLASS_MEMBER, |
| 249 functionType: env.functionType(dynamic_, [])); | 249 functionType: env.functionType(dynamic_, [])); |
| 250 checkMember(A, 'staticMethod', | 250 checkMember(A, 'staticMethod', |
| 251 checkType: CHECK_CLASS, | 251 checkType: CHECK_CLASS, |
| 252 isStatic: true, functionType: env.functionType(dynamic_, [])); | 252 isStatic: true, functionType: env.functionType(dynamic_, [])); |
| 253 | 253 |
| 254 ClassElement B = env.getElement('B'); | 254 ClassElement B = env.getElement('B'); |
| 255 InterfaceType B_this = B.thisType; | 255 InterfaceType B_this = B.thisType; |
| 256 TypeVariableType B_T = B_this.typeArguments.head; | 256 TypeVariableType B_T = B_this.typeArguments.first; |
| 257 checkMemberCount(B_this, 4 /*inherited*/ + 4 /*non-static declared*/, | 257 checkMemberCount(B_this, 4 /*inherited*/ + 4 /*non-static declared*/, |
| 258 interfaceMembers: true); | 258 interfaceMembers: true); |
| 259 checkMemberCount(B_this, 4 /*inherited*/ + 5 /*declared*/, | 259 checkMemberCount(B_this, 4 /*inherited*/ + 5 /*declared*/, |
| 260 interfaceMembers: false); | 260 interfaceMembers: false); |
| 261 | 261 |
| 262 checkMember(B_this, '==', inheritedFrom: Object_); | 262 checkMember(B_this, '==', inheritedFrom: Object_); |
| 263 checkMember(B_this, 'hashCode', inheritedFrom: Object_); | 263 checkMember(B_this, 'hashCode', inheritedFrom: Object_); |
| 264 checkMember(B_this, 'noSuchMethod', inheritedFrom: Object_); | 264 checkMember(B_this, 'noSuchMethod', inheritedFrom: Object_); |
| 265 checkMember(B_this, 'runtimeType', inheritedFrom: Object_); | 265 checkMember(B_this, 'runtimeType', inheritedFrom: Object_); |
| 266 | 266 |
| 267 checkMember(B_this, 'field', isGetter: true, | 267 checkMember(B_this, 'field', isGetter: true, |
| 268 type: B_T, functionType: env.functionType(B_T, [])); | 268 type: B_T, functionType: env.functionType(B_T, [])); |
| 269 checkMember(B_this, 'field', isSetter: true, | 269 checkMember(B_this, 'field', isSetter: true, |
| 270 type: B_T, functionType: env.functionType(void_, [B_T])); | 270 type: B_T, functionType: env.functionType(void_, [B_T])); |
| 271 checkMember(B_this, 'method', functionType: env.functionType(void_, [B_T])); | 271 checkMember(B_this, 'method', functionType: env.functionType(void_, [B_T])); |
| 272 checkMember(B_this, 'staticMethod', | 272 checkMember(B_this, 'staticMethod', |
| 273 checkType: CHECK_CLASS, | 273 checkType: CHECK_CLASS, |
| 274 isStatic: true, functionType: env.functionType(dynamic_, [])); | 274 isStatic: true, functionType: env.functionType(dynamic_, [])); |
| 275 checkMember(B_this, 'toString', | 275 checkMember(B_this, 'toString', |
| 276 functionType: env.functionType(dynamic_, [], | 276 functionType: env.functionType(dynamic_, [], |
| 277 optionalParameters: [B_T])); | 277 optionalParameters: [B_T])); |
| 278 | 278 |
| 279 ClassElement C = env.getElement('C'); | 279 ClassElement C = env.getElement('C'); |
| 280 InterfaceType C_this = C.thisType; | 280 InterfaceType C_this = C.thisType; |
| 281 TypeVariableType C_S = C_this.typeArguments.head; | 281 TypeVariableType C_S = C_this.typeArguments.first; |
| 282 checkMemberCount(C_this, 8 /*inherited*/, interfaceMembers: true); | 282 checkMemberCount(C_this, 8 /*inherited*/, interfaceMembers: true); |
| 283 checkMemberCount(C_this, 8 /*inherited*/, interfaceMembers: false); | 283 checkMemberCount(C_this, 8 /*inherited*/, interfaceMembers: false); |
| 284 InterfaceType B_S = instantiate(B, [C_S]); | 284 InterfaceType B_S = instantiate(B, [C_S]); |
| 285 | 285 |
| 286 checkMember(C_this, '==', inheritedFrom: Object_); | 286 checkMember(C_this, '==', inheritedFrom: Object_); |
| 287 checkMember(C_this, 'hashCode', inheritedFrom: Object_); | 287 checkMember(C_this, 'hashCode', inheritedFrom: Object_); |
| 288 checkMember(C_this, 'noSuchMethod', inheritedFrom: Object_); | 288 checkMember(C_this, 'noSuchMethod', inheritedFrom: Object_); |
| 289 checkMember(C_this, 'runtimeType', inheritedFrom: Object_); | 289 checkMember(C_this, 'runtimeType', inheritedFrom: Object_); |
| 290 | 290 |
| 291 checkMember(C_this, 'field', isGetter: true, | 291 checkMember(C_this, 'field', isGetter: true, |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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']; |
| 624 | 624 |
| 625 ClassElement A = env.getElement('A'); | 625 ClassElement A = env.getElement('A'); |
| 626 ClassElement B = env.getElement('B'); | 626 ClassElement B = env.getElement('B'); |
| 627 ClassElement C = env.getElement('C'); | 627 ClassElement C = env.getElement('C'); |
| 628 InterfaceType C_this = C.thisType; | 628 InterfaceType C_this = C.thisType; |
| 629 TypeVariableType C_U = C_this.typeArguments.head; | 629 TypeVariableType C_U = C_this.typeArguments[0]; |
| 630 TypeVariableType C_V = C_this.typeArguments.tail.head; | 630 TypeVariableType C_V = C_this.typeArguments[1]; |
| 631 InterfaceType A_U = instantiate(A, [C_U]); | 631 InterfaceType A_U = instantiate(A, [C_U]); |
| 632 InterfaceType B_V = instantiate(B, [C_V]); | 632 InterfaceType B_V = instantiate(B, [C_V]); |
| 633 | 633 |
| 634 // A: method1() | 634 // A: method1() |
| 635 // B: method1() | 635 // B: method1() |
| 636 // C class: method1() -- inherited from A. | 636 // C class: method1() -- inherited from A. |
| 637 // C interface: dynamic method1() -- synthesized from A and B. | 637 // C interface: dynamic method1() -- synthesized from A and B. |
| 638 MemberSignature interfaceMember = | 638 MemberSignature interfaceMember = |
| 639 checkMember(C_this, 'method1', checkType: CHECK_INTERFACE, | 639 checkMember(C_this, 'method1', checkType: CHECK_INTERFACE, |
| 640 synthesizedFrom: [A_U, B_V], | 640 synthesizedFrom: [A_U, B_V], |
| (...skipping 31 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 |