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

Side by Side Diff: tests/language/function_type/function_type48_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(List<T> x0);
23 bool result = false; 23 typedef F1<T> = List<Function> Function(int y, [core.List<core.int> x]);
24 assert(result = true); 24 typedef F2<T> = List<T> Function(int x0, [List<Function> x]);
25 return result; 25 typedef F3<T> = void Function([Function x]);
26 })(); 26 typedef F4<T> = List<A> Function<A>(int x);
27 27 typedef F5<T> = int Function(int y, {Function x}) Function();
28 typedef F0<T> 28 typedef F6<T> = int Function(int x0, [List<T> x]) Function();
29 = int Function(List<T> x0); 29 typedef F7<T> = Function Function(Function x0) Function();
30 typedef F1<T> 30 typedef F8<T> = Function Function(int x, [core.List<core.int> x2]) Function();
31 = List<Function> Function(int y, [core.List<core.int> x]); 31 typedef F9<T> = List<Function> Function(int x0, {int x}) Function();
32 typedef F2<T> 32 typedef F10<T> = List<Function> Function([core.List<core.int> x]) Function();
33 = List<T> Function(int x0, [List<Function> x]); 33 typedef F11<T> = core.List<core.int> Function(int y, [int x]) Function();
34 typedef F3<T> 34 typedef F12<T> = core.List<core.int> Function(int x1, [List<Function> x2])
35 = void Function([Function x]); 35 Function();
36 typedef F4<T> 36 typedef F13<T> = core.List<core.int> Function(int x0, {List<T> x}) Function();
37 = List<A> Function<A>(int x); 37 typedef F14<T> = List<T> Function(List<Function> x) Function();
38 typedef F5<T> 38 typedef F15<T> = List<T> Function(int y, [List<T> x]) Function();
39 = int Function(int y, {Function x}) Function(); 39 typedef F16<T> = Function([Function x1]) Function();
40 typedef F6<T> 40 typedef F17<T> = Function({core.List<core.int> x}) Function();
41 = int Function(int x0, [List<T> x]) Function(); 41 typedef F18<T> = void Function(int y, {int x}) Function();
42 typedef F7<T> 42 typedef F19<T> = void Function(int x0, [core.List<core.int> x]) Function();
43 = Function Function(Function x0) Function(); 43 typedef F20<T> = int Function<A>(List<T> x) Function();
44 typedef F8<T> 44 typedef F21<T> = core.List<core.int> Function<A>() Function();
45 = Function Function(int x, [core.List<core.int> x2]) Function(); 45 typedef F22<T> = A Function<A>(A x) Function();
46 typedef F9<T> 46 typedef F23<T> = B Function() Function<B extends core.int>();
47 = List<Function> Function(int x0, {int x}) Function();
48 typedef F10<T>
49 = List<Function> Function([core.List<core.int> x]) Function();
50 typedef F11<T>
51 = core.List<core.int> Function(int y, [int x]) Function();
52 typedef F12<T>
53 = core.List<core.int> Function(int x1, [List<Function> x2]) Function();
54 typedef F13<T>
55 = core.List<core.int> Function(int x0, {List<T> x}) Function();
56 typedef F14<T>
57 = List<T> Function(List<Function> x) Function();
58 typedef F15<T>
59 = List<T> Function(int y, [List<T> x]) Function();
60 typedef F16<T>
61 = Function([Function x1]) Function();
62 typedef F17<T>
63 = Function({core.List<core.int> x}) Function();
64 typedef F18<T>
65 = void Function(int y, {int x}) Function();
66 typedef F19<T>
67 = void Function(int x0, [core.List<core.int> x]) Function();
68 typedef F20<T>
69 = int Function<A>(List<T> x) Function();
70 typedef F21<T>
71 = core.List<core.int> Function<A>() Function();
72 typedef F22<T>
73 = A Function<A>(A x) Function();
74 typedef F23<T>
75 = B Function() Function<B extends core.int>();
76 47
77 int f0(List<int> x0) => null; 48 int f0(List<int> x0) => null;
78 List<Function> f1(int y, [core.List<core.int> x]) => null; 49 List<Function> f1(int y, [core.List<core.int> x]) => null;
79 List<int> f2(int x0, [List<Function> x]) => null; 50 List<int> f2(int x0, [List<Function> x]) => null;
80 void f3([Function x]) => null; 51 void f3([Function x]) => null;
81 List<A> f4<A>(int x) => null; 52 List<A> f4<A>(int x) => null;
82 int Function(int y, {Function x}) f5() => null; 53 int Function(int y, {Function x}) f5() => null;
83 int Function(int x0, [List<int> x]) f6() => null; 54 int Function(int x0, [List<int> x]) f6() => null;
84 Function Function(Function x0) f7() => null; 55 Function Function(Function x0) f7() => null;
85 Function Function(int x, [core.List<core.int> x0]) f8() => null; 56 Function Function(int x, [core.List<core.int> x0]) f8() => null;
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 x0 = confuse(m0); 178 x0 = confuse(m0);
208 l0 = confuse(m0); 179 l0 = confuse(m0);
209 if (!tIsBool) { 180 if (!tIsBool) {
210 Expect.isTrue(f0 is F0<int>); 181 Expect.isTrue(f0 is F0<int>);
211 Expect.isFalse(f0 is F0<bool>); 182 Expect.isFalse(f0 is F0<bool>);
212 Expect.isTrue(confuse(f0) is F0<int>); 183 Expect.isTrue(confuse(f0) is F0<int>);
213 Expect.isFalse(confuse(f0) is F0<bool>); 184 Expect.isFalse(confuse(f0) is F0<bool>);
214 Expect.equals(tIsDynamic, m0 is F0<bool>); 185 Expect.equals(tIsDynamic, m0 is F0<bool>);
215 Expect.equals(tIsDynamic, confuse(m0) is F0<bool>); 186 Expect.equals(tIsDynamic, confuse(m0) is F0<bool>);
216 } else { 187 } else {
217 if (inCheckedMode) { 188 if (typeAssertionsEnabled) {
218 Expect.throws(() { 189 Expect.throws(() {
219 x0 = (f0 as dynamic); 190 x0 = (f0 as dynamic);
220 }); 191 });
221 Expect.throws(() { 192 Expect.throws(() {
222 x0 = confuse(f0); 193 x0 = confuse(f0);
223 }); 194 });
224 int Function(List<T> x0) l0; 195 int Function(List<T> x0) l0;
225 Expect.throws(() { 196 Expect.throws(() {
226 l0 = (f0 as dynamic); 197 l0 = (f0 as dynamic);
227 }); 198 });
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 x2 = confuse(m2); 255 x2 = confuse(m2);
285 l2 = confuse(m2); 256 l2 = confuse(m2);
286 if (!tIsBool) { 257 if (!tIsBool) {
287 Expect.isTrue(f2 is F2<int>); 258 Expect.isTrue(f2 is F2<int>);
288 Expect.isFalse(f2 is F2<bool>); 259 Expect.isFalse(f2 is F2<bool>);
289 Expect.isTrue(confuse(f2) is F2<int>); 260 Expect.isTrue(confuse(f2) is F2<int>);
290 Expect.isFalse(confuse(f2) is F2<bool>); 261 Expect.isFalse(confuse(f2) is F2<bool>);
291 Expect.equals(tIsDynamic, m2 is F2<bool>); 262 Expect.equals(tIsDynamic, m2 is F2<bool>);
292 Expect.equals(tIsDynamic, confuse(m2) is F2<bool>); 263 Expect.equals(tIsDynamic, confuse(m2) is F2<bool>);
293 } else { 264 } else {
294 if (inCheckedMode) { 265 if (typeAssertionsEnabled) {
295 Expect.throws(() { 266 Expect.throws(() {
296 x2 = (f2 as dynamic); 267 x2 = (f2 as dynamic);
297 }); 268 });
298 Expect.throws(() { 269 Expect.throws(() {
299 x2 = confuse(f2); 270 x2 = confuse(f2);
300 }); 271 });
301 List<T> Function(int x0, [List<Function> x]) l2; 272 List<T> Function(int x0, [List<Function> x]) l2;
302 Expect.throws(() { 273 Expect.throws(() {
303 l2 = (f2 as dynamic); 274 l2 = (f2 as dynamic);
304 }); 275 });
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 x6 = confuse(m6); 379 x6 = confuse(m6);
409 l6 = confuse(m6); 380 l6 = confuse(m6);
410 if (!tIsBool) { 381 if (!tIsBool) {
411 Expect.isTrue(f6 is F6<int>); 382 Expect.isTrue(f6 is F6<int>);
412 Expect.isFalse(f6 is F6<bool>); 383 Expect.isFalse(f6 is F6<bool>);
413 Expect.isTrue(confuse(f6) is F6<int>); 384 Expect.isTrue(confuse(f6) is F6<int>);
414 Expect.isFalse(confuse(f6) is F6<bool>); 385 Expect.isFalse(confuse(f6) is F6<bool>);
415 Expect.equals(tIsDynamic, m6 is F6<bool>); 386 Expect.equals(tIsDynamic, m6 is F6<bool>);
416 Expect.equals(tIsDynamic, confuse(m6) is F6<bool>); 387 Expect.equals(tIsDynamic, confuse(m6) is F6<bool>);
417 } else { 388 } else {
418 if (inCheckedMode) { 389 if (typeAssertionsEnabled) {
419 Expect.throws(() { 390 Expect.throws(() {
420 x6 = (f6 as dynamic); 391 x6 = (f6 as dynamic);
421 }); 392 });
422 Expect.throws(() { 393 Expect.throws(() {
423 x6 = confuse(f6); 394 x6 = confuse(f6);
424 }); 395 });
425 int Function(int x0, [List<T> x]) Function() l6; 396 int Function(int x0, [List<T> x]) Function() l6;
426 Expect.throws(() { 397 Expect.throws(() {
427 l6 = (f6 as dynamic); 398 l6 = (f6 as dynamic);
428 }); 399 });
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 // The static function f12 sets `T` to `int`. 540 // The static function f12 sets `T` to `int`.
570 if (!tIsBool) { 541 if (!tIsBool) {
571 x12 = f12 as dynamic; 542 x12 = f12 as dynamic;
572 l12 = f12 as dynamic; 543 l12 = f12 as dynamic;
573 x12 = confuse(f12); 544 x12 = confuse(f12);
574 l12 = confuse(f12); 545 l12 = confuse(f12);
575 } 546 }
576 547
577 Expect.isTrue(m12 is F12); 548 Expect.isTrue(m12 is F12);
578 Expect.isTrue(m12 is core.List<core.int> Function(int x1, 549 Expect.isTrue(m12 is core.List<core.int> Function(int x1,
579 [List<Function> x2]) Function()); 550 [List<Function> x2])
551 Function());
580 Expect.isTrue(confuse(m12) is F12); 552 Expect.isTrue(confuse(m12) is F12);
581 // In checked mode, verifies the type. 553 // In checked mode, verifies the type.
582 x12 = m12; 554 x12 = m12;
583 l12 = m12; 555 l12 = m12;
584 x12 = confuse(m12); 556 x12 = confuse(m12);
585 l12 = confuse(m12); 557 l12 = confuse(m12);
586 } 558 }
587 559
588 /// core.List<core.int> Function(int x0, {List<T> x}) Function() 560 /// core.List<core.int> Function(int x0, {List<T> x}) Function()
589 void testF13() { 561 void testF13() {
(...skipping 19 matching lines...) Expand all
609 x13 = confuse(m13); 581 x13 = confuse(m13);
610 l13 = confuse(m13); 582 l13 = confuse(m13);
611 if (!tIsBool) { 583 if (!tIsBool) {
612 Expect.isTrue(f13 is F13<int>); 584 Expect.isTrue(f13 is F13<int>);
613 Expect.isFalse(f13 is F13<bool>); 585 Expect.isFalse(f13 is F13<bool>);
614 Expect.isTrue(confuse(f13) is F13<int>); 586 Expect.isTrue(confuse(f13) is F13<int>);
615 Expect.isFalse(confuse(f13) is F13<bool>); 587 Expect.isFalse(confuse(f13) is F13<bool>);
616 Expect.equals(tIsDynamic, m13 is F13<bool>); 588 Expect.equals(tIsDynamic, m13 is F13<bool>);
617 Expect.equals(tIsDynamic, confuse(m13) is F13<bool>); 589 Expect.equals(tIsDynamic, confuse(m13) is F13<bool>);
618 } else { 590 } else {
619 if (inCheckedMode) { 591 if (typeAssertionsEnabled) {
620 Expect.throws(() { 592 Expect.throws(() {
621 x13 = (f13 as dynamic); 593 x13 = (f13 as dynamic);
622 }); 594 });
623 Expect.throws(() { 595 Expect.throws(() {
624 x13 = confuse(f13); 596 x13 = confuse(f13);
625 }); 597 });
626 core.List<core.int> Function(int x0, {List<T> x}) Function() l13; 598 core.List<core.int> Function(int x0, {List<T> x}) Function() l13;
627 Expect.throws(() { 599 Expect.throws(() {
628 l13 = (f13 as dynamic); 600 l13 = (f13 as dynamic);
629 }); 601 });
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 x14 = confuse(m14); 633 x14 = confuse(m14);
662 l14 = confuse(m14); 634 l14 = confuse(m14);
663 if (!tIsBool) { 635 if (!tIsBool) {
664 Expect.isTrue(f14 is F14<int>); 636 Expect.isTrue(f14 is F14<int>);
665 Expect.isFalse(f14 is F14<bool>); 637 Expect.isFalse(f14 is F14<bool>);
666 Expect.isTrue(confuse(f14) is F14<int>); 638 Expect.isTrue(confuse(f14) is F14<int>);
667 Expect.isFalse(confuse(f14) is F14<bool>); 639 Expect.isFalse(confuse(f14) is F14<bool>);
668 Expect.equals(tIsDynamic, m14 is F14<bool>); 640 Expect.equals(tIsDynamic, m14 is F14<bool>);
669 Expect.equals(tIsDynamic, confuse(m14) is F14<bool>); 641 Expect.equals(tIsDynamic, confuse(m14) is F14<bool>);
670 } else { 642 } else {
671 if (inCheckedMode) { 643 if (typeAssertionsEnabled) {
672 Expect.throws(() { 644 Expect.throws(() {
673 x14 = (f14 as dynamic); 645 x14 = (f14 as dynamic);
674 }); 646 });
675 Expect.throws(() { 647 Expect.throws(() {
676 x14 = confuse(f14); 648 x14 = confuse(f14);
677 }); 649 });
678 List<T> Function(List<Function> x) Function() l14; 650 List<T> Function(List<Function> x) Function() l14;
679 Expect.throws(() { 651 Expect.throws(() {
680 l14 = (f14 as dynamic); 652 l14 = (f14 as dynamic);
681 }); 653 });
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 x15 = confuse(m15); 685 x15 = confuse(m15);
714 l15 = confuse(m15); 686 l15 = confuse(m15);
715 if (!tIsBool) { 687 if (!tIsBool) {
716 Expect.isTrue(f15 is F15<int>); 688 Expect.isTrue(f15 is F15<int>);
717 Expect.isFalse(f15 is F15<bool>); 689 Expect.isFalse(f15 is F15<bool>);
718 Expect.isTrue(confuse(f15) is F15<int>); 690 Expect.isTrue(confuse(f15) is F15<int>);
719 Expect.isFalse(confuse(f15) is F15<bool>); 691 Expect.isFalse(confuse(f15) is F15<bool>);
720 Expect.equals(tIsDynamic, m15 is F15<bool>); 692 Expect.equals(tIsDynamic, m15 is F15<bool>);
721 Expect.equals(tIsDynamic, confuse(m15) is F15<bool>); 693 Expect.equals(tIsDynamic, confuse(m15) is F15<bool>);
722 } else { 694 } else {
723 if (inCheckedMode) { 695 if (typeAssertionsEnabled) {
724 Expect.throws(() { 696 Expect.throws(() {
725 x15 = (f15 as dynamic); 697 x15 = (f15 as dynamic);
726 }); 698 });
727 Expect.throws(() { 699 Expect.throws(() {
728 x15 = confuse(f15); 700 x15 = confuse(f15);
729 }); 701 });
730 List<T> Function(int y, [List<T> x]) Function() l15; 702 List<T> Function(int y, [List<T> x]) Function() l15;
731 Expect.throws(() { 703 Expect.throws(() {
732 l15 = (f15 as dynamic); 704 l15 = (f15 as dynamic);
733 }); 705 });
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 x20 = confuse(m20); 834 x20 = confuse(m20);
863 l20 = confuse(m20); 835 l20 = confuse(m20);
864 if (!tIsBool) { 836 if (!tIsBool) {
865 Expect.isTrue(f20 is F20<int>); 837 Expect.isTrue(f20 is F20<int>);
866 Expect.isFalse(f20 is F20<bool>); 838 Expect.isFalse(f20 is F20<bool>);
867 Expect.isTrue(confuse(f20) is F20<int>); 839 Expect.isTrue(confuse(f20) is F20<int>);
868 Expect.isFalse(confuse(f20) is F20<bool>); 840 Expect.isFalse(confuse(f20) is F20<bool>);
869 Expect.equals(tIsDynamic, m20 is F20<bool>); 841 Expect.equals(tIsDynamic, m20 is F20<bool>);
870 Expect.equals(tIsDynamic, confuse(m20) is F20<bool>); 842 Expect.equals(tIsDynamic, confuse(m20) is F20<bool>);
871 } else { 843 } else {
872 if (inCheckedMode) { 844 if (typeAssertionsEnabled) {
873 Expect.throws(() { 845 Expect.throws(() {
874 x20 = (f20 as dynamic); 846 x20 = (f20 as dynamic);
875 }); 847 });
876 Expect.throws(() { 848 Expect.throws(() {
877 x20 = confuse(f20); 849 x20 = confuse(f20);
878 }); 850 });
879 int Function<A>(List<T> x) Function() l20; 851 int Function<A>(List<T> x) Function() l20;
880 Expect.throws(() { 852 Expect.throws(() {
881 l20 = (f20 as dynamic); 853 l20 = (f20 as dynamic);
882 }); 854 });
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
962 x23 = confuse(m23); 934 x23 = confuse(m23);
963 l23 = confuse(m23); 935 l23 = confuse(m23);
964 } 936 }
965 } 937 }
966 938
967 void main() { 939 void main() {
968 new U48().runTests(); 940 new U48().runTests();
969 new U48<int>(tIsInt: true).runTests(); 941 new U48<int>(tIsInt: true).runTests();
970 new U48<bool>(tIsBool: true).runTests(); 942 new U48<bool>(tIsBool: true).runTests();
971 } 943 }
OLDNEW
« no previous file with comments | « tests/language/function_type/function_type47_test.dart ('k') | tests/language/function_type/function_type49_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698