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

Side by Side Diff: tests/language/function_type/function_type28_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 x1, [List<Function> x2]);
23 bool result = false; 23 typedef F1<T> = List<Function> Function([Function x1]);
24 assert(result = true); 24 typedef F2<T> = List<T> Function(int x0);
25 return result; 25 typedef F3<T> = Function(List<T> x0);
26 })(); 26 typedef F4<T> = List<T> Function<A>(List<T> x);
27 27 typedef F5<T> = int Function([Function x1]) Function();
28 typedef F0<T> 28 typedef F6<T> = int Function({core.List<core.int> x}) Function();
29 = int Function(int x1, [List<Function> x2]); 29 typedef F7<T> = Function Function(int y, {int x}) Function();
30 typedef F1<T> 30 typedef F8<T> = Function Function(int x0, [core.List<core.int> x]) Function();
31 = List<Function> Function([Function x1]); 31 typedef F9<T> = List<Function> Function(int x0) Function();
32 typedef F2<T> 32 typedef F10<T> = List<Function> Function(int x, [List<Function> x2]) Function();
33 = List<T> Function(int x0); 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([List<Function> x]) Function();
35 = Function(List<T> x0); 35 typedef F13<T> = core.List<core.int> Function(List<T> x0) Function();
36 typedef F4<T> 36 typedef F14<T> = List<T> Function(int x1, [Function x2]) Function();
37 = List<T> Function<A>(List<T> x); 37 typedef F15<T> = List<T> Function(int x0, {core.List<core.int> x}) Function();
38 typedef F5<T> 38 typedef F16<T> = Function(Function x) Function();
39 = int Function([Function x1]) Function(); 39 typedef F17<T> = Function(int y, [core.List<core.int> x]) Function();
40 typedef F6<T> 40 typedef F18<T> = void Function([int x1]) Function();
41 = int Function({core.List<core.int> x}) Function(); 41 typedef F19<T> = void Function({List<Function> x}) Function();
42 typedef F7<T> 42 typedef F20<T> = void Function() Function();
43 = Function Function(int y, {int x}) Function(); 43 typedef F21<T> = core.List<core.int> Function<A>(int x) Function();
44 typedef F8<T> 44 typedef F22<T> = A Function<A>(Function x) Function();
45 = Function Function(int x0, [core.List<core.int> x]) Function(); 45 typedef F23<T> = List<T> Function(B x) Function<B extends core.int>();
46 typedef F9<T>
47 = List<Function> Function(int x0) Function();
48 typedef F10<T>
49 = List<Function> Function(int x, [List<Function> x2]) 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([List<Function> x]) Function();
54 typedef F13<T>
55 = core.List<core.int> Function(List<T> x0) Function();
56 typedef F14<T>
57 = List<T> Function(int x1, [Function x2]) Function();
58 typedef F15<T>
59 = List<T> Function(int x0, {core.List<core.int> x}) Function();
60 typedef F16<T>
61 = Function(Function x) Function();
62 typedef F17<T>
63 = Function(int y, [core.List<core.int> x]) Function();
64 typedef F18<T>
65 = void Function([int x1]) Function();
66 typedef F19<T>
67 = void Function({List<Function> x}) Function();
68 typedef F20<T>
69 = void Function() Function();
70 typedef F21<T>
71 = core.List<core.int> Function<A>(int x) Function();
72 typedef F22<T>
73 = A Function<A>(Function x) Function();
74 typedef F23<T>
75 = List<T> Function(B x) Function<B extends core.int>();
76 46
77 int f0(int x0, [List<Function> x1]) => null; 47 int f0(int x0, [List<Function> x1]) => null;
78 List<Function> f1([Function x0]) => null; 48 List<Function> f1([Function x0]) => null;
79 List<int> f2(int x0) => null; 49 List<int> f2(int x0) => null;
80 f3(List<int> x0) => null; 50 f3(List<int> x0) => null;
81 List<int> f4<A>(List<int> x) => null; 51 List<int> f4<A>(List<int> x) => null;
82 int Function([Function x0]) f5() => null; 52 int Function([Function x0]) f5() => null;
83 int Function({core.List<core.int> x}) f6() => null; 53 int Function({core.List<core.int> x}) f6() => null;
84 Function Function(int y, {int x}) f7() => null; 54 Function Function(int y, {int x}) f7() => null;
85 Function Function(int x0, [core.List<core.int> x]) f8() => null; 55 Function Function(int x0, [core.List<core.int> x]) f8() => null;
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 x2 = confuse(m2); 225 x2 = confuse(m2);
256 l2 = confuse(m2); 226 l2 = confuse(m2);
257 if (!tIsBool) { 227 if (!tIsBool) {
258 Expect.isTrue(f2 is F2<int>); 228 Expect.isTrue(f2 is F2<int>);
259 Expect.isFalse(f2 is F2<bool>); 229 Expect.isFalse(f2 is F2<bool>);
260 Expect.isTrue(confuse(f2) is F2<int>); 230 Expect.isTrue(confuse(f2) is F2<int>);
261 Expect.isFalse(confuse(f2) is F2<bool>); 231 Expect.isFalse(confuse(f2) is F2<bool>);
262 Expect.equals(tIsDynamic, m2 is F2<bool>); 232 Expect.equals(tIsDynamic, m2 is F2<bool>);
263 Expect.equals(tIsDynamic, confuse(m2) is F2<bool>); 233 Expect.equals(tIsDynamic, confuse(m2) is F2<bool>);
264 } else { 234 } else {
265 if (inCheckedMode) { 235 if (typeAssertionsEnabled) {
266 Expect.throws(() { 236 Expect.throws(() {
267 x2 = (f2 as dynamic); 237 x2 = (f2 as dynamic);
268 }); 238 });
269 Expect.throws(() { 239 Expect.throws(() {
270 x2 = confuse(f2); 240 x2 = confuse(f2);
271 }); 241 });
272 List<T> Function(int x0) l2; 242 List<T> Function(int x0) l2;
273 Expect.throws(() { 243 Expect.throws(() {
274 l2 = (f2 as dynamic); 244 l2 = (f2 as dynamic);
275 }); 245 });
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 x3 = confuse(m3); 277 x3 = confuse(m3);
308 l3 = confuse(m3); 278 l3 = confuse(m3);
309 if (!tIsBool) { 279 if (!tIsBool) {
310 Expect.isTrue(f3 is F3<int>); 280 Expect.isTrue(f3 is F3<int>);
311 Expect.isFalse(f3 is F3<bool>); 281 Expect.isFalse(f3 is F3<bool>);
312 Expect.isTrue(confuse(f3) is F3<int>); 282 Expect.isTrue(confuse(f3) is F3<int>);
313 Expect.isFalse(confuse(f3) is F3<bool>); 283 Expect.isFalse(confuse(f3) is F3<bool>);
314 Expect.equals(tIsDynamic, m3 is F3<bool>); 284 Expect.equals(tIsDynamic, m3 is F3<bool>);
315 Expect.equals(tIsDynamic, confuse(m3) is F3<bool>); 285 Expect.equals(tIsDynamic, confuse(m3) is F3<bool>);
316 } else { 286 } else {
317 if (inCheckedMode) { 287 if (typeAssertionsEnabled) {
318 Expect.throws(() { 288 Expect.throws(() {
319 x3 = (f3 as dynamic); 289 x3 = (f3 as dynamic);
320 }); 290 });
321 Expect.throws(() { 291 Expect.throws(() {
322 x3 = confuse(f3); 292 x3 = confuse(f3);
323 }); 293 });
324 Function(List<T> x0) l3; 294 Function(List<T> x0) l3;
325 Expect.throws(() { 295 Expect.throws(() {
326 l3 = (f3 as dynamic); 296 l3 = (f3 as dynamic);
327 }); 297 });
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 x4 = confuse(m4); 329 x4 = confuse(m4);
360 l4 = confuse(m4); 330 l4 = confuse(m4);
361 if (!tIsBool) { 331 if (!tIsBool) {
362 Expect.isTrue(f4 is F4<int>); 332 Expect.isTrue(f4 is F4<int>);
363 Expect.isFalse(f4 is F4<bool>); 333 Expect.isFalse(f4 is F4<bool>);
364 Expect.isTrue(confuse(f4) is F4<int>); 334 Expect.isTrue(confuse(f4) is F4<int>);
365 Expect.isFalse(confuse(f4) is F4<bool>); 335 Expect.isFalse(confuse(f4) is F4<bool>);
366 Expect.equals(tIsDynamic, m4 is F4<bool>); 336 Expect.equals(tIsDynamic, m4 is F4<bool>);
367 Expect.equals(tIsDynamic, confuse(m4) is F4<bool>); 337 Expect.equals(tIsDynamic, confuse(m4) is F4<bool>);
368 } else { 338 } else {
369 if (inCheckedMode) { 339 if (typeAssertionsEnabled) {
370 Expect.throws(() { 340 Expect.throws(() {
371 x4 = (f4 as dynamic); 341 x4 = (f4 as dynamic);
372 }); 342 });
373 Expect.throws(() { 343 Expect.throws(() {
374 x4 = confuse(f4); 344 x4 = confuse(f4);
375 }); 345 });
376 List<T> Function<A>(List<T> x) l4; 346 List<T> Function<A>(List<T> x) l4;
377 Expect.throws(() { 347 Expect.throws(() {
378 l4 = (f4 as dynamic); 348 l4 = (f4 as dynamic);
379 }); 349 });
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 x11 = confuse(m11); 528 x11 = confuse(m11);
559 l11 = confuse(m11); 529 l11 = confuse(m11);
560 if (!tIsBool) { 530 if (!tIsBool) {
561 Expect.isTrue(f11 is F11<int>); 531 Expect.isTrue(f11 is F11<int>);
562 Expect.isFalse(f11 is F11<bool>); 532 Expect.isFalse(f11 is F11<bool>);
563 Expect.isTrue(confuse(f11) is F11<int>); 533 Expect.isTrue(confuse(f11) is F11<int>);
564 Expect.isFalse(confuse(f11) is F11<bool>); 534 Expect.isFalse(confuse(f11) is F11<bool>);
565 Expect.equals(tIsDynamic, m11 is F11<bool>); 535 Expect.equals(tIsDynamic, m11 is F11<bool>);
566 Expect.equals(tIsDynamic, confuse(m11) is F11<bool>); 536 Expect.equals(tIsDynamic, confuse(m11) is F11<bool>);
567 } else { 537 } else {
568 if (inCheckedMode) { 538 if (typeAssertionsEnabled) {
569 Expect.throws(() { 539 Expect.throws(() {
570 x11 = (f11 as dynamic); 540 x11 = (f11 as dynamic);
571 }); 541 });
572 Expect.throws(() { 542 Expect.throws(() {
573 x11 = confuse(f11); 543 x11 = confuse(f11);
574 }); 544 });
575 List<Function> Function(int y, {List<T> x}) Function() l11; 545 List<Function> Function(int y, {List<T> x}) Function() l11;
576 Expect.throws(() { 546 Expect.throws(() {
577 l11 = (f11 as dynamic); 547 l11 = (f11 as dynamic);
578 }); 548 });
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 x13 = confuse(m13); 605 x13 = confuse(m13);
636 l13 = confuse(m13); 606 l13 = confuse(m13);
637 if (!tIsBool) { 607 if (!tIsBool) {
638 Expect.isTrue(f13 is F13<int>); 608 Expect.isTrue(f13 is F13<int>);
639 Expect.isFalse(f13 is F13<bool>); 609 Expect.isFalse(f13 is F13<bool>);
640 Expect.isTrue(confuse(f13) is F13<int>); 610 Expect.isTrue(confuse(f13) is F13<int>);
641 Expect.isFalse(confuse(f13) is F13<bool>); 611 Expect.isFalse(confuse(f13) is F13<bool>);
642 Expect.equals(tIsDynamic, m13 is F13<bool>); 612 Expect.equals(tIsDynamic, m13 is F13<bool>);
643 Expect.equals(tIsDynamic, confuse(m13) is F13<bool>); 613 Expect.equals(tIsDynamic, confuse(m13) is F13<bool>);
644 } else { 614 } else {
645 if (inCheckedMode) { 615 if (typeAssertionsEnabled) {
646 Expect.throws(() { 616 Expect.throws(() {
647 x13 = (f13 as dynamic); 617 x13 = (f13 as dynamic);
648 }); 618 });
649 Expect.throws(() { 619 Expect.throws(() {
650 x13 = confuse(f13); 620 x13 = confuse(f13);
651 }); 621 });
652 core.List<core.int> Function(List<T> x0) Function() l13; 622 core.List<core.int> Function(List<T> x0) Function() l13;
653 Expect.throws(() { 623 Expect.throws(() {
654 l13 = (f13 as dynamic); 624 l13 = (f13 as dynamic);
655 }); 625 });
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 x14 = confuse(m14); 657 x14 = confuse(m14);
688 l14 = confuse(m14); 658 l14 = confuse(m14);
689 if (!tIsBool) { 659 if (!tIsBool) {
690 Expect.isTrue(f14 is F14<int>); 660 Expect.isTrue(f14 is F14<int>);
691 Expect.isFalse(f14 is F14<bool>); 661 Expect.isFalse(f14 is F14<bool>);
692 Expect.isTrue(confuse(f14) is F14<int>); 662 Expect.isTrue(confuse(f14) is F14<int>);
693 Expect.isFalse(confuse(f14) is F14<bool>); 663 Expect.isFalse(confuse(f14) is F14<bool>);
694 Expect.equals(tIsDynamic, m14 is F14<bool>); 664 Expect.equals(tIsDynamic, m14 is F14<bool>);
695 Expect.equals(tIsDynamic, confuse(m14) is F14<bool>); 665 Expect.equals(tIsDynamic, confuse(m14) is F14<bool>);
696 } else { 666 } else {
697 if (inCheckedMode) { 667 if (typeAssertionsEnabled) {
698 Expect.throws(() { 668 Expect.throws(() {
699 x14 = (f14 as dynamic); 669 x14 = (f14 as dynamic);
700 }); 670 });
701 Expect.throws(() { 671 Expect.throws(() {
702 x14 = confuse(f14); 672 x14 = confuse(f14);
703 }); 673 });
704 List<T> Function(int x1, [Function x2]) Function() l14; 674 List<T> Function(int x1, [Function x2]) Function() l14;
705 Expect.throws(() { 675 Expect.throws(() {
706 l14 = (f14 as dynamic); 676 l14 = (f14 as dynamic);
707 }); 677 });
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 x15 = confuse(m15); 710 x15 = confuse(m15);
741 l15 = confuse(m15); 711 l15 = confuse(m15);
742 if (!tIsBool) { 712 if (!tIsBool) {
743 Expect.isTrue(f15 is F15<int>); 713 Expect.isTrue(f15 is F15<int>);
744 Expect.isFalse(f15 is F15<bool>); 714 Expect.isFalse(f15 is F15<bool>);
745 Expect.isTrue(confuse(f15) is F15<int>); 715 Expect.isTrue(confuse(f15) is F15<int>);
746 Expect.isFalse(confuse(f15) is F15<bool>); 716 Expect.isFalse(confuse(f15) is F15<bool>);
747 Expect.equals(tIsDynamic, m15 is F15<bool>); 717 Expect.equals(tIsDynamic, m15 is F15<bool>);
748 Expect.equals(tIsDynamic, confuse(m15) is F15<bool>); 718 Expect.equals(tIsDynamic, confuse(m15) is F15<bool>);
749 } else { 719 } else {
750 if (inCheckedMode) { 720 if (typeAssertionsEnabled) {
751 Expect.throws(() { 721 Expect.throws(() {
752 x15 = (f15 as dynamic); 722 x15 = (f15 as dynamic);
753 }); 723 });
754 Expect.throws(() { 724 Expect.throws(() {
755 x15 = confuse(f15); 725 x15 = confuse(f15);
756 }); 726 });
757 List<T> Function(int x0, {core.List<core.int> x}) Function() l15; 727 List<T> Function(int x0, {core.List<core.int> x}) Function() l15;
758 Expect.throws(() { 728 Expect.throws(() {
759 l15 = (f15 as dynamic); 729 l15 = (f15 as dynamic);
760 }); 730 });
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
960 x23 = confuse(m23); 930 x23 = confuse(m23);
961 l23 = confuse(m23); 931 l23 = confuse(m23);
962 if (!tIsBool) { 932 if (!tIsBool) {
963 Expect.isTrue(f23 is F23<int>); 933 Expect.isTrue(f23 is F23<int>);
964 Expect.isFalse(f23 is F23<bool>); 934 Expect.isFalse(f23 is F23<bool>);
965 Expect.isTrue(confuse(f23) is F23<int>); 935 Expect.isTrue(confuse(f23) is F23<int>);
966 Expect.isFalse(confuse(f23) is F23<bool>); 936 Expect.isFalse(confuse(f23) is F23<bool>);
967 Expect.equals(tIsDynamic, m23 is F23<bool>); 937 Expect.equals(tIsDynamic, m23 is F23<bool>);
968 Expect.equals(tIsDynamic, confuse(m23) is F23<bool>); 938 Expect.equals(tIsDynamic, confuse(m23) is F23<bool>);
969 } else { 939 } else {
970 if (inCheckedMode) { 940 if (typeAssertionsEnabled) {
971 Expect.throws(() { 941 Expect.throws(() {
972 x23 = (f23 as dynamic); 942 x23 = (f23 as dynamic);
973 }); 943 });
974 Expect.throws(() { 944 Expect.throws(() {
975 x23 = confuse(f23); 945 x23 = confuse(f23);
976 }); 946 });
977 List<T> Function(B x) Function<B extends core.int>() l23; 947 List<T> Function(B x) Function<B extends core.int>() l23;
978 Expect.throws(() { 948 Expect.throws(() {
979 l23 = (f23 as dynamic); 949 l23 = (f23 as dynamic);
980 }); 950 });
981 Expect.throws(() { 951 Expect.throws(() {
982 l23 = confuse(f23); 952 l23 = confuse(f23);
983 }); 953 });
984 } 954 }
985 List<T> Function(B x) Function<B extends core.int>() l23 = m23; 955 List<T> Function(B x) Function<B extends core.int>() l23 = m23;
986 // In checked mode, verifies the type. 956 // In checked mode, verifies the type.
987 x23 = m23; 957 x23 = m23;
988 x23 = confuse(m23); 958 x23 = confuse(m23);
989 } 959 }
990 } 960 }
991 } 961 }
992 962
993 void main() { 963 void main() {
994 new U28().runTests(); 964 new U28().runTests();
995 new U28<int>(tIsInt: true).runTests(); 965 new U28<int>(tIsInt: true).runTests();
996 new U28<bool>(tIsBool: true).runTests(); 966 new U28<bool>(tIsBool: true).runTests();
997 } 967 }
OLDNEW
« no previous file with comments | « tests/language/function_type/function_type27_test.dart ('k') | tests/language/function_type/function_type29_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698