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

Side by Side Diff: tests/language/function_type/function_type0_test.dart

Issue 2879153005: Add support to dart2js for option --enable-asserts. (Closed)
Patch Set: Added !$checked to section predicate in co19 status file Created 3 years, 5 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 // GENERATED - DON'T EDIT. 5 // GENERATED - DON'T EDIT.
6 // GENERATED - DON'T EDIT. 6 // GENERATED - DON'T EDIT.
7 // GENERATED - DON'T EDIT. 7 // GENERATED - DON'T EDIT.
8 // GENERATED - DON'T EDIT. 8 // GENERATED - DON'T EDIT.
9 // GENERATED - DON'T EDIT. 9 // GENERATED - DON'T EDIT.
10 // GENERATED - DON'T EDIT. 10 // GENERATED - DON'T EDIT.
11 // GENERATED - DON'T EDIT. 11 // GENERATED - DON'T EDIT.
12 // GENERATED - DON'T EDIT. 12 // GENERATED - DON'T EDIT.
13 13
14 import 'dart:core'; 14 import 'dart:core';
15 import 'dart:core' as core; 15 import 'dart:core' as core;
16 import 'package:expect/expect.dart'; 16 import 'package:expect/expect.dart';
17 17
18 @NoInline() 18 @NoInline()
19 @AssumeDynamic() 19 @AssumeDynamic()
20 confuse(f) => f; 20 confuse(f) => f;
21 21
22 final bool inCheckedMode = (() { 22 typedef F0<T> = int Function(int x);
23 bool result = false; 23 typedef F1<T> = Function Function(List<T> x);
24 assert(result = true); 24 typedef F2<T> = core.List<core.int> Function(int y, {List<Function> x});
25 return result; 25 typedef F3<T> = Function(int x0, {Function x});
26 })(); 26 typedef F4<T> = Function Function<A>(int x);
27 27 typedef F5<T> = int Function(int x0, {int x}) Function();
28 typedef F0<T> 28 typedef F6<T> = int Function([core.List<core.int> x]) Function();
29 = int Function(int x); 29 typedef F7<T> = Function Function(int y, [int x]) Function();
30 typedef F1<T> 30 typedef F8<T> = Function Function(int x1, [List<Function> x2]) Function();
31 = Function Function(List<T> x); 31 typedef F9<T> = Function Function(int x0, {List<T> x}) Function();
32 typedef F2<T> 32 typedef F10<T> = List<Function> Function(List<Function> x) Function();
33 = core.List<core.int> Function(int y, {List<Function> x}); 33 typedef F11<T> = List<Function> Function(int y, [List<T> x]) Function();
34 typedef F3<T> 34 typedef F12<T> = core.List<core.int> Function([Function x1]) Function();
35 = Function(int x0, {Function x}); 35 typedef F13<T> = core.List<core.int> Function({core.List<core.int> x})
36 typedef F4<T> 36 Function();
37 = Function Function<A>(int x); 37 typedef F14<T> = List<T> Function(int y, {int x}) Function();
38 typedef F5<T> 38 typedef F15<T> = List<T> Function(int x0, [core.List<core.int> x]) Function();
39 = int Function(int x0, {int x}) Function(); 39 typedef F16<T> = Function(int x0) Function();
40 typedef F6<T> 40 typedef F17<T> = Function(int x, [List<Function> x2]) Function();
41 = int Function([core.List<core.int> x]) Function(); 41 typedef F18<T> = Function(int y, {List<T> x}) Function();
42 typedef F7<T> 42 typedef F19<T> = void Function([List<Function> x]) Function();
43 = Function Function(int y, [int x]) Function(); 43 typedef F20<T> = void Function(List<T> x0) Function();
44 typedef F8<T> 44 typedef F21<T> = List<Function> Function<A>(Function x) Function();
45 = Function Function(int x1, [List<Function> x2]) Function(); 45 typedef F22<T> = Function<A>(List<Function> x) Function();
46 typedef F9<T> 46 typedef F23<T> = void Function<A>(core.List<core.int> x) Function();
47 = Function Function(int x0, {List<T> x}) Function();
48 typedef F10<T>
49 = List<Function> Function(List<Function> x) Function();
50 typedef F11<T>
51 = List<Function> Function(int y, [List<T> x]) Function();
52 typedef F12<T>
53 = core.List<core.int> Function([Function x1]) Function();
54 typedef F13<T>
55 = core.List<core.int> Function({core.List<core.int> x}) Function();
56 typedef F14<T>
57 = List<T> Function(int y, {int x}) Function();
58 typedef F15<T>
59 = List<T> Function(int x0, [core.List<core.int> x]) Function();
60 typedef F16<T>
61 = Function(int x0) Function();
62 typedef F17<T>
63 = Function(int x, [List<Function> x2]) Function();
64 typedef F18<T>
65 = Function(int y, {List<T> x}) Function();
66 typedef F19<T>
67 = void Function([List<Function> x]) Function();
68 typedef F20<T>
69 = void Function(List<T> x0) Function();
70 typedef F21<T>
71 = List<Function> Function<A>(Function x) Function();
72 typedef F22<T>
73 = Function<A>(List<Function> x) Function();
74 typedef F23<T>
75 = void Function<A>(core.List<core.int> x) Function();
76 47
77 int f0(int x) => null; 48 int f0(int x) => null;
78 Function f1(List<int> x) => null; 49 Function f1(List<int> x) => null;
79 core.List<core.int> f2(int y, {List<Function> x}) => null; 50 core.List<core.int> f2(int y, {List<Function> x}) => null;
80 f3(int x0, {Function x}) => null; 51 f3(int x0, {Function x}) => null;
81 Function f4<A>(int x) => null; 52 Function f4<A>(int x) => null;
82 int Function(int x0, {int x}) f5() => null; 53 int Function(int x0, {int x}) f5() => null;
83 int Function([core.List<core.int> x]) f6() => null; 54 int Function([core.List<core.int> x]) f6() => null;
84 Function Function(int y, [int x]) f7() => null; 55 Function Function(int y, [int x]) f7() => null;
85 Function Function(int x0, [List<Function> x1]) f8() => null; 56 Function Function(int x0, [List<Function> x1]) f8() => null;
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 x1 = confuse(m1); 202 x1 = confuse(m1);
232 l1 = confuse(m1); 203 l1 = confuse(m1);
233 if (!tIsBool) { 204 if (!tIsBool) {
234 Expect.isTrue(f1 is F1<int>); 205 Expect.isTrue(f1 is F1<int>);
235 Expect.isFalse(f1 is F1<bool>); 206 Expect.isFalse(f1 is F1<bool>);
236 Expect.isTrue(confuse(f1) is F1<int>); 207 Expect.isTrue(confuse(f1) is F1<int>);
237 Expect.isFalse(confuse(f1) is F1<bool>); 208 Expect.isFalse(confuse(f1) is F1<bool>);
238 Expect.equals(tIsDynamic, m1 is F1<bool>); 209 Expect.equals(tIsDynamic, m1 is F1<bool>);
239 Expect.equals(tIsDynamic, confuse(m1) is F1<bool>); 210 Expect.equals(tIsDynamic, confuse(m1) is F1<bool>);
240 } else { 211 } else {
241 if (inCheckedMode) { 212 if (typeAssertionsEnabled) {
242 Expect.throws(() { 213 Expect.throws(() {
243 x1 = (f1 as dynamic); 214 x1 = (f1 as dynamic);
244 }); 215 });
245 Expect.throws(() { 216 Expect.throws(() {
246 x1 = confuse(f1); 217 x1 = confuse(f1);
247 }); 218 });
248 Function Function(List<T> x) l1; 219 Function Function(List<T> x) l1;
249 Expect.throws(() { 220 Expect.throws(() {
250 l1 = (f1 as dynamic); 221 l1 = (f1 as dynamic);
251 }); 222 });
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 x9 = confuse(m9); 424 x9 = confuse(m9);
454 l9 = confuse(m9); 425 l9 = confuse(m9);
455 if (!tIsBool) { 426 if (!tIsBool) {
456 Expect.isTrue(f9 is F9<int>); 427 Expect.isTrue(f9 is F9<int>);
457 Expect.isFalse(f9 is F9<bool>); 428 Expect.isFalse(f9 is F9<bool>);
458 Expect.isTrue(confuse(f9) is F9<int>); 429 Expect.isTrue(confuse(f9) is F9<int>);
459 Expect.isFalse(confuse(f9) is F9<bool>); 430 Expect.isFalse(confuse(f9) is F9<bool>);
460 Expect.equals(tIsDynamic, m9 is F9<bool>); 431 Expect.equals(tIsDynamic, m9 is F9<bool>);
461 Expect.equals(tIsDynamic, confuse(m9) is F9<bool>); 432 Expect.equals(tIsDynamic, confuse(m9) is F9<bool>);
462 } else { 433 } else {
463 if (inCheckedMode) { 434 if (typeAssertionsEnabled) {
464 Expect.throws(() { 435 Expect.throws(() {
465 x9 = (f9 as dynamic); 436 x9 = (f9 as dynamic);
466 }); 437 });
467 Expect.throws(() { 438 Expect.throws(() {
468 x9 = confuse(f9); 439 x9 = confuse(f9);
469 }); 440 });
470 Function Function(int x0, {List<T> x}) Function() l9; 441 Function Function(int x0, {List<T> x}) Function() l9;
471 Expect.throws(() { 442 Expect.throws(() {
472 l9 = (f9 as dynamic); 443 l9 = (f9 as dynamic);
473 }); 444 });
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 x11 = confuse(m11); 501 x11 = confuse(m11);
531 l11 = confuse(m11); 502 l11 = confuse(m11);
532 if (!tIsBool) { 503 if (!tIsBool) {
533 Expect.isTrue(f11 is F11<int>); 504 Expect.isTrue(f11 is F11<int>);
534 Expect.isFalse(f11 is F11<bool>); 505 Expect.isFalse(f11 is F11<bool>);
535 Expect.isTrue(confuse(f11) is F11<int>); 506 Expect.isTrue(confuse(f11) is F11<int>);
536 Expect.isFalse(confuse(f11) is F11<bool>); 507 Expect.isFalse(confuse(f11) is F11<bool>);
537 Expect.equals(tIsDynamic, m11 is F11<bool>); 508 Expect.equals(tIsDynamic, m11 is F11<bool>);
538 Expect.equals(tIsDynamic, confuse(m11) is F11<bool>); 509 Expect.equals(tIsDynamic, confuse(m11) is F11<bool>);
539 } else { 510 } else {
540 if (inCheckedMode) { 511 if (typeAssertionsEnabled) {
541 Expect.throws(() { 512 Expect.throws(() {
542 x11 = (f11 as dynamic); 513 x11 = (f11 as dynamic);
543 }); 514 });
544 Expect.throws(() { 515 Expect.throws(() {
545 x11 = confuse(f11); 516 x11 = confuse(f11);
546 }); 517 });
547 List<Function> Function(int y, [List<T> x]) Function() l11; 518 List<Function> Function(int y, [List<T> x]) Function() l11;
548 Expect.throws(() { 519 Expect.throws(() {
549 l11 = (f11 as dynamic); 520 l11 = (f11 as dynamic);
550 }); 521 });
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 core.List<core.int> Function({core.List<core.int> x}) Function() l13; 563 core.List<core.int> Function({core.List<core.int> x}) Function() l13;
593 // The static function f13 sets `T` to `int`. 564 // The static function f13 sets `T` to `int`.
594 if (!tIsBool) { 565 if (!tIsBool) {
595 x13 = f13 as dynamic; 566 x13 = f13 as dynamic;
596 l13 = f13 as dynamic; 567 l13 = f13 as dynamic;
597 x13 = confuse(f13); 568 x13 = confuse(f13);
598 l13 = confuse(f13); 569 l13 = confuse(f13);
599 } 570 }
600 571
601 Expect.isTrue(m13 is F13); 572 Expect.isTrue(m13 is F13);
602 Expect.isTrue(m13 is core.List<core.int> Function( 573 Expect.isTrue(m13 is core.List<core.int> Function({core.List<core.int> x})
603 {core.List<core.int> x}) Function()); 574 Function());
604 Expect.isTrue(confuse(m13) is F13); 575 Expect.isTrue(confuse(m13) is F13);
605 // In checked mode, verifies the type. 576 // In checked mode, verifies the type.
606 x13 = m13; 577 x13 = m13;
607 l13 = m13; 578 l13 = m13;
608 x13 = confuse(m13); 579 x13 = confuse(m13);
609 l13 = confuse(m13); 580 l13 = confuse(m13);
610 } 581 }
611 582
612 /// List<T> Function(int y, {int x}) Function() 583 /// List<T> Function(int y, {int x}) Function()
613 void testF14() { 584 void testF14() {
(...skipping 18 matching lines...) Expand all
632 x14 = confuse(m14); 603 x14 = confuse(m14);
633 l14 = confuse(m14); 604 l14 = confuse(m14);
634 if (!tIsBool) { 605 if (!tIsBool) {
635 Expect.isTrue(f14 is F14<int>); 606 Expect.isTrue(f14 is F14<int>);
636 Expect.isFalse(f14 is F14<bool>); 607 Expect.isFalse(f14 is F14<bool>);
637 Expect.isTrue(confuse(f14) is F14<int>); 608 Expect.isTrue(confuse(f14) is F14<int>);
638 Expect.isFalse(confuse(f14) is F14<bool>); 609 Expect.isFalse(confuse(f14) is F14<bool>);
639 Expect.equals(tIsDynamic, m14 is F14<bool>); 610 Expect.equals(tIsDynamic, m14 is F14<bool>);
640 Expect.equals(tIsDynamic, confuse(m14) is F14<bool>); 611 Expect.equals(tIsDynamic, confuse(m14) is F14<bool>);
641 } else { 612 } else {
642 if (inCheckedMode) { 613 if (typeAssertionsEnabled) {
643 Expect.throws(() { 614 Expect.throws(() {
644 x14 = (f14 as dynamic); 615 x14 = (f14 as dynamic);
645 }); 616 });
646 Expect.throws(() { 617 Expect.throws(() {
647 x14 = confuse(f14); 618 x14 = confuse(f14);
648 }); 619 });
649 List<T> Function(int y, {int x}) Function() l14; 620 List<T> Function(int y, {int x}) Function() l14;
650 Expect.throws(() { 621 Expect.throws(() {
651 l14 = (f14 as dynamic); 622 l14 = (f14 as dynamic);
652 }); 623 });
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 x15 = confuse(m15); 656 x15 = confuse(m15);
686 l15 = confuse(m15); 657 l15 = confuse(m15);
687 if (!tIsBool) { 658 if (!tIsBool) {
688 Expect.isTrue(f15 is F15<int>); 659 Expect.isTrue(f15 is F15<int>);
689 Expect.isFalse(f15 is F15<bool>); 660 Expect.isFalse(f15 is F15<bool>);
690 Expect.isTrue(confuse(f15) is F15<int>); 661 Expect.isTrue(confuse(f15) is F15<int>);
691 Expect.isFalse(confuse(f15) is F15<bool>); 662 Expect.isFalse(confuse(f15) is F15<bool>);
692 Expect.equals(tIsDynamic, m15 is F15<bool>); 663 Expect.equals(tIsDynamic, m15 is F15<bool>);
693 Expect.equals(tIsDynamic, confuse(m15) is F15<bool>); 664 Expect.equals(tIsDynamic, confuse(m15) is F15<bool>);
694 } else { 665 } else {
695 if (inCheckedMode) { 666 if (typeAssertionsEnabled) {
696 Expect.throws(() { 667 Expect.throws(() {
697 x15 = (f15 as dynamic); 668 x15 = (f15 as dynamic);
698 }); 669 });
699 Expect.throws(() { 670 Expect.throws(() {
700 x15 = confuse(f15); 671 x15 = confuse(f15);
701 }); 672 });
702 List<T> Function(int x0, [core.List<core.int> x]) Function() l15; 673 List<T> Function(int x0, [core.List<core.int> x]) Function() l15;
703 Expect.throws(() { 674 Expect.throws(() {
704 l15 = (f15 as dynamic); 675 l15 = (f15 as dynamic);
705 }); 676 });
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 x18 = confuse(m18); 756 x18 = confuse(m18);
786 l18 = confuse(m18); 757 l18 = confuse(m18);
787 if (!tIsBool) { 758 if (!tIsBool) {
788 Expect.isTrue(f18 is F18<int>); 759 Expect.isTrue(f18 is F18<int>);
789 Expect.isFalse(f18 is F18<bool>); 760 Expect.isFalse(f18 is F18<bool>);
790 Expect.isTrue(confuse(f18) is F18<int>); 761 Expect.isTrue(confuse(f18) is F18<int>);
791 Expect.isFalse(confuse(f18) is F18<bool>); 762 Expect.isFalse(confuse(f18) is F18<bool>);
792 Expect.equals(tIsDynamic, m18 is F18<bool>); 763 Expect.equals(tIsDynamic, m18 is F18<bool>);
793 Expect.equals(tIsDynamic, confuse(m18) is F18<bool>); 764 Expect.equals(tIsDynamic, confuse(m18) is F18<bool>);
794 } else { 765 } else {
795 if (inCheckedMode) { 766 if (typeAssertionsEnabled) {
796 Expect.throws(() { 767 Expect.throws(() {
797 x18 = (f18 as dynamic); 768 x18 = (f18 as dynamic);
798 }); 769 });
799 Expect.throws(() { 770 Expect.throws(() {
800 x18 = confuse(f18); 771 x18 = confuse(f18);
801 }); 772 });
802 Function(int y, {List<T> x}) Function() l18; 773 Function(int y, {List<T> x}) Function() l18;
803 Expect.throws(() { 774 Expect.throws(() {
804 l18 = (f18 as dynamic); 775 l18 = (f18 as dynamic);
805 }); 776 });
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 x20 = confuse(m20); 832 x20 = confuse(m20);
862 l20 = confuse(m20); 833 l20 = confuse(m20);
863 if (!tIsBool) { 834 if (!tIsBool) {
864 Expect.isTrue(f20 is F20<int>); 835 Expect.isTrue(f20 is F20<int>);
865 Expect.isFalse(f20 is F20<bool>); 836 Expect.isFalse(f20 is F20<bool>);
866 Expect.isTrue(confuse(f20) is F20<int>); 837 Expect.isTrue(confuse(f20) is F20<int>);
867 Expect.isFalse(confuse(f20) is F20<bool>); 838 Expect.isFalse(confuse(f20) is F20<bool>);
868 Expect.equals(tIsDynamic, m20 is F20<bool>); 839 Expect.equals(tIsDynamic, m20 is F20<bool>);
869 Expect.equals(tIsDynamic, confuse(m20) is F20<bool>); 840 Expect.equals(tIsDynamic, confuse(m20) is F20<bool>);
870 } else { 841 } else {
871 if (inCheckedMode) { 842 if (typeAssertionsEnabled) {
872 Expect.throws(() { 843 Expect.throws(() {
873 x20 = (f20 as dynamic); 844 x20 = (f20 as dynamic);
874 }); 845 });
875 Expect.throws(() { 846 Expect.throws(() {
876 x20 = confuse(f20); 847 x20 = confuse(f20);
877 }); 848 });
878 void Function(List<T> x0) Function() l20; 849 void Function(List<T> x0) Function() l20;
879 Expect.throws(() { 850 Expect.throws(() {
880 l20 = (f20 as dynamic); 851 l20 = (f20 as dynamic);
881 }); 852 });
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 x23 = confuse(m23); 932 x23 = confuse(m23);
962 l23 = confuse(m23); 933 l23 = confuse(m23);
963 } 934 }
964 } 935 }
965 936
966 void main() { 937 void main() {
967 new U0().runTests(); 938 new U0().runTests();
968 new U0<int>(tIsInt: true).runTests(); 939 new U0<int>(tIsInt: true).runTests();
969 new U0<bool>(tIsBool: true).runTests(); 940 new U0<bool>(tIsBool: true).runTests();
970 } 941 }
OLDNEW
« no previous file with comments | « tests/corelib/splay_tree_from_iterable_test.dart ('k') | tests/language/function_type/function_type10_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698