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

Side by Side Diff: tests/language/function_type/function_type84_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(int x1, [List<Function> x2]);
23 bool result = false; 23 typedef F1<T> = core.List<core.int> Function([Function x1]);
24 assert(result = true); 24 typedef F2<T> = Function(int x0);
25 return result; 25 typedef F3<T> = void Function(List<T> x0);
26 })(); 26 typedef F4<T> = int Function([int x1]) Function();
27 27 typedef F5<T> = int Function({List<Function> x}) Function();
28 typedef F0<T> 28 typedef F6<T> = int Function() Function();
29 = Function Function(int x1, [List<Function> x2]); 29 typedef F7<T> = Function Function(int x0, [List<Function> x]) Function();
30 typedef F1<T> 30 typedef F8<T> = Function Function([List<T> x1]) Function();
31 = core.List<core.int> Function([Function x1]); 31 typedef F9<T> = List<Function> Function(int x, [Function x2]) Function();
32 typedef F2<T> 32 typedef F10<T> = List<Function> Function(int y, {core.List<core.int> x})
33 = Function(int x0); 33 Function();
34 typedef F3<T> 34 typedef F11<T> = core.List<core.int> Function([Function x]) Function();
35 = void Function(List<T> x0); 35 typedef F12<T> = core.List<core.int> Function(core.List<core.int> x0)
36 typedef F4<T> 36 Function();
37 = int Function([int x1]) Function(); 37 typedef F13<T> = List<T> Function(int x1, [int x2]) Function();
38 typedef F5<T> 38 typedef F14<T> = List<T> Function(int x0, {List<Function> x}) Function();
39 = int Function({List<Function> x}) Function(); 39 typedef F15<T> = Function(int x) Function();
40 typedef F6<T> 40 typedef F16<T> = Function(int y, [List<Function> x]) Function();
41 = int Function() Function(); 41 typedef F17<T> = Function(int x1, [List<T> x2]) Function();
42 typedef F7<T> 42 typedef F18<T> = void Function({Function x}) Function();
43 = Function Function(int x0, [List<Function> x]) Function(); 43 typedef F19<T> = void Function(List<T> x) Function();
44 typedef F8<T> 44 typedef F20<T> = Function Function<A>() Function();
45 = Function Function([List<T> x1]) Function(); 45 typedef F21<T> = List<T> Function<A>(A x) Function();
46 typedef F9<T> 46 typedef F22<T> = List<A> Function<A>(List<A> x) Function();
47 = List<Function> Function(int x, [Function x2]) Function();
48 typedef F10<T>
49 = List<Function> Function(int y, {core.List<core.int> x}) Function();
50 typedef F11<T>
51 = core.List<core.int> Function([Function x]) Function();
52 typedef F12<T>
53 = core.List<core.int> Function(core.List<core.int> x0) Function();
54 typedef F13<T>
55 = List<T> Function(int x1, [int x2]) Function();
56 typedef F14<T>
57 = List<T> Function(int x0, {List<Function> x}) Function();
58 typedef F15<T>
59 = Function(int x) Function();
60 typedef F16<T>
61 = Function(int y, [List<Function> x]) Function();
62 typedef F17<T>
63 = Function(int x1, [List<T> x2]) Function();
64 typedef F18<T>
65 = void Function({Function x}) Function();
66 typedef F19<T>
67 = void Function(List<T> x) Function();
68 typedef F20<T>
69 = Function Function<A>() Function();
70 typedef F21<T>
71 = List<T> Function<A>(A x) Function();
72 typedef F22<T>
73 = List<A> Function<A>(List<A> x) Function();
74 47
75 Function f0(int x0, [List<Function> x1]) => null; 48 Function f0(int x0, [List<Function> x1]) => null;
76 core.List<core.int> f1([Function x0]) => null; 49 core.List<core.int> f1([Function x0]) => null;
77 f2(int x0) => null; 50 f2(int x0) => null;
78 void f3(List<int> x0) => null; 51 void f3(List<int> x0) => null;
79 int Function([int x0]) f4() => null; 52 int Function([int x0]) f4() => null;
80 int Function({List<Function> x}) f5() => null; 53 int Function({List<Function> x}) f5() => null;
81 int Function() f6() => null; 54 int Function() f6() => null;
82 Function Function(int x0, [List<Function> x]) f7() => null; 55 Function Function(int x0, [List<Function> x]) f7() => null;
83 Function Function([List<int> x0]) f8() => null; 56 Function Function([List<int> x0]) f8() => null;
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 x3 = confuse(m3); 246 x3 = confuse(m3);
274 l3 = confuse(m3); 247 l3 = confuse(m3);
275 if (!tIsBool) { 248 if (!tIsBool) {
276 Expect.isTrue(f3 is F3<int>); 249 Expect.isTrue(f3 is F3<int>);
277 Expect.isFalse(f3 is F3<bool>); 250 Expect.isFalse(f3 is F3<bool>);
278 Expect.isTrue(confuse(f3) is F3<int>); 251 Expect.isTrue(confuse(f3) is F3<int>);
279 Expect.isFalse(confuse(f3) is F3<bool>); 252 Expect.isFalse(confuse(f3) is F3<bool>);
280 Expect.equals(tIsDynamic, m3 is F3<bool>); 253 Expect.equals(tIsDynamic, m3 is F3<bool>);
281 Expect.equals(tIsDynamic, confuse(m3) is F3<bool>); 254 Expect.equals(tIsDynamic, confuse(m3) is F3<bool>);
282 } else { 255 } else {
283 if (inCheckedMode) { 256 if (typeAssertionsEnabled) {
284 Expect.throws(() { 257 Expect.throws(() {
285 x3 = (f3 as dynamic); 258 x3 = (f3 as dynamic);
286 }); 259 });
287 Expect.throws(() { 260 Expect.throws(() {
288 x3 = confuse(f3); 261 x3 = confuse(f3);
289 }); 262 });
290 void Function(List<T> x0) l3; 263 void Function(List<T> x0) l3;
291 Expect.throws(() { 264 Expect.throws(() {
292 l3 = (f3 as dynamic); 265 l3 = (f3 as dynamic);
293 }); 266 });
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 x8 = confuse(m8); 395 x8 = confuse(m8);
423 l8 = confuse(m8); 396 l8 = confuse(m8);
424 if (!tIsBool) { 397 if (!tIsBool) {
425 Expect.isTrue(f8 is F8<int>); 398 Expect.isTrue(f8 is F8<int>);
426 Expect.isFalse(f8 is F8<bool>); 399 Expect.isFalse(f8 is F8<bool>);
427 Expect.isTrue(confuse(f8) is F8<int>); 400 Expect.isTrue(confuse(f8) is F8<int>);
428 Expect.isFalse(confuse(f8) is F8<bool>); 401 Expect.isFalse(confuse(f8) is F8<bool>);
429 Expect.equals(tIsDynamic, m8 is F8<bool>); 402 Expect.equals(tIsDynamic, m8 is F8<bool>);
430 Expect.equals(tIsDynamic, confuse(m8) is F8<bool>); 403 Expect.equals(tIsDynamic, confuse(m8) is F8<bool>);
431 } else { 404 } else {
432 if (inCheckedMode) { 405 if (typeAssertionsEnabled) {
433 Expect.throws(() { 406 Expect.throws(() {
434 x8 = (f8 as dynamic); 407 x8 = (f8 as dynamic);
435 }); 408 });
436 Expect.throws(() { 409 Expect.throws(() {
437 x8 = confuse(f8); 410 x8 = confuse(f8);
438 }); 411 });
439 Function Function([List<T> x1]) Function() l8; 412 Function Function([List<T> x1]) Function() l8;
440 Expect.throws(() { 413 Expect.throws(() {
441 l8 = (f8 as dynamic); 414 l8 = (f8 as dynamic);
442 }); 415 });
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 List<Function> Function(int y, {core.List<core.int> x}) Function() l10; 457 List<Function> Function(int y, {core.List<core.int> x}) Function() l10;
485 // The static function f10 sets `T` to `int`. 458 // The static function f10 sets `T` to `int`.
486 if (!tIsBool) { 459 if (!tIsBool) {
487 x10 = f10 as dynamic; 460 x10 = f10 as dynamic;
488 l10 = f10 as dynamic; 461 l10 = f10 as dynamic;
489 x10 = confuse(f10); 462 x10 = confuse(f10);
490 l10 = confuse(f10); 463 l10 = confuse(f10);
491 } 464 }
492 465
493 Expect.isTrue(m10 is F10); 466 Expect.isTrue(m10 is F10);
494 Expect.isTrue(m10 is List<Function> Function(int y, 467 Expect.isTrue(m10 is List<Function> Function(int y, {core.List<core.int> x})
495 {core.List<core.int> x}) Function()); 468 Function());
496 Expect.isTrue(confuse(m10) is F10); 469 Expect.isTrue(confuse(m10) is F10);
497 // In checked mode, verifies the type. 470 // In checked mode, verifies the type.
498 x10 = m10; 471 x10 = m10;
499 l10 = m10; 472 l10 = m10;
500 x10 = confuse(m10); 473 x10 = confuse(m10);
501 l10 = confuse(m10); 474 l10 = confuse(m10);
502 } 475 }
503 476
504 /// core.List<core.int> Function([Function x]) Function() 477 /// core.List<core.int> Function([Function x]) Function()
505 void testF11() { 478 void testF11() {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 x13 = confuse(m13); 546 x13 = confuse(m13);
574 l13 = confuse(m13); 547 l13 = confuse(m13);
575 if (!tIsBool) { 548 if (!tIsBool) {
576 Expect.isTrue(f13 is F13<int>); 549 Expect.isTrue(f13 is F13<int>);
577 Expect.isFalse(f13 is F13<bool>); 550 Expect.isFalse(f13 is F13<bool>);
578 Expect.isTrue(confuse(f13) is F13<int>); 551 Expect.isTrue(confuse(f13) is F13<int>);
579 Expect.isFalse(confuse(f13) is F13<bool>); 552 Expect.isFalse(confuse(f13) is F13<bool>);
580 Expect.equals(tIsDynamic, m13 is F13<bool>); 553 Expect.equals(tIsDynamic, m13 is F13<bool>);
581 Expect.equals(tIsDynamic, confuse(m13) is F13<bool>); 554 Expect.equals(tIsDynamic, confuse(m13) is F13<bool>);
582 } else { 555 } else {
583 if (inCheckedMode) { 556 if (typeAssertionsEnabled) {
584 Expect.throws(() { 557 Expect.throws(() {
585 x13 = (f13 as dynamic); 558 x13 = (f13 as dynamic);
586 }); 559 });
587 Expect.throws(() { 560 Expect.throws(() {
588 x13 = confuse(f13); 561 x13 = confuse(f13);
589 }); 562 });
590 List<T> Function(int x1, [int x2]) Function() l13; 563 List<T> Function(int x1, [int x2]) Function() l13;
591 Expect.throws(() { 564 Expect.throws(() {
592 l13 = (f13 as dynamic); 565 l13 = (f13 as dynamic);
593 }); 566 });
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 x14 = confuse(m14); 599 x14 = confuse(m14);
627 l14 = confuse(m14); 600 l14 = confuse(m14);
628 if (!tIsBool) { 601 if (!tIsBool) {
629 Expect.isTrue(f14 is F14<int>); 602 Expect.isTrue(f14 is F14<int>);
630 Expect.isFalse(f14 is F14<bool>); 603 Expect.isFalse(f14 is F14<bool>);
631 Expect.isTrue(confuse(f14) is F14<int>); 604 Expect.isTrue(confuse(f14) is F14<int>);
632 Expect.isFalse(confuse(f14) is F14<bool>); 605 Expect.isFalse(confuse(f14) is F14<bool>);
633 Expect.equals(tIsDynamic, m14 is F14<bool>); 606 Expect.equals(tIsDynamic, m14 is F14<bool>);
634 Expect.equals(tIsDynamic, confuse(m14) is F14<bool>); 607 Expect.equals(tIsDynamic, confuse(m14) is F14<bool>);
635 } else { 608 } else {
636 if (inCheckedMode) { 609 if (typeAssertionsEnabled) {
637 Expect.throws(() { 610 Expect.throws(() {
638 x14 = (f14 as dynamic); 611 x14 = (f14 as dynamic);
639 }); 612 });
640 Expect.throws(() { 613 Expect.throws(() {
641 x14 = confuse(f14); 614 x14 = confuse(f14);
642 }); 615 });
643 List<T> Function(int x0, {List<Function> x}) Function() l14; 616 List<T> Function(int x0, {List<Function> x}) Function() l14;
644 Expect.throws(() { 617 Expect.throws(() {
645 l14 = (f14 as dynamic); 618 l14 = (f14 as dynamic);
646 }); 619 });
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 x17 = confuse(m17); 699 x17 = confuse(m17);
727 l17 = confuse(m17); 700 l17 = confuse(m17);
728 if (!tIsBool) { 701 if (!tIsBool) {
729 Expect.isTrue(f17 is F17<int>); 702 Expect.isTrue(f17 is F17<int>);
730 Expect.isFalse(f17 is F17<bool>); 703 Expect.isFalse(f17 is F17<bool>);
731 Expect.isTrue(confuse(f17) is F17<int>); 704 Expect.isTrue(confuse(f17) is F17<int>);
732 Expect.isFalse(confuse(f17) is F17<bool>); 705 Expect.isFalse(confuse(f17) is F17<bool>);
733 Expect.equals(tIsDynamic, m17 is F17<bool>); 706 Expect.equals(tIsDynamic, m17 is F17<bool>);
734 Expect.equals(tIsDynamic, confuse(m17) is F17<bool>); 707 Expect.equals(tIsDynamic, confuse(m17) is F17<bool>);
735 } else { 708 } else {
736 if (inCheckedMode) { 709 if (typeAssertionsEnabled) {
737 Expect.throws(() { 710 Expect.throws(() {
738 x17 = (f17 as dynamic); 711 x17 = (f17 as dynamic);
739 }); 712 });
740 Expect.throws(() { 713 Expect.throws(() {
741 x17 = confuse(f17); 714 x17 = confuse(f17);
742 }); 715 });
743 Function(int x1, [List<T> x2]) Function() l17; 716 Function(int x1, [List<T> x2]) Function() l17;
744 Expect.throws(() { 717 Expect.throws(() {
745 l17 = (f17 as dynamic); 718 l17 = (f17 as dynamic);
746 }); 719 });
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 x19 = confuse(m19); 775 x19 = confuse(m19);
803 l19 = confuse(m19); 776 l19 = confuse(m19);
804 if (!tIsBool) { 777 if (!tIsBool) {
805 Expect.isTrue(f19 is F19<int>); 778 Expect.isTrue(f19 is F19<int>);
806 Expect.isFalse(f19 is F19<bool>); 779 Expect.isFalse(f19 is F19<bool>);
807 Expect.isTrue(confuse(f19) is F19<int>); 780 Expect.isTrue(confuse(f19) is F19<int>);
808 Expect.isFalse(confuse(f19) is F19<bool>); 781 Expect.isFalse(confuse(f19) is F19<bool>);
809 Expect.equals(tIsDynamic, m19 is F19<bool>); 782 Expect.equals(tIsDynamic, m19 is F19<bool>);
810 Expect.equals(tIsDynamic, confuse(m19) is F19<bool>); 783 Expect.equals(tIsDynamic, confuse(m19) is F19<bool>);
811 } else { 784 } else {
812 if (inCheckedMode) { 785 if (typeAssertionsEnabled) {
813 Expect.throws(() { 786 Expect.throws(() {
814 x19 = (f19 as dynamic); 787 x19 = (f19 as dynamic);
815 }); 788 });
816 Expect.throws(() { 789 Expect.throws(() {
817 x19 = confuse(f19); 790 x19 = confuse(f19);
818 }); 791 });
819 void Function(List<T> x) Function() l19; 792 void Function(List<T> x) Function() l19;
820 Expect.throws(() { 793 Expect.throws(() {
821 l19 = (f19 as dynamic); 794 l19 = (f19 as dynamic);
822 }); 795 });
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
878 x21 = confuse(m21); 851 x21 = confuse(m21);
879 l21 = confuse(m21); 852 l21 = confuse(m21);
880 if (!tIsBool) { 853 if (!tIsBool) {
881 Expect.isTrue(f21 is F21<int>); 854 Expect.isTrue(f21 is F21<int>);
882 Expect.isFalse(f21 is F21<bool>); 855 Expect.isFalse(f21 is F21<bool>);
883 Expect.isTrue(confuse(f21) is F21<int>); 856 Expect.isTrue(confuse(f21) is F21<int>);
884 Expect.isFalse(confuse(f21) is F21<bool>); 857 Expect.isFalse(confuse(f21) is F21<bool>);
885 Expect.equals(tIsDynamic, m21 is F21<bool>); 858 Expect.equals(tIsDynamic, m21 is F21<bool>);
886 Expect.equals(tIsDynamic, confuse(m21) is F21<bool>); 859 Expect.equals(tIsDynamic, confuse(m21) is F21<bool>);
887 } else { 860 } else {
888 if (inCheckedMode) { 861 if (typeAssertionsEnabled) {
889 Expect.throws(() { 862 Expect.throws(() {
890 x21 = (f21 as dynamic); 863 x21 = (f21 as dynamic);
891 }); 864 });
892 Expect.throws(() { 865 Expect.throws(() {
893 x21 = confuse(f21); 866 x21 = confuse(f21);
894 }); 867 });
895 List<T> Function<A>(A x) Function() l21; 868 List<T> Function<A>(A x) Function() l21;
896 Expect.throws(() { 869 Expect.throws(() {
897 l21 = (f21 as dynamic); 870 l21 = (f21 as dynamic);
898 }); 871 });
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
930 x22 = confuse(m22); 903 x22 = confuse(m22);
931 l22 = confuse(m22); 904 l22 = confuse(m22);
932 } 905 }
933 } 906 }
934 907
935 void main() { 908 void main() {
936 new U84().runTests(); 909 new U84().runTests();
937 new U84<int>(tIsInt: true).runTests(); 910 new U84<int>(tIsInt: true).runTests();
938 new U84<bool>(tIsBool: true).runTests(); 911 new U84<bool>(tIsBool: true).runTests();
939 } 912 }
OLDNEW
« no previous file with comments | « tests/language/function_type/function_type83_test.dart ('k') | tests/language/function_type/function_type85_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698