| 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 'package:compiler/implementation/dart_types.dart'; | 10 import 'package:compiler/implementation/dart_types.dart'; |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 | 249 |
| 250 checkMember(A, 'method', functionType: env.functionType(dynamic_, [])); | 250 checkMember(A, 'method', functionType: env.functionType(dynamic_, [])); |
| 251 checkMember(A, 'abstractMethod', | 251 checkMember(A, 'abstractMethod', |
| 252 functionType: env.functionType(dynamic_, [])); | 252 functionType: env.functionType(dynamic_, [])); |
| 253 checkMember(A, 'staticMethod', | 253 checkMember(A, 'staticMethod', |
| 254 checkType: CHECK_CLASS, | 254 checkType: CHECK_CLASS, |
| 255 isStatic: true, functionType: env.functionType(dynamic_, [])); | 255 isStatic: true, functionType: env.functionType(dynamic_, [])); |
| 256 | 256 |
| 257 ClassElement B = env.getElement('B'); | 257 ClassElement B = env.getElement('B'); |
| 258 InterfaceType B_this = B.thisType; | 258 InterfaceType B_this = B.thisType; |
| 259 TypeVariableType B_T = B_this.typeArguments.head; | 259 TypeVariableType B_T = B_this.typeArguments.first; |
| 260 checkMemberCount(B_this, 4 /*inherited*/ + 4 /*non-static declared*/, | 260 checkMemberCount(B_this, 4 /*inherited*/ + 4 /*non-static declared*/, |
| 261 interfaceMembers: true); | 261 interfaceMembers: true); |
| 262 checkMemberCount(B_this, 4 /*inherited*/ + 5 /*declared*/, | 262 checkMemberCount(B_this, 4 /*inherited*/ + 5 /*declared*/, |
| 263 interfaceMembers: false); | 263 interfaceMembers: false); |
| 264 | 264 |
| 265 checkMember(B_this, '==', inheritedFrom: Object_); | 265 checkMember(B_this, '==', inheritedFrom: Object_); |
| 266 checkMember(B_this, 'hashCode', inheritedFrom: Object_); | 266 checkMember(B_this, 'hashCode', inheritedFrom: Object_); |
| 267 checkMember(B_this, 'noSuchMethod', inheritedFrom: Object_); | 267 checkMember(B_this, 'noSuchMethod', inheritedFrom: Object_); |
| 268 checkMember(B_this, 'runtimeType', inheritedFrom: Object_); | 268 checkMember(B_this, 'runtimeType', inheritedFrom: Object_); |
| 269 | 269 |
| 270 checkMember(B_this, 'field', isGetter: true, | 270 checkMember(B_this, 'field', isGetter: true, |
| 271 type: B_T, functionType: env.functionType(B_T, [])); | 271 type: B_T, functionType: env.functionType(B_T, [])); |
| 272 checkMember(B_this, 'field', isSetter: true, | 272 checkMember(B_this, 'field', isSetter: true, |
| 273 type: B_T, functionType: env.functionType(void_, [B_T])); | 273 type: B_T, functionType: env.functionType(void_, [B_T])); |
| 274 checkMember(B_this, 'method', functionType: env.functionType(void_, [B_T])); | 274 checkMember(B_this, 'method', functionType: env.functionType(void_, [B_T])); |
| 275 checkMember(B_this, 'staticMethod', | 275 checkMember(B_this, 'staticMethod', |
| 276 checkType: CHECK_CLASS, | 276 checkType: CHECK_CLASS, |
| 277 isStatic: true, functionType: env.functionType(dynamic_, [])); | 277 isStatic: true, functionType: env.functionType(dynamic_, [])); |
| 278 checkMember(B_this, 'toString', | 278 checkMember(B_this, 'toString', |
| 279 functionType: env.functionType(dynamic_, [], | 279 functionType: env.functionType(dynamic_, [], |
| 280 optionalParameters: [B_T])); | 280 optionalParameters: [B_T])); |
| 281 | 281 |
| 282 ClassElement C = env.getElement('C'); | 282 ClassElement C = env.getElement('C'); |
| 283 InterfaceType C_this = C.thisType; | 283 InterfaceType C_this = C.thisType; |
| 284 TypeVariableType C_S = C_this.typeArguments.head; | 284 TypeVariableType C_S = C_this.typeArguments.first; |
| 285 checkMemberCount(C_this, 8 /*inherited*/, interfaceMembers: true); | 285 checkMemberCount(C_this, 8 /*inherited*/, interfaceMembers: true); |
| 286 checkMemberCount(C_this, 8 /*inherited*/, interfaceMembers: false); | 286 checkMemberCount(C_this, 8 /*inherited*/, interfaceMembers: false); |
| 287 InterfaceType B_S = instantiate(B, [C_S]); | 287 InterfaceType B_S = instantiate(B, [C_S]); |
| 288 | 288 |
| 289 checkMember(C_this, '==', inheritedFrom: Object_); | 289 checkMember(C_this, '==', inheritedFrom: Object_); |
| 290 checkMember(C_this, 'hashCode', inheritedFrom: Object_); | 290 checkMember(C_this, 'hashCode', inheritedFrom: Object_); |
| 291 checkMember(C_this, 'noSuchMethod', inheritedFrom: Object_); | 291 checkMember(C_this, 'noSuchMethod', inheritedFrom: Object_); |
| 292 checkMember(C_this, 'runtimeType', inheritedFrom: Object_); | 292 checkMember(C_this, 'runtimeType', inheritedFrom: Object_); |
| 293 | 293 |
| 294 checkMember(C_this, 'field', isGetter: true, | 294 checkMember(C_this, 'field', isGetter: true, |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 | 622 |
| 623 DynamicType dynamic_ = env['dynamic']; | 623 DynamicType dynamic_ = env['dynamic']; |
| 624 VoidType void_ = env['void']; | 624 VoidType void_ = env['void']; |
| 625 InterfaceType num_ = env['num']; | 625 InterfaceType num_ = env['num']; |
| 626 InterfaceType int_ = env['int']; | 626 InterfaceType int_ = env['int']; |
| 627 | 627 |
| 628 ClassElement A = env.getElement('A'); | 628 ClassElement A = env.getElement('A'); |
| 629 ClassElement B = env.getElement('B'); | 629 ClassElement B = env.getElement('B'); |
| 630 ClassElement C = env.getElement('C'); | 630 ClassElement C = env.getElement('C'); |
| 631 InterfaceType C_this = C.thisType; | 631 InterfaceType C_this = C.thisType; |
| 632 TypeVariableType C_U = C_this.typeArguments.head; | 632 TypeVariableType C_U = C_this.typeArguments[0]; |
| 633 TypeVariableType C_V = C_this.typeArguments.tail.head; | 633 TypeVariableType C_V = C_this.typeArguments[1]; |
| 634 InterfaceType A_U = instantiate(A, [C_U]); | 634 InterfaceType A_U = instantiate(A, [C_U]); |
| 635 InterfaceType B_V = instantiate(B, [C_V]); | 635 InterfaceType B_V = instantiate(B, [C_V]); |
| 636 | 636 |
| 637 // A: method1() | 637 // A: method1() |
| 638 // B: method1() | 638 // B: method1() |
| 639 // C class: method1() -- inherited from A. | 639 // C class: method1() -- inherited from A. |
| 640 // C interface: dynamic method1() -- synthesized from A and B. | 640 // C interface: dynamic method1() -- synthesized from A and B. |
| 641 MemberSignature interfaceMember = | 641 MemberSignature interfaceMember = |
| 642 checkMember(C_this, 'method1', checkType: CHECK_INTERFACE, | 642 checkMember(C_this, 'method1', checkType: CHECK_INTERFACE, |
| 643 synthesizedFrom: [A_U, B_V], | 643 synthesizedFrom: [A_U, B_V], |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 | 700 |
| 701 InterfaceType A = env['A']; | 701 InterfaceType A = env['A']; |
| 702 InterfaceType B = env['B']; | 702 InterfaceType B = env['B']; |
| 703 InterfaceType C = env['C']; | 703 InterfaceType C = env['C']; |
| 704 | 704 |
| 705 checkMember(C, 'm', checkType: NO_CLASS_MEMBER, | 705 checkMember(C, 'm', checkType: NO_CLASS_MEMBER, |
| 706 inheritedFrom: A, | 706 inheritedFrom: A, |
| 707 functionType: env.functionType(dynamic_ , [])); | 707 functionType: env.functionType(dynamic_ , [])); |
| 708 })); | 708 })); |
| 709 } | 709 } |
| OLD | NEW |