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

Side by Side Diff: tests/language/function_type/function_type24_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 x0, [List<Function> x]);
23 bool result = false; 23 typedef F1<T> = List<Function> Function([Function x]);
24 assert(result = true); 24 typedef F2<T> = List<T> Function(int x);
25 return result; 25 typedef F3<T> = Function(List<T> x);
26 })(); 26 typedef F4<T> = List<T> Function<A>(int x);
27 27 typedef F5<T> = int Function(Function x0) Function();
28 typedef F0<T> 28 typedef F6<T> = int Function(int x, [core.List<core.int> x2]) Function();
29 = int Function(int x0, [List<Function> x]); 29 typedef F7<T> = Function Function(int x0, {int x}) Function();
30 typedef F1<T> 30 typedef F8<T> = Function Function([core.List<core.int> x]) Function();
31 = List<Function> Function([Function x]); 31 typedef F9<T> = List<Function> Function(int y, [int x]) Function();
32 typedef F2<T> 32 typedef F10<T> = List<Function> Function(int x1, [List<Function> x2])
33 = List<T> Function(int x); 33 Function();
34 typedef F3<T> 34 typedef F11<T> = List<Function> Function(int x0, {List<T> x}) Function();
35 = Function(List<T> x); 35 typedef F12<T> = core.List<core.int> Function(List<Function> x) Function();
36 typedef F4<T> 36 typedef F13<T> = core.List<core.int> Function(int y, [List<T> x]) Function();
37 = List<T> Function<A>(int x); 37 typedef F14<T> = List<T> Function([Function x1]) Function();
38 typedef F5<T> 38 typedef F15<T> = List<T> Function({core.List<core.int> x}) Function();
39 = int Function(Function x0) Function(); 39 typedef F16<T> = Function(int y, {int x}) Function();
40 typedef F6<T> 40 typedef F17<T> = Function(int x0, [core.List<core.int> x]) Function();
41 = int Function(int x, [core.List<core.int> x2]) Function(); 41 typedef F18<T> = void Function(int x0) Function();
42 typedef F7<T> 42 typedef F19<T> = void Function(int x, [List<Function> x2]) Function();
43 = Function Function(int x0, {int x}) Function(); 43 typedef F20<T> = void Function(int y, {List<T> x}) Function();
44 typedef F8<T> 44 typedef F21<T> = List<Function> Function<A>(List<A> x) Function();
45 = Function Function([core.List<core.int> x]) Function(); 45 typedef F22<T> = A Function<A>(int x) Function();
46 typedef F9<T> 46 typedef F23<T> = List<Function> Function(B x) Function<B extends core.int>();
47 = List<Function> Function(int y, [int x]) Function();
48 typedef F10<T>
49 = List<Function> Function(int x1, [List<Function> x2]) Function();
50 typedef F11<T>
51 = List<Function> Function(int x0, {List<T> x}) Function();
52 typedef F12<T>
53 = core.List<core.int> Function(List<Function> x) Function();
54 typedef F13<T>
55 = core.List<core.int> Function(int y, [List<T> x]) Function();
56 typedef F14<T>
57 = List<T> Function([Function x1]) Function();
58 typedef F15<T>
59 = List<T> Function({core.List<core.int> x}) Function();
60 typedef F16<T>
61 = Function(int y, {int x}) Function();
62 typedef F17<T>
63 = Function(int x0, [core.List<core.int> x]) Function();
64 typedef F18<T>
65 = void Function(int x0) Function();
66 typedef F19<T>
67 = void Function(int x, [List<Function> x2]) Function();
68 typedef F20<T>
69 = void Function(int y, {List<T> x}) Function();
70 typedef F21<T>
71 = List<Function> Function<A>(List<A> x) Function();
72 typedef F22<T>
73 = A Function<A>(int x) Function();
74 typedef F23<T>
75 = List<Function> Function(B x) Function<B extends core.int>();
76 47
77 int f0(int x0, [List<Function> x]) => null; 48 int f0(int x0, [List<Function> x]) => null;
78 List<Function> f1([Function x]) => null; 49 List<Function> f1([Function x]) => null;
79 List<int> f2(int x) => null; 50 List<int> f2(int x) => null;
80 f3(List<int> x) => null; 51 f3(List<int> x) => null;
81 List<int> f4<A>(int x) => null; 52 List<int> f4<A>(int x) => null;
82 int Function(Function x0) f5() => null; 53 int Function(Function x0) f5() => null;
83 int Function(int x, [core.List<core.int> x0]) f6() => null; 54 int Function(int x, [core.List<core.int> x0]) f6() => null;
84 Function Function(int x0, {int x}) f7() => null; 55 Function Function(int x0, {int x}) f7() => null;
85 Function Function([core.List<core.int> x]) f8() => null; 56 Function Function([core.List<core.int> x]) f8() => null;
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 x2 = confuse(m2); 226 x2 = confuse(m2);
256 l2 = confuse(m2); 227 l2 = confuse(m2);
257 if (!tIsBool) { 228 if (!tIsBool) {
258 Expect.isTrue(f2 is F2<int>); 229 Expect.isTrue(f2 is F2<int>);
259 Expect.isFalse(f2 is F2<bool>); 230 Expect.isFalse(f2 is F2<bool>);
260 Expect.isTrue(confuse(f2) is F2<int>); 231 Expect.isTrue(confuse(f2) is F2<int>);
261 Expect.isFalse(confuse(f2) is F2<bool>); 232 Expect.isFalse(confuse(f2) is F2<bool>);
262 Expect.equals(tIsDynamic, m2 is F2<bool>); 233 Expect.equals(tIsDynamic, m2 is F2<bool>);
263 Expect.equals(tIsDynamic, confuse(m2) is F2<bool>); 234 Expect.equals(tIsDynamic, confuse(m2) is F2<bool>);
264 } else { 235 } else {
265 if (inCheckedMode) { 236 if (typeAssertionsEnabled) {
266 Expect.throws(() { 237 Expect.throws(() {
267 x2 = (f2 as dynamic); 238 x2 = (f2 as dynamic);
268 }); 239 });
269 Expect.throws(() { 240 Expect.throws(() {
270 x2 = confuse(f2); 241 x2 = confuse(f2);
271 }); 242 });
272 List<T> Function(int x) l2; 243 List<T> Function(int x) l2;
273 Expect.throws(() { 244 Expect.throws(() {
274 l2 = (f2 as dynamic); 245 l2 = (f2 as dynamic);
275 }); 246 });
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 x3 = confuse(m3); 278 x3 = confuse(m3);
308 l3 = confuse(m3); 279 l3 = confuse(m3);
309 if (!tIsBool) { 280 if (!tIsBool) {
310 Expect.isTrue(f3 is F3<int>); 281 Expect.isTrue(f3 is F3<int>);
311 Expect.isFalse(f3 is F3<bool>); 282 Expect.isFalse(f3 is F3<bool>);
312 Expect.isTrue(confuse(f3) is F3<int>); 283 Expect.isTrue(confuse(f3) is F3<int>);
313 Expect.isFalse(confuse(f3) is F3<bool>); 284 Expect.isFalse(confuse(f3) is F3<bool>);
314 Expect.equals(tIsDynamic, m3 is F3<bool>); 285 Expect.equals(tIsDynamic, m3 is F3<bool>);
315 Expect.equals(tIsDynamic, confuse(m3) is F3<bool>); 286 Expect.equals(tIsDynamic, confuse(m3) is F3<bool>);
316 } else { 287 } else {
317 if (inCheckedMode) { 288 if (typeAssertionsEnabled) {
318 Expect.throws(() { 289 Expect.throws(() {
319 x3 = (f3 as dynamic); 290 x3 = (f3 as dynamic);
320 }); 291 });
321 Expect.throws(() { 292 Expect.throws(() {
322 x3 = confuse(f3); 293 x3 = confuse(f3);
323 }); 294 });
324 Function(List<T> x) l3; 295 Function(List<T> x) l3;
325 Expect.throws(() { 296 Expect.throws(() {
326 l3 = (f3 as dynamic); 297 l3 = (f3 as dynamic);
327 }); 298 });
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 x4 = confuse(m4); 330 x4 = confuse(m4);
360 l4 = confuse(m4); 331 l4 = confuse(m4);
361 if (!tIsBool) { 332 if (!tIsBool) {
362 Expect.isTrue(f4 is F4<int>); 333 Expect.isTrue(f4 is F4<int>);
363 Expect.isFalse(f4 is F4<bool>); 334 Expect.isFalse(f4 is F4<bool>);
364 Expect.isTrue(confuse(f4) is F4<int>); 335 Expect.isTrue(confuse(f4) is F4<int>);
365 Expect.isFalse(confuse(f4) is F4<bool>); 336 Expect.isFalse(confuse(f4) is F4<bool>);
366 Expect.equals(tIsDynamic, m4 is F4<bool>); 337 Expect.equals(tIsDynamic, m4 is F4<bool>);
367 Expect.equals(tIsDynamic, confuse(m4) is F4<bool>); 338 Expect.equals(tIsDynamic, confuse(m4) is F4<bool>);
368 } else { 339 } else {
369 if (inCheckedMode) { 340 if (typeAssertionsEnabled) {
370 Expect.throws(() { 341 Expect.throws(() {
371 x4 = (f4 as dynamic); 342 x4 = (f4 as dynamic);
372 }); 343 });
373 Expect.throws(() { 344 Expect.throws(() {
374 x4 = confuse(f4); 345 x4 = confuse(f4);
375 }); 346 });
376 List<T> Function<A>(int x) l4; 347 List<T> Function<A>(int x) l4;
377 Expect.throws(() { 348 Expect.throws(() {
378 l4 = (f4 as dynamic); 349 l4 = (f4 as dynamic);
379 }); 350 });
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 x11 = confuse(m11); 529 x11 = confuse(m11);
559 l11 = confuse(m11); 530 l11 = confuse(m11);
560 if (!tIsBool) { 531 if (!tIsBool) {
561 Expect.isTrue(f11 is F11<int>); 532 Expect.isTrue(f11 is F11<int>);
562 Expect.isFalse(f11 is F11<bool>); 533 Expect.isFalse(f11 is F11<bool>);
563 Expect.isTrue(confuse(f11) is F11<int>); 534 Expect.isTrue(confuse(f11) is F11<int>);
564 Expect.isFalse(confuse(f11) is F11<bool>); 535 Expect.isFalse(confuse(f11) is F11<bool>);
565 Expect.equals(tIsDynamic, m11 is F11<bool>); 536 Expect.equals(tIsDynamic, m11 is F11<bool>);
566 Expect.equals(tIsDynamic, confuse(m11) is F11<bool>); 537 Expect.equals(tIsDynamic, confuse(m11) is F11<bool>);
567 } else { 538 } else {
568 if (inCheckedMode) { 539 if (typeAssertionsEnabled) {
569 Expect.throws(() { 540 Expect.throws(() {
570 x11 = (f11 as dynamic); 541 x11 = (f11 as dynamic);
571 }); 542 });
572 Expect.throws(() { 543 Expect.throws(() {
573 x11 = confuse(f11); 544 x11 = confuse(f11);
574 }); 545 });
575 List<Function> Function(int x0, {List<T> x}) Function() l11; 546 List<Function> Function(int x0, {List<T> x}) Function() l11;
576 Expect.throws(() { 547 Expect.throws(() {
577 l11 = (f11 as dynamic); 548 l11 = (f11 as dynamic);
578 }); 549 });
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 x13 = confuse(m13); 607 x13 = confuse(m13);
637 l13 = confuse(m13); 608 l13 = confuse(m13);
638 if (!tIsBool) { 609 if (!tIsBool) {
639 Expect.isTrue(f13 is F13<int>); 610 Expect.isTrue(f13 is F13<int>);
640 Expect.isFalse(f13 is F13<bool>); 611 Expect.isFalse(f13 is F13<bool>);
641 Expect.isTrue(confuse(f13) is F13<int>); 612 Expect.isTrue(confuse(f13) is F13<int>);
642 Expect.isFalse(confuse(f13) is F13<bool>); 613 Expect.isFalse(confuse(f13) is F13<bool>);
643 Expect.equals(tIsDynamic, m13 is F13<bool>); 614 Expect.equals(tIsDynamic, m13 is F13<bool>);
644 Expect.equals(tIsDynamic, confuse(m13) is F13<bool>); 615 Expect.equals(tIsDynamic, confuse(m13) is F13<bool>);
645 } else { 616 } else {
646 if (inCheckedMode) { 617 if (typeAssertionsEnabled) {
647 Expect.throws(() { 618 Expect.throws(() {
648 x13 = (f13 as dynamic); 619 x13 = (f13 as dynamic);
649 }); 620 });
650 Expect.throws(() { 621 Expect.throws(() {
651 x13 = confuse(f13); 622 x13 = confuse(f13);
652 }); 623 });
653 core.List<core.int> Function(int y, [List<T> x]) Function() l13; 624 core.List<core.int> Function(int y, [List<T> x]) Function() l13;
654 Expect.throws(() { 625 Expect.throws(() {
655 l13 = (f13 as dynamic); 626 l13 = (f13 as dynamic);
656 }); 627 });
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 x14 = confuse(m14); 659 x14 = confuse(m14);
689 l14 = confuse(m14); 660 l14 = confuse(m14);
690 if (!tIsBool) { 661 if (!tIsBool) {
691 Expect.isTrue(f14 is F14<int>); 662 Expect.isTrue(f14 is F14<int>);
692 Expect.isFalse(f14 is F14<bool>); 663 Expect.isFalse(f14 is F14<bool>);
693 Expect.isTrue(confuse(f14) is F14<int>); 664 Expect.isTrue(confuse(f14) is F14<int>);
694 Expect.isFalse(confuse(f14) is F14<bool>); 665 Expect.isFalse(confuse(f14) is F14<bool>);
695 Expect.equals(tIsDynamic, m14 is F14<bool>); 666 Expect.equals(tIsDynamic, m14 is F14<bool>);
696 Expect.equals(tIsDynamic, confuse(m14) is F14<bool>); 667 Expect.equals(tIsDynamic, confuse(m14) is F14<bool>);
697 } else { 668 } else {
698 if (inCheckedMode) { 669 if (typeAssertionsEnabled) {
699 Expect.throws(() { 670 Expect.throws(() {
700 x14 = (f14 as dynamic); 671 x14 = (f14 as dynamic);
701 }); 672 });
702 Expect.throws(() { 673 Expect.throws(() {
703 x14 = confuse(f14); 674 x14 = confuse(f14);
704 }); 675 });
705 List<T> Function([Function x1]) Function() l14; 676 List<T> Function([Function x1]) Function() l14;
706 Expect.throws(() { 677 Expect.throws(() {
707 l14 = (f14 as dynamic); 678 l14 = (f14 as dynamic);
708 }); 679 });
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 x15 = confuse(m15); 711 x15 = confuse(m15);
741 l15 = confuse(m15); 712 l15 = confuse(m15);
742 if (!tIsBool) { 713 if (!tIsBool) {
743 Expect.isTrue(f15 is F15<int>); 714 Expect.isTrue(f15 is F15<int>);
744 Expect.isFalse(f15 is F15<bool>); 715 Expect.isFalse(f15 is F15<bool>);
745 Expect.isTrue(confuse(f15) is F15<int>); 716 Expect.isTrue(confuse(f15) is F15<int>);
746 Expect.isFalse(confuse(f15) is F15<bool>); 717 Expect.isFalse(confuse(f15) is F15<bool>);
747 Expect.equals(tIsDynamic, m15 is F15<bool>); 718 Expect.equals(tIsDynamic, m15 is F15<bool>);
748 Expect.equals(tIsDynamic, confuse(m15) is F15<bool>); 719 Expect.equals(tIsDynamic, confuse(m15) is F15<bool>);
749 } else { 720 } else {
750 if (inCheckedMode) { 721 if (typeAssertionsEnabled) {
751 Expect.throws(() { 722 Expect.throws(() {
752 x15 = (f15 as dynamic); 723 x15 = (f15 as dynamic);
753 }); 724 });
754 Expect.throws(() { 725 Expect.throws(() {
755 x15 = confuse(f15); 726 x15 = confuse(f15);
756 }); 727 });
757 List<T> Function({core.List<core.int> x}) Function() l15; 728 List<T> Function({core.List<core.int> x}) Function() l15;
758 Expect.throws(() { 729 Expect.throws(() {
759 l15 = (f15 as dynamic); 730 l15 = (f15 as dynamic);
760 }); 731 });
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 x20 = confuse(m20); 859 x20 = confuse(m20);
889 l20 = confuse(m20); 860 l20 = confuse(m20);
890 if (!tIsBool) { 861 if (!tIsBool) {
891 Expect.isTrue(f20 is F20<int>); 862 Expect.isTrue(f20 is F20<int>);
892 Expect.isFalse(f20 is F20<bool>); 863 Expect.isFalse(f20 is F20<bool>);
893 Expect.isTrue(confuse(f20) is F20<int>); 864 Expect.isTrue(confuse(f20) is F20<int>);
894 Expect.isFalse(confuse(f20) is F20<bool>); 865 Expect.isFalse(confuse(f20) is F20<bool>);
895 Expect.equals(tIsDynamic, m20 is F20<bool>); 866 Expect.equals(tIsDynamic, m20 is F20<bool>);
896 Expect.equals(tIsDynamic, confuse(m20) is F20<bool>); 867 Expect.equals(tIsDynamic, confuse(m20) is F20<bool>);
897 } else { 868 } else {
898 if (inCheckedMode) { 869 if (typeAssertionsEnabled) {
899 Expect.throws(() { 870 Expect.throws(() {
900 x20 = (f20 as dynamic); 871 x20 = (f20 as dynamic);
901 }); 872 });
902 Expect.throws(() { 873 Expect.throws(() {
903 x20 = confuse(f20); 874 x20 = confuse(f20);
904 }); 875 });
905 void Function(int y, {List<T> x}) Function() l20; 876 void Function(int y, {List<T> x}) Function() l20;
906 Expect.throws(() { 877 Expect.throws(() {
907 l20 = (f20 as dynamic); 878 l20 = (f20 as dynamic);
908 }); 879 });
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
989 x23 = confuse(m23); 960 x23 = confuse(m23);
990 l23 = confuse(m23); 961 l23 = confuse(m23);
991 } 962 }
992 } 963 }
993 964
994 void main() { 965 void main() {
995 new U24().runTests(); 966 new U24().runTests();
996 new U24<int>(tIsInt: true).runTests(); 967 new U24<int>(tIsInt: true).runTests();
997 new U24<bool>(tIsBool: true).runTests(); 968 new U24<bool>(tIsBool: true).runTests();
998 } 969 }
OLDNEW
« no previous file with comments | « tests/language/function_type/function_type23_test.dart ('k') | tests/language/function_type/function_type25_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698