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

Side by Side Diff: tests/language/function_type/function_type68_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> = Function Function([Function x]);
23 bool result = false; 23 typedef F1<T> = core.List<core.int> Function(int x);
24 assert(result = true); 24 typedef F2<T> = List<T> Function(List<T> x);
25 return result; 25 typedef F3<T> = void Function(int y, {List<Function> x});
26 })(); 26 typedef F4<T> = int Function([int x]) Function();
27 27 typedef F5<T> = int Function(List<Function> x0) Function();
28 typedef F0<T> 28 typedef F6<T> = int Function(int x, [List<T> x2]) Function();
29 = Function Function([Function x]); 29 typedef F7<T> = Function Function(int x0, {Function x}) Function();
30 typedef F1<T> 30 typedef F8<T> = Function Function([List<T> x]) Function();
31 = core.List<core.int> Function(int x); 31 typedef F9<T> = List<Function> Function(int y, [Function x]) Function();
32 typedef F2<T> 32 typedef F10<T> = List<Function> Function(int x1, [core.List<core.int> x2])
33 = List<T> Function(List<T> x); 33 Function();
34 typedef F3<T> 34 typedef F11<T> = core.List<core.int> Function({int x}) Function();
35 = void Function(int y, {List<Function> x}); 35 typedef F12<T> = core.List<core.int> Function(core.List<core.int> x) Function();
36 typedef F4<T> 36 typedef F13<T> = List<T> Function(int x0, [int x]) Function();
37 = int Function([int x]) Function(); 37 typedef F14<T> = List<T> Function([List<Function> x1]) Function();
38 typedef F5<T> 38 typedef F15<T> = List<T> Function({List<T> x}) Function();
39 = int Function(List<Function> x0) Function(); 39 typedef F16<T> = Function(int y, {Function x}) Function();
40 typedef F6<T> 40 typedef F17<T> = Function(int x0, [List<T> x]) Function();
41 = int Function(int x, [List<T> x2]) Function(); 41 typedef F18<T> = void Function(Function x0) Function();
42 typedef F7<T> 42 typedef F19<T> = void Function(int x, [core.List<core.int> x2]) Function();
43 = Function Function(int x0, {Function x}) Function(); 43 typedef F20<T> = Function Function<A>(Function x) Function();
44 typedef F8<T> 44 typedef F21<T> = List<T> Function<A>(List<Function> x) Function();
45 = Function Function([List<T> x]) Function(); 45 typedef F22<T> = List<A> Function<A>(core.List<core.int> x) Function();
46 typedef F9<T>
47 = List<Function> Function(int y, [Function x]) Function();
48 typedef F10<T>
49 = List<Function> Function(int x1, [core.List<core.int> x2]) Function();
50 typedef F11<T>
51 = core.List<core.int> Function({int x}) Function();
52 typedef F12<T>
53 = core.List<core.int> Function(core.List<core.int> x) Function();
54 typedef F13<T>
55 = List<T> Function(int x0, [int x]) Function();
56 typedef F14<T>
57 = List<T> Function([List<Function> x1]) Function();
58 typedef F15<T>
59 = List<T> Function({List<T> x}) Function();
60 typedef F16<T>
61 = Function(int y, {Function x}) Function();
62 typedef F17<T>
63 = Function(int x0, [List<T> x]) Function();
64 typedef F18<T>
65 = void Function(Function x0) Function();
66 typedef F19<T>
67 = void Function(int x, [core.List<core.int> x2]) Function();
68 typedef F20<T>
69 = Function Function<A>(Function x) Function();
70 typedef F21<T>
71 = List<T> Function<A>(List<Function> x) Function();
72 typedef F22<T>
73 = List<A> Function<A>(core.List<core.int> x) Function();
74 46
75 Function f0([Function x]) => null; 47 Function f0([Function x]) => null;
76 core.List<core.int> f1(int x) => null; 48 core.List<core.int> f1(int x) => null;
77 List<int> f2(List<int> x) => null; 49 List<int> f2(List<int> x) => null;
78 void f3(int y, {List<Function> x}) => null; 50 void f3(int y, {List<Function> x}) => null;
79 int Function([int x]) f4() => null; 51 int Function([int x]) f4() => null;
80 int Function(List<Function> x0) f5() => null; 52 int Function(List<Function> x0) f5() => null;
81 int Function(int x, [List<int> x0]) f6() => null; 53 int Function(int x, [List<int> x0]) f6() => null;
82 Function Function(int x0, {Function x}) f7() => null; 54 Function Function(int x0, {Function x}) f7() => null;
83 Function Function([List<int> x]) f8() => null; 55 Function Function([List<int> x]) f8() => null;
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 x2 = confuse(m2); 221 x2 = confuse(m2);
250 l2 = confuse(m2); 222 l2 = confuse(m2);
251 if (!tIsBool) { 223 if (!tIsBool) {
252 Expect.isTrue(f2 is F2<int>); 224 Expect.isTrue(f2 is F2<int>);
253 Expect.isFalse(f2 is F2<bool>); 225 Expect.isFalse(f2 is F2<bool>);
254 Expect.isTrue(confuse(f2) is F2<int>); 226 Expect.isTrue(confuse(f2) is F2<int>);
255 Expect.isFalse(confuse(f2) is F2<bool>); 227 Expect.isFalse(confuse(f2) is F2<bool>);
256 Expect.equals(tIsDynamic, m2 is F2<bool>); 228 Expect.equals(tIsDynamic, m2 is F2<bool>);
257 Expect.equals(tIsDynamic, confuse(m2) is F2<bool>); 229 Expect.equals(tIsDynamic, confuse(m2) is F2<bool>);
258 } else { 230 } else {
259 if (inCheckedMode) { 231 if (typeAssertionsEnabled) {
260 Expect.throws(() { 232 Expect.throws(() {
261 x2 = (f2 as dynamic); 233 x2 = (f2 as dynamic);
262 }); 234 });
263 Expect.throws(() { 235 Expect.throws(() {
264 x2 = confuse(f2); 236 x2 = confuse(f2);
265 }); 237 });
266 List<T> Function(List<T> x) l2; 238 List<T> Function(List<T> x) l2;
267 Expect.throws(() { 239 Expect.throws(() {
268 l2 = (f2 as dynamic); 240 l2 = (f2 as dynamic);
269 }); 241 });
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 x6 = confuse(m6); 345 x6 = confuse(m6);
374 l6 = confuse(m6); 346 l6 = confuse(m6);
375 if (!tIsBool) { 347 if (!tIsBool) {
376 Expect.isTrue(f6 is F6<int>); 348 Expect.isTrue(f6 is F6<int>);
377 Expect.isFalse(f6 is F6<bool>); 349 Expect.isFalse(f6 is F6<bool>);
378 Expect.isTrue(confuse(f6) is F6<int>); 350 Expect.isTrue(confuse(f6) is F6<int>);
379 Expect.isFalse(confuse(f6) is F6<bool>); 351 Expect.isFalse(confuse(f6) is F6<bool>);
380 Expect.equals(tIsDynamic, m6 is F6<bool>); 352 Expect.equals(tIsDynamic, m6 is F6<bool>);
381 Expect.equals(tIsDynamic, confuse(m6) is F6<bool>); 353 Expect.equals(tIsDynamic, confuse(m6) is F6<bool>);
382 } else { 354 } else {
383 if (inCheckedMode) { 355 if (typeAssertionsEnabled) {
384 Expect.throws(() { 356 Expect.throws(() {
385 x6 = (f6 as dynamic); 357 x6 = (f6 as dynamic);
386 }); 358 });
387 Expect.throws(() { 359 Expect.throws(() {
388 x6 = confuse(f6); 360 x6 = confuse(f6);
389 }); 361 });
390 int Function(int x, [List<T> x2]) Function() l6; 362 int Function(int x, [List<T> x2]) Function() l6;
391 Expect.throws(() { 363 Expect.throws(() {
392 l6 = (f6 as dynamic); 364 l6 = (f6 as dynamic);
393 }); 365 });
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 x8 = confuse(m8); 421 x8 = confuse(m8);
450 l8 = confuse(m8); 422 l8 = confuse(m8);
451 if (!tIsBool) { 423 if (!tIsBool) {
452 Expect.isTrue(f8 is F8<int>); 424 Expect.isTrue(f8 is F8<int>);
453 Expect.isFalse(f8 is F8<bool>); 425 Expect.isFalse(f8 is F8<bool>);
454 Expect.isTrue(confuse(f8) is F8<int>); 426 Expect.isTrue(confuse(f8) is F8<int>);
455 Expect.isFalse(confuse(f8) is F8<bool>); 427 Expect.isFalse(confuse(f8) is F8<bool>);
456 Expect.equals(tIsDynamic, m8 is F8<bool>); 428 Expect.equals(tIsDynamic, m8 is F8<bool>);
457 Expect.equals(tIsDynamic, confuse(m8) is F8<bool>); 429 Expect.equals(tIsDynamic, confuse(m8) is F8<bool>);
458 } else { 430 } else {
459 if (inCheckedMode) { 431 if (typeAssertionsEnabled) {
460 Expect.throws(() { 432 Expect.throws(() {
461 x8 = (f8 as dynamic); 433 x8 = (f8 as dynamic);
462 }); 434 });
463 Expect.throws(() { 435 Expect.throws(() {
464 x8 = confuse(f8); 436 x8 = confuse(f8);
465 }); 437 });
466 Function Function([List<T> x]) Function() l8; 438 Function Function([List<T> x]) Function() l8;
467 Expect.throws(() { 439 Expect.throws(() {
468 l8 = (f8 as dynamic); 440 l8 = (f8 as dynamic);
469 }); 441 });
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 // The static function f10 sets `T` to `int`. 484 // The static function f10 sets `T` to `int`.
513 if (!tIsBool) { 485 if (!tIsBool) {
514 x10 = f10 as dynamic; 486 x10 = f10 as dynamic;
515 l10 = f10 as dynamic; 487 l10 = f10 as dynamic;
516 x10 = confuse(f10); 488 x10 = confuse(f10);
517 l10 = confuse(f10); 489 l10 = confuse(f10);
518 } 490 }
519 491
520 Expect.isTrue(m10 is F10); 492 Expect.isTrue(m10 is F10);
521 Expect.isTrue(m10 is List<Function> Function(int x1, 493 Expect.isTrue(m10 is List<Function> Function(int x1,
522 [core.List<core.int> x2]) Function()); 494 [core.List<core.int> x2])
495 Function());
523 Expect.isTrue(confuse(m10) is F10); 496 Expect.isTrue(confuse(m10) is F10);
524 // In checked mode, verifies the type. 497 // In checked mode, verifies the type.
525 x10 = m10; 498 x10 = m10;
526 l10 = m10; 499 l10 = m10;
527 x10 = confuse(m10); 500 x10 = confuse(m10);
528 l10 = confuse(m10); 501 l10 = confuse(m10);
529 } 502 }
530 503
531 /// core.List<core.int> Function({int x}) Function() 504 /// core.List<core.int> Function({int x}) Function()
532 void testF11() { 505 void testF11() {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 x13 = confuse(m13); 573 x13 = confuse(m13);
601 l13 = confuse(m13); 574 l13 = confuse(m13);
602 if (!tIsBool) { 575 if (!tIsBool) {
603 Expect.isTrue(f13 is F13<int>); 576 Expect.isTrue(f13 is F13<int>);
604 Expect.isFalse(f13 is F13<bool>); 577 Expect.isFalse(f13 is F13<bool>);
605 Expect.isTrue(confuse(f13) is F13<int>); 578 Expect.isTrue(confuse(f13) is F13<int>);
606 Expect.isFalse(confuse(f13) is F13<bool>); 579 Expect.isFalse(confuse(f13) is F13<bool>);
607 Expect.equals(tIsDynamic, m13 is F13<bool>); 580 Expect.equals(tIsDynamic, m13 is F13<bool>);
608 Expect.equals(tIsDynamic, confuse(m13) is F13<bool>); 581 Expect.equals(tIsDynamic, confuse(m13) is F13<bool>);
609 } else { 582 } else {
610 if (inCheckedMode) { 583 if (typeAssertionsEnabled) {
611 Expect.throws(() { 584 Expect.throws(() {
612 x13 = (f13 as dynamic); 585 x13 = (f13 as dynamic);
613 }); 586 });
614 Expect.throws(() { 587 Expect.throws(() {
615 x13 = confuse(f13); 588 x13 = confuse(f13);
616 }); 589 });
617 List<T> Function(int x0, [int x]) Function() l13; 590 List<T> Function(int x0, [int x]) Function() l13;
618 Expect.throws(() { 591 Expect.throws(() {
619 l13 = (f13 as dynamic); 592 l13 = (f13 as dynamic);
620 }); 593 });
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 x14 = confuse(m14); 625 x14 = confuse(m14);
653 l14 = confuse(m14); 626 l14 = confuse(m14);
654 if (!tIsBool) { 627 if (!tIsBool) {
655 Expect.isTrue(f14 is F14<int>); 628 Expect.isTrue(f14 is F14<int>);
656 Expect.isFalse(f14 is F14<bool>); 629 Expect.isFalse(f14 is F14<bool>);
657 Expect.isTrue(confuse(f14) is F14<int>); 630 Expect.isTrue(confuse(f14) is F14<int>);
658 Expect.isFalse(confuse(f14) is F14<bool>); 631 Expect.isFalse(confuse(f14) is F14<bool>);
659 Expect.equals(tIsDynamic, m14 is F14<bool>); 632 Expect.equals(tIsDynamic, m14 is F14<bool>);
660 Expect.equals(tIsDynamic, confuse(m14) is F14<bool>); 633 Expect.equals(tIsDynamic, confuse(m14) is F14<bool>);
661 } else { 634 } else {
662 if (inCheckedMode) { 635 if (typeAssertionsEnabled) {
663 Expect.throws(() { 636 Expect.throws(() {
664 x14 = (f14 as dynamic); 637 x14 = (f14 as dynamic);
665 }); 638 });
666 Expect.throws(() { 639 Expect.throws(() {
667 x14 = confuse(f14); 640 x14 = confuse(f14);
668 }); 641 });
669 List<T> Function([List<Function> x1]) Function() l14; 642 List<T> Function([List<Function> x1]) Function() l14;
670 Expect.throws(() { 643 Expect.throws(() {
671 l14 = (f14 as dynamic); 644 l14 = (f14 as dynamic);
672 }); 645 });
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 x15 = confuse(m15); 677 x15 = confuse(m15);
705 l15 = confuse(m15); 678 l15 = confuse(m15);
706 if (!tIsBool) { 679 if (!tIsBool) {
707 Expect.isTrue(f15 is F15<int>); 680 Expect.isTrue(f15 is F15<int>);
708 Expect.isFalse(f15 is F15<bool>); 681 Expect.isFalse(f15 is F15<bool>);
709 Expect.isTrue(confuse(f15) is F15<int>); 682 Expect.isTrue(confuse(f15) is F15<int>);
710 Expect.isFalse(confuse(f15) is F15<bool>); 683 Expect.isFalse(confuse(f15) is F15<bool>);
711 Expect.equals(tIsDynamic, m15 is F15<bool>); 684 Expect.equals(tIsDynamic, m15 is F15<bool>);
712 Expect.equals(tIsDynamic, confuse(m15) is F15<bool>); 685 Expect.equals(tIsDynamic, confuse(m15) is F15<bool>);
713 } else { 686 } else {
714 if (inCheckedMode) { 687 if (typeAssertionsEnabled) {
715 Expect.throws(() { 688 Expect.throws(() {
716 x15 = (f15 as dynamic); 689 x15 = (f15 as dynamic);
717 }); 690 });
718 Expect.throws(() { 691 Expect.throws(() {
719 x15 = confuse(f15); 692 x15 = confuse(f15);
720 }); 693 });
721 List<T> Function({List<T> x}) Function() l15; 694 List<T> Function({List<T> x}) Function() l15;
722 Expect.throws(() { 695 Expect.throws(() {
723 l15 = (f15 as dynamic); 696 l15 = (f15 as dynamic);
724 }); 697 });
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 x17 = confuse(m17); 753 x17 = confuse(m17);
781 l17 = confuse(m17); 754 l17 = confuse(m17);
782 if (!tIsBool) { 755 if (!tIsBool) {
783 Expect.isTrue(f17 is F17<int>); 756 Expect.isTrue(f17 is F17<int>);
784 Expect.isFalse(f17 is F17<bool>); 757 Expect.isFalse(f17 is F17<bool>);
785 Expect.isTrue(confuse(f17) is F17<int>); 758 Expect.isTrue(confuse(f17) is F17<int>);
786 Expect.isFalse(confuse(f17) is F17<bool>); 759 Expect.isFalse(confuse(f17) is F17<bool>);
787 Expect.equals(tIsDynamic, m17 is F17<bool>); 760 Expect.equals(tIsDynamic, m17 is F17<bool>);
788 Expect.equals(tIsDynamic, confuse(m17) is F17<bool>); 761 Expect.equals(tIsDynamic, confuse(m17) is F17<bool>);
789 } else { 762 } else {
790 if (inCheckedMode) { 763 if (typeAssertionsEnabled) {
791 Expect.throws(() { 764 Expect.throws(() {
792 x17 = (f17 as dynamic); 765 x17 = (f17 as dynamic);
793 }); 766 });
794 Expect.throws(() { 767 Expect.throws(() {
795 x17 = confuse(f17); 768 x17 = confuse(f17);
796 }); 769 });
797 Function(int x0, [List<T> x]) Function() l17; 770 Function(int x0, [List<T> x]) Function() l17;
798 Expect.throws(() { 771 Expect.throws(() {
799 l17 = (f17 as dynamic); 772 l17 = (f17 as dynamic);
800 }); 773 });
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
905 x21 = confuse(m21); 878 x21 = confuse(m21);
906 l21 = confuse(m21); 879 l21 = confuse(m21);
907 if (!tIsBool) { 880 if (!tIsBool) {
908 Expect.isTrue(f21 is F21<int>); 881 Expect.isTrue(f21 is F21<int>);
909 Expect.isFalse(f21 is F21<bool>); 882 Expect.isFalse(f21 is F21<bool>);
910 Expect.isTrue(confuse(f21) is F21<int>); 883 Expect.isTrue(confuse(f21) is F21<int>);
911 Expect.isFalse(confuse(f21) is F21<bool>); 884 Expect.isFalse(confuse(f21) is F21<bool>);
912 Expect.equals(tIsDynamic, m21 is F21<bool>); 885 Expect.equals(tIsDynamic, m21 is F21<bool>);
913 Expect.equals(tIsDynamic, confuse(m21) is F21<bool>); 886 Expect.equals(tIsDynamic, confuse(m21) is F21<bool>);
914 } else { 887 } else {
915 if (inCheckedMode) { 888 if (typeAssertionsEnabled) {
916 Expect.throws(() { 889 Expect.throws(() {
917 x21 = (f21 as dynamic); 890 x21 = (f21 as dynamic);
918 }); 891 });
919 Expect.throws(() { 892 Expect.throws(() {
920 x21 = confuse(f21); 893 x21 = confuse(f21);
921 }); 894 });
922 List<T> Function<A>(List<Function> x) Function() l21; 895 List<T> Function<A>(List<Function> x) Function() l21;
923 Expect.throws(() { 896 Expect.throws(() {
924 l21 = (f21 as dynamic); 897 l21 = (f21 as dynamic);
925 }); 898 });
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 x22 = confuse(m22); 930 x22 = confuse(m22);
958 l22 = confuse(m22); 931 l22 = confuse(m22);
959 } 932 }
960 } 933 }
961 934
962 void main() { 935 void main() {
963 new U68().runTests(); 936 new U68().runTests();
964 new U68<int>(tIsInt: true).runTests(); 937 new U68<int>(tIsInt: true).runTests();
965 new U68<bool>(tIsBool: true).runTests(); 938 new U68<bool>(tIsBool: true).runTests();
966 } 939 }
OLDNEW
« no previous file with comments | « tests/language/function_type/function_type67_test.dart ('k') | tests/language/function_type/function_type69_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698