Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: tests/compiler/dart2js/members_test.dart

Issue 2000663002: Handle resolvedAst for forwarding constructors and callType on unnamed mixin applications. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Fix test. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/src/dart_types.dart'; 10 import 'package:compiler/src/dart_types.dart';
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 type: int_, functionType: env.functionType(int_, [])); 212 type: int_, functionType: env.functionType(int_, []));
213 checkMember(Object_, 'noSuchMethod', 213 checkMember(Object_, 'noSuchMethod',
214 functionType: env.functionType(dynamic_, [Invocation_])); 214 functionType: env.functionType(dynamic_, [Invocation_]));
215 checkMember(Object_, 'runtimeType', 215 checkMember(Object_, 'runtimeType',
216 isGetter: true, 216 isGetter: true,
217 type: Type_, functionType: env.functionType(Type_, [])); 217 type: Type_, functionType: env.functionType(Type_, []));
218 checkMember(Object_, 'toString', 218 checkMember(Object_, 'toString',
219 functionType: env.functionType(String_, [])); 219 functionType: env.functionType(String_, []));
220 220
221 InterfaceType A = env['A']; 221 InterfaceType A = env['A'];
222 MembersCreator.computeAllClassMembers(env.compiler, A.element); 222 MembersCreator.computeAllClassMembers(env.resolution, A.element);
223 223
224 checkMemberCount(A, 5 /*inherited*/ + 9 /*non-static declared*/, 224 checkMemberCount(A, 5 /*inherited*/ + 9 /*non-static declared*/,
225 interfaceMembers: true); 225 interfaceMembers: true);
226 checkMemberCount(A, 5 /*inherited*/ + 9 /*non-abstract declared*/ + 226 checkMemberCount(A, 5 /*inherited*/ + 9 /*non-abstract declared*/ +
227 3 /* abstract declared */, 227 3 /* abstract declared */,
228 interfaceMembers: false); 228 interfaceMembers: false);
229 229
230 checkMember(A, '==', inheritedFrom: Object_); 230 checkMember(A, '==', inheritedFrom: Object_);
231 checkMember(A, 'hashCode', inheritedFrom: Object_); 231 checkMember(A, 'hashCode', inheritedFrom: Object_);
232 checkMember(A, 'noSuchMethod', inheritedFrom: Object_); 232 checkMember(A, 'noSuchMethod', inheritedFrom: Object_);
(...skipping 24 matching lines...) Expand all
257 functionType: env.functionType(dynamic_, [dynamic_])); 257 functionType: env.functionType(dynamic_, [dynamic_]));
258 258
259 checkMember(A, 'method', functionType: env.functionType(dynamic_, [])); 259 checkMember(A, 'method', functionType: env.functionType(dynamic_, []));
260 checkMember(A, 'abstractMethod', 260 checkMember(A, 'abstractMethod',
261 functionType: env.functionType(dynamic_, [])); 261 functionType: env.functionType(dynamic_, []));
262 checkMember(A, 'staticMethod', 262 checkMember(A, 'staticMethod',
263 checkType: CHECK_CLASS, 263 checkType: CHECK_CLASS,
264 isStatic: true, functionType: env.functionType(dynamic_, [])); 264 isStatic: true, functionType: env.functionType(dynamic_, []));
265 265
266 ClassElement B = env.getElement('B'); 266 ClassElement B = env.getElement('B');
267 MembersCreator.computeAllClassMembers(env.compiler, B); 267 MembersCreator.computeAllClassMembers(env.resolution, B);
268 InterfaceType B_this = B.thisType; 268 InterfaceType B_this = B.thisType;
269 TypeVariableType B_T = B_this.typeArguments.first; 269 TypeVariableType B_T = B_this.typeArguments.first;
270 checkMemberCount(B_this, 4 /*inherited*/ + 4 /*non-static declared*/, 270 checkMemberCount(B_this, 4 /*inherited*/ + 4 /*non-static declared*/,
271 interfaceMembers: true); 271 interfaceMembers: true);
272 checkMemberCount(B_this, 4 /*inherited*/ + 5 /*declared*/, 272 checkMemberCount(B_this, 4 /*inherited*/ + 5 /*declared*/,
273 interfaceMembers: false); 273 interfaceMembers: false);
274 274
275 checkMember(B_this, '==', inheritedFrom: Object_); 275 checkMember(B_this, '==', inheritedFrom: Object_);
276 checkMember(B_this, 'hashCode', inheritedFrom: Object_); 276 checkMember(B_this, 'hashCode', inheritedFrom: Object_);
277 checkMember(B_this, 'noSuchMethod', inheritedFrom: Object_); 277 checkMember(B_this, 'noSuchMethod', inheritedFrom: Object_);
278 checkMember(B_this, 'runtimeType', inheritedFrom: Object_); 278 checkMember(B_this, 'runtimeType', inheritedFrom: Object_);
279 279
280 checkMember(B_this, 'field', isGetter: true, 280 checkMember(B_this, 'field', isGetter: true,
281 type: B_T, functionType: env.functionType(B_T, [])); 281 type: B_T, functionType: env.functionType(B_T, []));
282 checkMember(B_this, 'field', isSetter: true, 282 checkMember(B_this, 'field', isSetter: true,
283 type: B_T, functionType: env.functionType(void_, [B_T])); 283 type: B_T, functionType: env.functionType(void_, [B_T]));
284 checkMember(B_this, 'method', functionType: env.functionType(void_, [B_T])); 284 checkMember(B_this, 'method', functionType: env.functionType(void_, [B_T]));
285 checkMember(B_this, 'staticMethod', 285 checkMember(B_this, 'staticMethod',
286 checkType: CHECK_CLASS, 286 checkType: CHECK_CLASS,
287 isStatic: true, functionType: env.functionType(dynamic_, [])); 287 isStatic: true, functionType: env.functionType(dynamic_, []));
288 checkMember(B_this, 'toString', 288 checkMember(B_this, 'toString',
289 functionType: env.functionType(dynamic_, [], 289 functionType: env.functionType(dynamic_, [],
290 optionalParameters: [B_T])); 290 optionalParameters: [B_T]));
291 291
292 ClassElement C = env.getElement('C'); 292 ClassElement C = env.getElement('C');
293 MembersCreator.computeAllClassMembers(env.compiler, C); 293 MembersCreator.computeAllClassMembers(env.resolution, C);
294 InterfaceType C_this = C.thisType; 294 InterfaceType C_this = C.thisType;
295 TypeVariableType C_S = C_this.typeArguments.first; 295 TypeVariableType C_S = C_this.typeArguments.first;
296 checkMemberCount(C_this, 8 /*inherited*/, interfaceMembers: true); 296 checkMemberCount(C_this, 8 /*inherited*/, interfaceMembers: true);
297 checkMemberCount(C_this, 8 /*inherited*/, interfaceMembers: false); 297 checkMemberCount(C_this, 8 /*inherited*/, interfaceMembers: false);
298 InterfaceType B_S = instantiate(B, [C_S]); 298 InterfaceType B_S = instantiate(B, [C_S]);
299 299
300 checkMember(C_this, '==', inheritedFrom: Object_); 300 checkMember(C_this, '==', inheritedFrom: Object_);
301 checkMember(C_this, 'hashCode', inheritedFrom: Object_); 301 checkMember(C_this, 'hashCode', inheritedFrom: Object_);
302 checkMember(C_this, 'noSuchMethod', inheritedFrom: Object_); 302 checkMember(C_this, 'noSuchMethod', inheritedFrom: Object_);
303 checkMember(C_this, 'runtimeType', inheritedFrom: Object_); 303 checkMember(C_this, 'runtimeType', inheritedFrom: Object_);
304 304
305 checkMember(C_this, 'field', isGetter: true, 305 checkMember(C_this, 'field', isGetter: true,
306 declarer: B_S, 306 declarer: B_S,
307 type: C_S, functionType: env.functionType(C_S, [])); 307 type: C_S, functionType: env.functionType(C_S, []));
308 checkMember(C_this, 'field', isSetter: true, 308 checkMember(C_this, 'field', isSetter: true,
309 declarer: B_S, 309 declarer: B_S,
310 type: C_S, functionType: env.functionType(void_, [C_S])); 310 type: C_S, functionType: env.functionType(void_, [C_S]));
311 checkMember(C_this, 'method', 311 checkMember(C_this, 'method',
312 declarer: B_S, 312 declarer: B_S,
313 functionType: env.functionType(void_, [C_S])); 313 functionType: env.functionType(void_, [C_S]));
314 checkMember(C_this, 'toString', 314 checkMember(C_this, 'toString',
315 declarer: B_S, 315 declarer: B_S,
316 functionType: env.functionType(dynamic_, [], 316 functionType: env.functionType(dynamic_, [],
317 optionalParameters: [C_S])); 317 optionalParameters: [C_S]));
318 318
319 InterfaceType D = env['D']; 319 InterfaceType D = env['D'];
320 MembersCreator.computeAllClassMembers(env.compiler, D.element); 320 MembersCreator.computeAllClassMembers(env.resolution, D.element);
321 checkMemberCount(D, 8 /*inherited*/, interfaceMembers: true); 321 checkMemberCount(D, 8 /*inherited*/, interfaceMembers: true);
322 checkMemberCount(D, 8 /*inherited*/, interfaceMembers: false); 322 checkMemberCount(D, 8 /*inherited*/, interfaceMembers: false);
323 InterfaceType B_int = instantiate(B, [int_]); 323 InterfaceType B_int = instantiate(B, [int_]);
324 324
325 checkMember(D, '==', inheritedFrom: Object_); 325 checkMember(D, '==', inheritedFrom: Object_);
326 checkMember(D, 'hashCode', inheritedFrom: Object_); 326 checkMember(D, 'hashCode', inheritedFrom: Object_);
327 checkMember(D, 'noSuchMethod', inheritedFrom: Object_); 327 checkMember(D, 'noSuchMethod', inheritedFrom: Object_);
328 checkMember(D, 'runtimeType', inheritedFrom: Object_); 328 checkMember(D, 'runtimeType', inheritedFrom: Object_);
329 329
330 checkMember(D, 'field', isGetter: true, 330 checkMember(D, 'field', isGetter: true,
331 declarer: B_int, 331 declarer: B_int,
332 type: int_, functionType: env.functionType(int_, [])); 332 type: int_, functionType: env.functionType(int_, []));
333 checkMember(D, 'field', isSetter: true, 333 checkMember(D, 'field', isSetter: true,
334 declarer: B_int, 334 declarer: B_int,
335 type: int_, functionType: env.functionType(void_, [int_])); 335 type: int_, functionType: env.functionType(void_, [int_]));
336 checkMember(D, 'method', 336 checkMember(D, 'method',
337 declarer: B_int, 337 declarer: B_int,
338 functionType: env.functionType(void_, [int_])); 338 functionType: env.functionType(void_, [int_]));
339 checkMember(D, 'toString', 339 checkMember(D, 'toString',
340 declarer: B_int, 340 declarer: B_int,
341 functionType: env.functionType(dynamic_, [], 341 functionType: env.functionType(dynamic_, [],
342 optionalParameters: [int_])); 342 optionalParameters: [int_]));
343 343
344 InterfaceType E = env['E']; 344 InterfaceType E = env['E'];
345 MembersCreator.computeAllClassMembers(env.compiler, E.element); 345 MembersCreator.computeAllClassMembers(env.resolution, E.element);
346 checkMemberCount(E, 8 /*inherited*/, interfaceMembers: true); 346 checkMemberCount(E, 8 /*inherited*/, interfaceMembers: true);
347 checkMemberCount(E, 8 /*inherited*/, interfaceMembers: false); 347 checkMemberCount(E, 8 /*inherited*/, interfaceMembers: false);
348 348
349 checkMember(E, '==', inheritedFrom: Object_); 349 checkMember(E, '==', inheritedFrom: Object_);
350 checkMember(E, 'hashCode', inheritedFrom: Object_); 350 checkMember(E, 'hashCode', inheritedFrom: Object_);
351 checkMember(E, 'noSuchMethod', inheritedFrom: Object_); 351 checkMember(E, 'noSuchMethod', inheritedFrom: Object_);
352 checkMember(E, 'runtimeType', inheritedFrom: Object_); 352 checkMember(E, 'runtimeType', inheritedFrom: Object_);
353 353
354 checkMember(E, 'field', isGetter: true, 354 checkMember(E, 'field', isGetter: true,
355 declarer: B_int, 355 declarer: B_int,
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 VoidType void_ = env['void']; 418 VoidType void_ = env['void'];
419 InterfaceType num_ = env['num']; 419 InterfaceType num_ = env['num'];
420 InterfaceType int_ = env['int']; 420 InterfaceType int_ = env['int'];
421 421
422 InterfaceType A = env['A']; 422 InterfaceType A = env['A'];
423 InterfaceType B = env['B']; 423 InterfaceType B = env['B'];
424 InterfaceType C = env['C']; 424 InterfaceType C = env['C'];
425 InterfaceType D = env['D']; 425 InterfaceType D = env['D'];
426 426
427 // Ensure that members have been computed on all classes. 427 // Ensure that members have been computed on all classes.
428 MembersCreator.computeAllClassMembers(env.compiler, D.element); 428 MembersCreator.computeAllClassMembers(env.resolution, D.element);
429 429
430 // A: num method1() 430 // A: num method1()
431 // B: int method1() 431 // B: int method1()
432 // D: dynamic method1() -- synthesized from A and B. 432 // D: dynamic method1() -- synthesized from A and B.
433 checkMember(D, 'method1', 433 checkMember(D, 'method1',
434 synthesizedFrom: [A, B], 434 synthesizedFrom: [A, B],
435 functionType: env.functionType(dynamic_ , []), 435 functionType: env.functionType(dynamic_ , []),
436 checkType: NO_CLASS_MEMBER); 436 checkType: NO_CLASS_MEMBER);
437 437
438 // A: void method2() 438 // A: void method2()
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 DynamicType dynamic_ = env['dynamic']; 586 DynamicType dynamic_ = env['dynamic'];
587 VoidType void_ = env['void']; 587 VoidType void_ = env['void'];
588 InterfaceType num_ = env['num']; 588 InterfaceType num_ = env['num'];
589 InterfaceType int_ = env['int']; 589 InterfaceType int_ = env['int'];
590 590
591 InterfaceType A = env['A']; 591 InterfaceType A = env['A'];
592 InterfaceType B = env['B']; 592 InterfaceType B = env['B'];
593 InterfaceType C = env['C']; 593 InterfaceType C = env['C'];
594 594
595 // Ensure that members have been computed on all classes. 595 // Ensure that members have been computed on all classes.
596 MembersCreator.computeAllClassMembers(env.compiler, C.element); 596 MembersCreator.computeAllClassMembers(env.resolution, C.element);
597 597
598 // A: method1() 598 // A: method1()
599 // B: method1() 599 // B: method1()
600 // C class: method1() -- inherited from A. 600 // C class: method1() -- inherited from A.
601 // C interface: dynamic method1() -- synthesized from A and B. 601 // C interface: dynamic method1() -- synthesized from A and B.
602 MemberSignature interfaceMember = 602 MemberSignature interfaceMember =
603 checkMember(C, 'method1', checkType: CHECK_INTERFACE, 603 checkMember(C, 'method1', checkType: CHECK_INTERFACE,
604 synthesizedFrom: [A, B], 604 synthesizedFrom: [A, B],
605 functionType: env.functionType(dynamic_ , [])); 605 functionType: env.functionType(dynamic_ , []));
606 MemberSignature classMember = 606 MemberSignature classMember =
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 ClassElement A = env.getElement('A'); 647 ClassElement A = env.getElement('A');
648 ClassElement B = env.getElement('B'); 648 ClassElement B = env.getElement('B');
649 ClassElement C = env.getElement('C'); 649 ClassElement C = env.getElement('C');
650 InterfaceType C_this = C.thisType; 650 InterfaceType C_this = C.thisType;
651 TypeVariableType C_U = C_this.typeArguments[0]; 651 TypeVariableType C_U = C_this.typeArguments[0];
652 TypeVariableType C_V = C_this.typeArguments[1]; 652 TypeVariableType C_V = C_this.typeArguments[1];
653 InterfaceType A_U = instantiate(A, [C_U]); 653 InterfaceType A_U = instantiate(A, [C_U]);
654 InterfaceType B_V = instantiate(B, [C_V]); 654 InterfaceType B_V = instantiate(B, [C_V]);
655 655
656 // Ensure that members have been computed on all classes. 656 // Ensure that members have been computed on all classes.
657 MembersCreator.computeAllClassMembers(env.compiler, C); 657 MembersCreator.computeAllClassMembers(env.resolution, C);
658 658
659 // A: method1() 659 // A: method1()
660 // B: method1() 660 // B: method1()
661 // C class: method1() -- inherited from A. 661 // C class: method1() -- inherited from A.
662 // C interface: dynamic method1() -- synthesized from A and B. 662 // C interface: dynamic method1() -- synthesized from A and B.
663 MemberSignature interfaceMember = 663 MemberSignature interfaceMember =
664 checkMember(C_this, 'method1', checkType: CHECK_INTERFACE, 664 checkMember(C_this, 'method1', checkType: CHECK_INTERFACE,
665 synthesizedFrom: [A_U, B_V], 665 synthesizedFrom: [A_U, B_V],
666 functionType: env.functionType(dynamic_ , [])); 666 functionType: env.functionType(dynamic_ , []));
667 MemberSignature classMember = 667 MemberSignature classMember =
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 DynamicType dynamic_ = env['dynamic']; 718 DynamicType dynamic_ = env['dynamic'];
719 VoidType void_ = env['void']; 719 VoidType void_ = env['void'];
720 InterfaceType num_ = env['num']; 720 InterfaceType num_ = env['num'];
721 InterfaceType int_ = env['int']; 721 InterfaceType int_ = env['int'];
722 722
723 InterfaceType A = env['A']; 723 InterfaceType A = env['A'];
724 InterfaceType B = env['B']; 724 InterfaceType B = env['B'];
725 InterfaceType C = env['C']; 725 InterfaceType C = env['C'];
726 726
727 // Ensure that members have been computed on all classes. 727 // Ensure that members have been computed on all classes.
728 MembersCreator.computeAllClassMembers(env.compiler, C.element); 728 MembersCreator.computeAllClassMembers(env.resolution, C.element);
729 729
730 checkMember(C, 'm', checkType: NO_CLASS_MEMBER, 730 checkMember(C, 'm', checkType: NO_CLASS_MEMBER,
731 inheritedFrom: A, 731 inheritedFrom: A,
732 functionType: env.functionType(dynamic_ , [])); 732 functionType: env.functionType(dynamic_ , []));
733 })); 733 }));
734 } 734 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/diagnostic_reporter_helper.dart ('k') | tests/compiler/dart2js/override_inheritance_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698