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

Side by Side Diff: test/checker/checker_test.dart

Issue 1052383003: Disable closure wrapping by default (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 8 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
« no previous file with comments | « lib/src/options.dart ('k') | test/dart_codegen/expect/_internal/iterable.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 /// General type checking tests 5 /// General type checking tests
6 library dev_compiler.test.checker_test; 6 library dev_compiler.test.checker_test;
7 7
8 import 'package:unittest/unittest.dart'; 8 import 'package:unittest/unittest.dart';
9 9
10 import 'package:dev_compiler/src/testing.dart'; 10 import 'package:dev_compiler/src/testing.dart';
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 int left(int x) => x; 379 int left(int x) => x;
380 Object right(Object x) => x; 380 Object right(Object x) => x;
381 int _bot(Object x) => /*warning:DownCastImplicit*/x; 381 int _bot(Object x) => /*warning:DownCastImplicit*/x;
382 int bot(Object x) => x as int; 382 int bot(Object x) => x as int;
383 383
384 void main() { 384 void main() {
385 { // Check typedef equality 385 { // Check typedef equality
386 Left f = left; 386 Left f = left;
387 Left2 g = f; 387 Left2 g = f;
388 } 388 }
389 // TODO(leafp) Decide on ClosureWrap vs DownCast (or error).
390 { 389 {
391 Top f; 390 Top f;
392 f = top; 391 f = top;
393 f = left; 392 f = left;
394 f = right; 393 f = right;
395 f = bot; 394 f = bot;
396 } 395 }
397 { 396 {
398 Left f; 397 Left f;
399 f = /*warning:ClosureWrap*/top; 398 f = /*warning:DownCastComposite*/top;
400 f = left; 399 f = left;
401 f = /*warning:ClosureWrap*/right; // Should we reject this? 400 f = /*warning:DownCastComposite*/right; // Should we reject this?
402 f = bot; 401 f = bot;
403 } 402 }
404 { 403 {
405 Right f; 404 Right f;
406 f = /*warning:ClosureWrap*/top; 405 f = /*warning:DownCastComposite*/top;
407 f = /*warning:ClosureWrap*/left; // Should we reject this? 406 f = /*warning:DownCastComposite*/left; // Should we reject this?
408 f = right; 407 f = right;
409 f = bot; 408 f = bot;
410 } 409 }
411 { 410 {
412 Bot f; 411 Bot f;
413 f = /*warning:ClosureWrap*/top; 412 f = /*warning:DownCastComposite*/top;
414 f = /*warning:ClosureWrap*/left; 413 f = /*warning:DownCastComposite*/left;
415 f = /*warning:ClosureWrap*/right; 414 f = /*warning:DownCastComposite*/right;
416 f = bot; 415 f = bot;
417 } 416 }
418 } 417 }
419 ''' 418 '''
420 }); 419 });
421 }); 420 });
422 421
423 test('Function typing and subtyping: classes', () { 422 test('Function typing and subtyping: classes', () {
424 testChecker({ 423 testChecker({
425 '/main.dart': ''' 424 '/main.dart': '''
(...skipping 20 matching lines...) Expand all
446 } 445 }
447 { 446 {
448 Top f; 447 Top f;
449 f = top; 448 f = top;
450 f = left; 449 f = left;
451 f = right; 450 f = right;
452 f = bot; 451 f = bot;
453 } 452 }
454 { 453 {
455 Left f; 454 Left f;
456 f = /*warning:ClosureWrap*/top; 455 f = /*warning:DownCastComposite*/top;
457 f = left; 456 f = left;
458 f = /*warning:ClosureWrap*/right; // Should we reject this? 457 f = /*warning:DownCastComposite*/right; // Should we reject this?
459 f = bot; 458 f = bot;
460 } 459 }
461 { 460 {
462 Right f; 461 Right f;
463 f = /*warning:ClosureWrap*/top; 462 f = /*warning:DownCastComposite*/top;
464 f = /*warning:ClosureWrap*/left; // Should we reject this? 463 f = /*warning:DownCastComposite*/left; // Should we reject this?
465 f = right; 464 f = right;
466 f = bot; 465 f = bot;
467 } 466 }
468 { 467 {
469 Bot f; 468 Bot f;
470 f = /*warning:ClosureWrap*/top; 469 f = /*warning:DownCastComposite*/top;
471 f = /*warning:ClosureWrap*/left; 470 f = /*warning:DownCastComposite*/left;
472 f = /*warning:ClosureWrap*/right; 471 f = /*warning:DownCastComposite*/right;
473 f = bot; 472 f = bot;
474 } 473 }
475 } 474 }
476 ''' 475 '''
477 }); 476 });
478 }); 477 });
479 478
480 test('Function typing and subtyping: dynamic', () { 479 test('Function typing and subtyping: dynamic', () {
481 testChecker({ 480 testChecker({
482 '/main.dart': ''' 481 '/main.dart': '''
(...skipping 13 matching lines...) Expand all
496 void main() { 495 void main() {
497 { 496 {
498 Top f; 497 Top f;
499 f = top; 498 f = top;
500 f = left; 499 f = left;
501 f = right; 500 f = right;
502 f = bot; 501 f = bot;
503 } 502 }
504 { 503 {
505 Left f; 504 Left f;
506 f = /*warning:ClosureWrap*/top; 505 f = /*warning:DownCastComposite*/top;
507 f = left; 506 f = left;
508 f = /*warning:ClosureWrap*/right; 507 f = /*warning:DownCastComposite*/right;
509 f = bot; 508 f = bot;
510 } 509 }
511 { 510 {
512 Right f; 511 Right f;
513 f = /*warning:ClosureWrap*/top; 512 f = /*warning:DownCastComposite*/top;
514 f = /*warning:ClosureWrap*/left; 513 f = /*warning:DownCastComposite*/left;
515 f = right; 514 f = right;
516 f = bot; 515 f = bot;
517 } 516 }
518 { 517 {
519 Bottom f; 518 Bottom f;
520 f = /*warning:ClosureWrap*/top; 519 f = /*warning:DownCastComposite*/top;
521 f = /*warning:ClosureWrap*/left; 520 f = /*warning:DownCastComposite*/left;
522 f = /*warning:ClosureWrap*/right; 521 f = /*warning:DownCastComposite*/right;
523 f = bot; 522 f = bot;
524 } 523 }
525 } 524 }
526 ''' 525 '''
527 }); 526 });
528 }); 527 });
529 528
530 test('Function typing and subtyping: function literal variance', () { 529 test('Function typing and subtyping: function literal variance', () {
531 testChecker({ 530 testChecker({
532 '/main.dart': ''' 531 '/main.dart': '''
(...skipping 11 matching lines...) Expand all
544 void main() { 543 void main() {
545 { 544 {
546 Function2<B, A> f; 545 Function2<B, A> f;
547 f = top; 546 f = top;
548 f = left; 547 f = left;
549 f = right; 548 f = right;
550 f = bot; 549 f = bot;
551 } 550 }
552 { 551 {
553 Function2<B, B> f; 552 Function2<B, B> f;
554 f = /*warning:ClosureWrap*/top; 553 f = /*warning:DownCastComposite*/top;
555 f = left; 554 f = left;
556 f = /*warning:ClosureWrap*/right; // Should we reject this? 555 f = /*warning:DownCastComposite*/right; // Should we reject this?
557 f = bot; 556 f = bot;
558 } 557 }
559 { 558 {
560 Function2<A, A> f; 559 Function2<A, A> f;
561 f = /*warning:ClosureWrap*/top; 560 f = /*warning:DownCastComposite*/top;
562 f = /*warning:ClosureWrap*/left; // Should we reject this? 561 f = /*warning:DownCastComposite*/left; // Should we reject this?
563 f = right; 562 f = right;
564 f = bot; 563 f = bot;
565 } 564 }
566 { 565 {
567 Function2<A, B> f; 566 Function2<A, B> f;
568 f = /*warning:ClosureWrap*/top; 567 f = /*warning:DownCastComposite*/top;
569 f = /*warning:ClosureWrap*/left; 568 f = /*warning:DownCastComposite*/left;
570 f = /*warning:ClosureWrap*/right; 569 f = /*warning:DownCastComposite*/right;
571 f = bot; 570 f = bot;
572 } 571 }
573 } 572 }
574 ''' 573 '''
575 }); 574 });
576 }); 575 });
577 576
578 test('Function typing and subtyping: function variable variance', () { 577 test('Function typing and subtyping: function variable variance', () {
579 testChecker({ 578 testChecker({
580 '/main.dart': ''' 579 '/main.dart': '''
581 580
582 class A {} 581 class A {}
583 class B extends A {} 582 class B extends A {}
584 583
585 typedef T Function2<S, T>(S z); 584 typedef T Function2<S, T>(S z);
586 585
587 void main() { 586 void main() {
588 { 587 {
589 Function2<B, A> top; 588 Function2<B, A> top;
590 Function2<B, B> left; 589 Function2<B, B> left;
591 Function2<A, A> right; 590 Function2<A, A> right;
592 Function2<A, B> bot; 591 Function2<A, B> bot;
593 592
594 top = right; 593 top = right;
595 top = bot; 594 top = bot;
596 top = top; 595 top = top;
597 top = left; 596 top = left;
598 597
599 left = /*warning:ClosureWrap*/top; 598 left = /*warning:DownCastComposite*/top;
600 left = left; 599 left = left;
601 left = /*warning:ClosureWrap*/right; // Should we reject this? 600 left = /*warning:DownCastComposite*/right; // Should we reject this?
602 left = bot; 601 left = bot;
603 602
604 right = /*warning:ClosureWrap*/top; 603 right = /*warning:DownCastComposite*/top;
605 right = /*warning:ClosureWrap*/left; // Should we reject this? 604 right = /*warning:DownCastComposite*/left; // Should we reject this?
606 right = right; 605 right = right;
607 right = bot; 606 right = bot;
608 607
609 bot = /*warning:ClosureWrap*/top; 608 bot = /*warning:DownCastComposite*/top;
610 bot = /*warning:ClosureWrap*/left; 609 bot = /*warning:DownCastComposite*/left;
611 bot = /*warning:ClosureWrap*/right; 610 bot = /*warning:DownCastComposite*/right;
612 bot = bot; 611 bot = bot;
613 } 612 }
614 } 613 }
615 ''' 614 '''
616 }); 615 });
617 }); 616 });
618 617
619 test('Function typing and subtyping: higher order function literals', () { 618 test('Function typing and subtyping: higher order function literals', () {
620 testChecker({ 619 testChecker({
621 '/main.dart': ''' 620 '/main.dart': '''
622 621
623 class A {} 622 class A {}
624 class B extends A {} 623 class B extends A {}
625 624
626 typedef T Function2<S, T>(S z); 625 typedef T Function2<S, T>(S z);
627 626
628 typedef A BToA(B x); // Top of the base lattice 627 typedef A BToA(B x); // Top of the base lattice
629 typedef B AToB(A x); // Bot of the base lattice 628 typedef B AToB(A x); // Bot of the base lattice
630 629
631 BToA top(AToB f) => f; 630 BToA top(AToB f) => f;
632 AToB left(AToB f) => f; 631 AToB left(AToB f) => f;
633 BToA right(BToA f) => f; 632 BToA right(BToA f) => f;
634 AToB _bot(BToA f) => /*warning:ClosureWrap*/f; 633 AToB _bot(BToA f) => /*warning:DownCastComposite*/f;
635 AToB bot(BToA f) => f as AToB; 634 AToB bot(BToA f) => f as AToB;
636 635
637 Function2<B, A> top(AToB f) => f; 636 Function2<B, A> top(AToB f) => f;
638 Function2<A, B> left(AToB f) => f; 637 Function2<A, B> left(AToB f) => f;
639 Function2<B, A> right(BToA f) => f; 638 Function2<B, A> right(BToA f) => f;
640 Function2<A, B> _bot(BToA f) => /*warning:ClosureWrap*/f; 639 Function2<A, B> _bot(BToA f) => /*warning:DownCastComposite*/f;
641 Function2<A, B> bot(BToA f) => f as Function2<A, B>; 640 Function2<A, B> bot(BToA f) => f as Function2<A, B>;
642 641
643 642
644 BToA top(Function2<A, B> f) => f; 643 BToA top(Function2<A, B> f) => f;
645 AToB left(Function2<A, B> f) => f; 644 AToB left(Function2<A, B> f) => f;
646 BToA right(Function2<B, A> f) => f; 645 BToA right(Function2<B, A> f) => f;
647 AToB _bot(Function2<B, A> f) => /*warning:ClosureWrap*/f; 646 AToB _bot(Function2<B, A> f) => /*warning:DownCastComposite*/f;
648 AToB bot(Function2<B, A> f) => f as AToB; 647 AToB bot(Function2<B, A> f) => f as AToB;
649 648
650 void main() { 649 void main() {
651 { 650 {
652 Function2<AToB, BToA> f; // Top 651 Function2<AToB, BToA> f; // Top
653 f = top; 652 f = top;
654 f = left; 653 f = left;
655 f = right; 654 f = right;
656 f = bot; 655 f = bot;
657 } 656 }
658 { 657 {
659 Function2<AToB, AToB> f; // Left 658 Function2<AToB, AToB> f; // Left
660 f = /*warning:ClosureWrap*/top; 659 f = /*warning:DownCastComposite*/top;
661 f = left; 660 f = left;
662 f = /*warning:ClosureWrap*/right; // Should we reject this? 661 f = /*warning:DownCastComposite*/right; // Should we reject this?
663 f = bot; 662 f = bot;
664 } 663 }
665 { 664 {
666 Function2<BToA, BToA> f; // Right 665 Function2<BToA, BToA> f; // Right
667 f = /*warning:ClosureWrap*/top; 666 f = /*warning:DownCastComposite*/top;
668 f = /*warning:ClosureWrap*/left; // Should we reject this? 667 f = /*warning:DownCastComposite*/left; // Should we reject this?
669 f = right; 668 f = right;
670 f = bot; 669 f = bot;
671 } 670 }
672 { 671 {
673 Function2<BToA, AToB> f; // Bot 672 Function2<BToA, AToB> f; // Bot
674 f = bot; 673 f = bot;
675 f = /*warning:ClosureWrap*/left; 674 f = /*warning:DownCastComposite*/left;
676 f = /*warning:ClosureWrap*/top; 675 f = /*warning:DownCastComposite*/top;
677 f = /*warning:ClosureWrap*/left; 676 f = /*warning:DownCastComposite*/left;
678 } 677 }
679 } 678 }
680 ''' 679 '''
681 }); 680 });
682 }); 681 });
683 682
684 test('Function typing and subtyping: higher order function variables', () { 683 test('Function typing and subtyping: higher order function variables', () {
685 testChecker({ 684 testChecker({
686 '/main.dart': ''' 685 '/main.dart': '''
687 686
688 class A {} 687 class A {}
689 class B extends A {} 688 class B extends A {}
690 689
691 typedef T Function2<S, T>(S z); 690 typedef T Function2<S, T>(S z);
692 691
693 void main() { 692 void main() {
694 { 693 {
695 Function2<Function2<A, B>, Function2<B, A>> top; 694 Function2<Function2<A, B>, Function2<B, A>> top;
696 Function2<Function2<B, A>, Function2<B, A>> right; 695 Function2<Function2<B, A>, Function2<B, A>> right;
697 Function2<Function2<A, B>, Function2<A, B>> left; 696 Function2<Function2<A, B>, Function2<A, B>> left;
698 Function2<Function2<B, A>, Function2<A, B>> bot; 697 Function2<Function2<B, A>, Function2<A, B>> bot;
699 698
700 top = right; 699 top = right;
701 top = bot; 700 top = bot;
702 top = top; 701 top = top;
703 top = left; 702 top = left;
704 703
705 left = /*pass should be warning:ClosureWrap*/top; 704 left = /*pass should be warning:DownCastComposite*/top;
vsm 2015/04/03 21:09:34 We're missing handling of typedefs it appears.
Leaf 2015/04/03 21:24:59 I think this is dartbug.com/21912
706 left = left; 705 left = left;
707 left = /*pass should be severe:StaticTypeError*/right; 706 left = /*pass should be severe:StaticTypeError*/right;
708 left = bot; 707 left = bot;
709 708
710 right = /*pass should be warning:ClosureWrap*/top; 709 right = /*pass should be warning:DownCastComposite*/top;
711 right = /*pass should be severe:StaticTypeError*/left; 710 right = /*pass should be severe:StaticTypeError*/left;
712 right = right; 711 right = right;
713 right = bot; 712 right = bot;
714 713
715 bot = /*pass should be warning:ClosureWrap*/top; 714 bot = /*pass should be warning:DownCastComposite*/top;
716 bot = /*pass should be warning:ClosureWrap*/left; 715 bot = /*pass should be warning:DownCastComposite*/left;
717 bot = /*pass should be warning:ClosureWrap*/right; 716 bot = /*pass should be warning:DownCastComposite*/right;
718 bot = bot; 717 bot = bot;
719 } 718 }
720 } 719 }
721 ''' 720 '''
722 }); 721 });
723 }); 722 });
724 723
725 test('Function typing and subtyping: named and optional parameters', () { 724 test('Function typing and subtyping: named and optional parameters', () {
726 testChecker({ 725 testChecker({
727 '/main.dart': ''' 726 '/main.dart': '''
(...skipping 24 matching lines...) Expand all
752 r = r; 751 r = r;
753 r = o; 752 r = o;
754 r = /*severe:StaticTypeError*/n; 753 r = /*severe:StaticTypeError*/n;
755 r = /*severe:StaticTypeError*/rr; 754 r = /*severe:StaticTypeError*/rr;
756 r = ro; 755 r = ro;
757 r = rn; 756 r = rn;
758 r = oo; 757 r = oo;
759 r = /*severe:StaticTypeError*/nn; 758 r = /*severe:StaticTypeError*/nn;
760 r = /*severe:StaticTypeError*/nnn; 759 r = /*severe:StaticTypeError*/nnn;
761 760
762 o = /*severe:StaticTypeError*/r; 761 o = /*warning:DownCastComposite*/r;
763 o = o; 762 o = o;
764 o = /*severe:StaticTypeError*/n; 763 o = /*severe:StaticTypeError*/n;
765 o = /*severe:StaticTypeError*/rr; 764 o = /*severe:StaticTypeError*/rr;
766 o = /*severe:StaticTypeError*/ro; 765 o = /*severe:StaticTypeError*/ro;
767 o = /*severe:StaticTypeError*/rn; 766 o = /*severe:StaticTypeError*/rn;
768 o = oo; 767 o = oo;
769 o = /*severe:StaticTypeError*/nn 768 o = /*severe:StaticTypeError*/nn
770 o = /*severe:StaticTypeError*/nnn; 769 o = /*severe:StaticTypeError*/nnn;
771 770
772 n = /*severe:StaticTypeError*/r; 771 n = /*severe:StaticTypeError*/r;
773 n = /*severe:StaticTypeError*/o; 772 n = /*severe:StaticTypeError*/o;
774 n = n; 773 n = n;
775 n = /*severe:StaticTypeError*/rr; 774 n = /*severe:StaticTypeError*/rr;
776 n = /*severe:StaticTypeError*/ro; 775 n = /*severe:StaticTypeError*/ro;
777 n = /*severe:StaticTypeError*/rn; 776 n = /*severe:StaticTypeError*/rn;
778 n = /*severe:StaticTypeError*/oo; 777 n = /*severe:StaticTypeError*/oo;
779 n = nn; 778 n = nn;
780 n = nnn; 779 n = nnn;
781 780
782 rr = /*severe:StaticTypeError*/r; 781 rr = /*severe:StaticTypeError*/r;
783 rr = /*severe:StaticTypeError*/o; 782 rr = /*severe:StaticTypeError*/o;
784 rr = /*severe:StaticTypeError*/n; 783 rr = /*severe:StaticTypeError*/n;
785 rr = rr; 784 rr = rr;
786 rr = ro; 785 rr = ro;
787 rr = /*severe:StaticTypeError*/rn; 786 rr = /*severe:StaticTypeError*/rn;
788 rr = oo; 787 rr = oo;
789 rr = /*severe:StaticTypeError*/nn; 788 rr = /*severe:StaticTypeError*/nn;
790 rr = /*severe:StaticTypeError*/nnn; 789 rr = /*severe:StaticTypeError*/nnn;
791 790
792 ro = /*severe:StaticTypeError*/r; 791 ro = /*warning:DownCastComposite*/r;
vsm 2015/04/03 21:09:34 Note: these used to be a static error. A down cas
793 ro = /*severe:StaticTypeError*/o; 792 ro = /*severe:StaticTypeError*/o;
794 ro = /*severe:StaticTypeError*/n; 793 ro = /*severe:StaticTypeError*/n;
795 ro = /*severe:StaticTypeError*/rr; 794 ro = /*warning:DownCastComposite*/rr;
796 ro = ro; 795 ro = ro;
797 ro = /*severe:StaticTypeError*/rn; 796 ro = /*severe:StaticTypeError*/rn;
798 ro = oo; 797 ro = oo;
799 ro = /*severe:StaticTypeError*/nn; 798 ro = /*severe:StaticTypeError*/nn;
800 ro = /*severe:StaticTypeError*/nnn; 799 ro = /*severe:StaticTypeError*/nnn;
801 800
802 rn = /*severe:StaticTypeError*/r; 801 rn = /*warning:DownCastComposite*/r;
803 rn = /*severe:StaticTypeError*/o; 802 rn = /*severe:StaticTypeError*/o;
804 rn = /*severe:StaticTypeError*/n; 803 rn = /*severe:StaticTypeError*/n;
805 rn = /*severe:StaticTypeError*/rr; 804 rn = /*severe:StaticTypeError*/rr;
806 rn = /*severe:StaticTypeError*/ro; 805 rn = /*severe:StaticTypeError*/ro;
807 rn = rn; 806 rn = rn;
808 rn = /*severe:StaticTypeError*/oo; 807 rn = /*severe:StaticTypeError*/oo;
809 rn = /*severe:StaticTypeError*/nn; 808 rn = /*severe:StaticTypeError*/nn;
810 rn = /*severe:StaticTypeError*/nnn; 809 rn = /*severe:StaticTypeError*/nnn;
811 810
812 oo = /*severe:StaticTypeError*/r; 811 oo = /*warning:DownCastComposite*/r;
813 oo = /*severe:StaticTypeError*/o; 812 oo = /*warning:DownCastComposite*/o;
814 oo = /*severe:StaticTypeError*/n; 813 oo = /*severe:StaticTypeError*/n;
815 oo = /*severe:StaticTypeError*/rr; 814 oo = /*warning:DownCastComposite*/rr;
816 oo = /*severe:StaticTypeError*/ro; 815 oo = /*warning:DownCastComposite*/ro;
817 oo = /*severe:StaticTypeError*/rn; 816 oo = /*severe:StaticTypeError*/rn;
818 oo = oo; 817 oo = oo;
819 oo = /*severe:StaticTypeError*/nn; 818 oo = /*severe:StaticTypeError*/nn;
820 oo = /*severe:StaticTypeError*/nnn; 819 oo = /*severe:StaticTypeError*/nnn;
821 820
822 nn = /*severe:StaticTypeError*/r; 821 nn = /*severe:StaticTypeError*/r;
823 nn = /*severe:StaticTypeError*/o; 822 nn = /*severe:StaticTypeError*/o;
824 nn = /*severe:StaticTypeError*/n; 823 nn = /*warning:DownCastComposite*/n;
825 nn = /*severe:StaticTypeError*/rr; 824 nn = /*severe:StaticTypeError*/rr;
826 nn = /*severe:StaticTypeError*/ro; 825 nn = /*severe:StaticTypeError*/ro;
827 nn = /*severe:StaticTypeError*/rn; 826 nn = /*severe:StaticTypeError*/rn;
828 nn = /*severe:StaticTypeError*/oo; 827 nn = /*severe:StaticTypeError*/oo;
829 nn = nn; 828 nn = nn;
830 nn = nnn; 829 nn = nnn;
831 830
832 nnn = /*severe:StaticTypeError*/r; 831 nnn = /*severe:StaticTypeError*/r;
833 nnn = /*severe:StaticTypeError*/o; 832 nnn = /*severe:StaticTypeError*/o;
834 nnn = /*severe:StaticTypeError*/n; 833 nnn = /*warning:DownCastComposite*/n;
835 nnn = /*severe:StaticTypeError*/rr; 834 nnn = /*severe:StaticTypeError*/rr;
836 nnn = /*severe:StaticTypeError*/ro; 835 nnn = /*severe:StaticTypeError*/ro;
837 nnn = /*severe:StaticTypeError*/rn; 836 nnn = /*severe:StaticTypeError*/rn;
838 nnn = /*severe:StaticTypeError*/oo; 837 nnn = /*severe:StaticTypeError*/oo;
839 nnn = /*severe:StaticTypeError*/nn; 838 nnn = /*warning:DownCastComposite*/nn;
840 nnn = nnn; 839 nnn = nnn;
841 } 840 }
842 ''' 841 '''
843 }); 842 });
844 }); 843 });
845 844
846 test('Function subtyping: objects with call methods', () { 845 test('Function subtyping: objects with call methods', () {
847 testChecker({ 846 testChecker({
848 '/main.dart': ''' 847 '/main.dart': '''
849 848
850 typedef int I2I(int x); 849 typedef int I2I(int x);
851 typedef num N2N(num x); 850 typedef num N2N(num x);
852 class A { 851 class A {
853 int call(int x) => x; 852 int call(int x) => x;
854 } 853 }
855 class B { 854 class B {
856 num call(num x) => x; 855 num call(num x) => x;
857 } 856 }
858 int i2i(int x) => x; 857 int i2i(int x) => x;
859 num n2n(num x) => x; 858 num n2n(num x) => x;
860 void main() { 859 void main() {
861 { 860 {
862 I2I f; 861 I2I f;
863 f = new A(); 862 f = new A();
864 f = /*severe:StaticTypeError*/new B(); 863 f = /*severe:StaticTypeError*/new B();
865 f = i2i; 864 f = i2i;
866 f = /*warning:ClosureWrap*/n2n; 865 f = /*warning:DownCastComposite*/n2n;
867 f = /*warning:DownCastComposite*/(i2i as Object); 866 f = /*warning:DownCastComposite*/(i2i as Object);
868 f = /*warning:DownCastComposite*/(n2n as Function); 867 f = /*warning:DownCastComposite*/(n2n as Function);
869 } 868 }
870 { 869 {
871 N2N f; 870 N2N f;
872 f = /*severe:StaticTypeError*/new A(); 871 f = /*severe:StaticTypeError*/new A();
873 f = new B(); 872 f = new B();
874 f = /*warning:ClosureWrap*/i2i; 873 f = /*warning:DownCastComposite*/i2i;
875 f = n2n; 874 f = n2n;
876 f = /*warning:DownCastComposite*/(i2i as Object); 875 f = /*warning:DownCastComposite*/(i2i as Object);
877 f = /*warning:DownCastComposite*/(n2n as Function); 876 f = /*warning:DownCastComposite*/(n2n as Function);
878 } 877 }
879 { 878 {
880 A f; 879 A f;
881 f = new A(); 880 f = new A();
882 f = /*severe:StaticTypeError*/new B(); 881 f = /*severe:StaticTypeError*/new B();
883 f = /*severe:StaticTypeError*/i2i; 882 f = /*severe:StaticTypeError*/i2i;
884 f = /*severe:StaticTypeError*/n2n; 883 f = /*severe:StaticTypeError*/n2n;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
929 void main() { 928 void main() {
930 F f1 = (x, y) => x + y; 929 F f1 = (x, y) => x + y;
931 F<int> f2 = /*warning:ClosureWrapLiteral*/(x, y) => x + y; 930 F<int> f2 = /*warning:ClosureWrapLiteral*/(x, y) => x + y;
932 D f3 = (x, y) => x + y; 931 D f3 = (x, y) => x + y;
933 Function f4 = (x, y) => x + y; 932 Function f4 = (x, y) => x + y;
934 f2 = /*warning:ClosureWrap*/f1; 933 f2 = /*warning:ClosureWrap*/f1;
935 f1 = (int x, int y) => x + y; 934 f1 = (int x, int y) => x + y;
936 f2 = /*severe:StaticTypeError*/(int x) => -x; 935 f2 = /*severe:StaticTypeError*/(int x) => -x;
937 } 936 }
938 ''' 937 '''
939 }); 938 }, wrapClosures: true);
940 }); 939 });
941 940
942 test('Generic subtyping: invariance', () { 941 test('Generic subtyping: invariance', () {
943 testChecker({ 942 testChecker({
944 '/main.dart': ''' 943 '/main.dart': '''
945 944
946 class A {} 945 class A {}
947 class B extends A {} 946 class B extends A {}
948 class C implements A {} 947 class C implements A {}
949 948
(...skipping 1850 matching lines...) Expand 10 before | Expand all | Expand 10 after
2800 f = bar as II2D; 2799 f = bar as II2D;
2801 f = bar as DD2I; 2800 f = bar as DD2I;
2802 f = bar as DI2D; 2801 f = bar as DI2D;
2803 f = bar as ID2D; 2802 f = bar as ID2D;
2804 f = bar as DD2D; 2803 f = bar as DD2D;
2805 } 2804 }
2806 ''' 2805 '''
2807 }); 2806 });
2808 }); 2807 });
2809 } 2808 }
OLDNEW
« no previous file with comments | « lib/src/options.dart ('k') | test/dart_codegen/expect/_internal/iterable.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698