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

Side by Side Diff: tests/language/function_type/function_type92_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 y, [core.List<core.int> x]);
23 bool result = false; 23 typedef F1<T> = core.List<core.int> Function(int x0, [List<Function> x]);
24 assert(result = true); 24 typedef F2<T> = Function([Function x]);
25 return result; 25 typedef F3<T> = int Function<A>(int x);
26 })(); 26 typedef F4<T> = int Function(int x, [int x2]) Function();
27 27 typedef F5<T> = int Function(int y, {List<Function> x}) Function();
28 typedef F0<T> 28 typedef F6<T> = Function Function([int x]) Function();
29 = Function Function(int y, [core.List<core.int> x]); 29 typedef F7<T> = Function Function(List<Function> x0) Function();
30 typedef F1<T> 30 typedef F8<T> = Function Function(int x, [List<T> x2]) Function();
31 = core.List<core.int> Function(int x0, [List<Function> x]); 31 typedef F9<T> = List<Function> Function(int x0, {Function x}) Function();
32 typedef F2<T> 32 typedef F10<T> = List<Function> Function([List<T> x]) Function();
33 = Function([Function x]); 33 typedef F11<T> = core.List<core.int> Function(int y, [Function x]) Function();
34 typedef F3<T> 34 typedef F12<T> = core.List<core.int> Function(int x1, [core.List<core.int> x2])
35 = int Function<A>(int x); 35 Function();
36 typedef F4<T> 36 typedef F13<T> = List<T> Function({int x}) Function();
37 = int Function(int x, [int x2]) Function(); 37 typedef F14<T> = List<T> Function(core.List<core.int> x) Function();
38 typedef F5<T> 38 typedef F15<T> = Function(int x0, [int x]) Function();
39 = int Function(int y, {List<Function> x}) Function(); 39 typedef F16<T> = Function([List<Function> x1]) Function();
40 typedef F6<T> 40 typedef F17<T> = Function({List<T> x}) Function();
41 = Function Function([int x]) Function(); 41 typedef F18<T> = void Function(int y, {Function x}) Function();
42 typedef F7<T> 42 typedef F19<T> = void Function(int x0, [List<T> x]) Function();
43 = Function Function(List<Function> x0) Function(); 43 typedef F20<T> = Function Function<A>(List<A> x) Function();
44 typedef F8<T> 44 typedef F21<T> = Function<A>(int x) Function();
45 = Function Function(int x, [List<T> x2]) Function(); 45 typedef F22<T> = void Function<A>(Function x) Function();
46 typedef F9<T>
47 = List<Function> Function(int x0, {Function x}) Function();
48 typedef F10<T>
49 = List<Function> Function([List<T> x]) Function();
50 typedef F11<T>
51 = core.List<core.int> Function(int y, [Function x]) Function();
52 typedef F12<T>
53 = core.List<core.int> Function(int x1, [core.List<core.int> x2]) Function();
54 typedef F13<T>
55 = List<T> Function({int x}) Function();
56 typedef F14<T>
57 = List<T> Function(core.List<core.int> x) Function();
58 typedef F15<T>
59 = Function(int x0, [int x]) Function();
60 typedef F16<T>
61 = Function([List<Function> x1]) Function();
62 typedef F17<T>
63 = Function({List<T> x}) Function();
64 typedef F18<T>
65 = void Function(int y, {Function x}) Function();
66 typedef F19<T>
67 = void Function(int x0, [List<T> x]) Function();
68 typedef F20<T>
69 = Function Function<A>(List<A> x) Function();
70 typedef F21<T>
71 = Function<A>(int x) Function();
72 typedef F22<T>
73 = void Function<A>(Function x) Function();
74 46
75 Function f0(int y, [core.List<core.int> x]) => null; 47 Function f0(int y, [core.List<core.int> x]) => null;
76 core.List<core.int> f1(int x0, [List<Function> x]) => null; 48 core.List<core.int> f1(int x0, [List<Function> x]) => null;
77 f2([Function x]) => null; 49 f2([Function x]) => null;
78 int f3<A>(int x) => null; 50 int f3<A>(int x) => null;
79 int Function(int x, [int x0]) f4() => null; 51 int Function(int x, [int x0]) f4() => null;
80 int Function(int y, {List<Function> x}) f5() => null; 52 int Function(int y, {List<Function> x}) f5() => null;
81 Function Function([int x]) f6() => null; 53 Function Function([int x]) f6() => null;
82 Function Function(List<Function> x0) f7() => null; 54 Function Function(List<Function> x0) f7() => null;
83 Function Function(int x, [List<int> x0]) f8() => null; 55 Function Function(int x, [List<int> x0]) f8() => null;
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 x8 = confuse(m8); 366 x8 = confuse(m8);
395 l8 = confuse(m8); 367 l8 = confuse(m8);
396 if (!tIsBool) { 368 if (!tIsBool) {
397 Expect.isTrue(f8 is F8<int>); 369 Expect.isTrue(f8 is F8<int>);
398 Expect.isFalse(f8 is F8<bool>); 370 Expect.isFalse(f8 is F8<bool>);
399 Expect.isTrue(confuse(f8) is F8<int>); 371 Expect.isTrue(confuse(f8) is F8<int>);
400 Expect.isFalse(confuse(f8) is F8<bool>); 372 Expect.isFalse(confuse(f8) is F8<bool>);
401 Expect.equals(tIsDynamic, m8 is F8<bool>); 373 Expect.equals(tIsDynamic, m8 is F8<bool>);
402 Expect.equals(tIsDynamic, confuse(m8) is F8<bool>); 374 Expect.equals(tIsDynamic, confuse(m8) is F8<bool>);
403 } else { 375 } else {
404 if (inCheckedMode) { 376 if (typeAssertionsEnabled) {
405 Expect.throws(() { 377 Expect.throws(() {
406 x8 = (f8 as dynamic); 378 x8 = (f8 as dynamic);
407 }); 379 });
408 Expect.throws(() { 380 Expect.throws(() {
409 x8 = confuse(f8); 381 x8 = confuse(f8);
410 }); 382 });
411 Function Function(int x, [List<T> x2]) Function() l8; 383 Function Function(int x, [List<T> x2]) Function() l8;
412 Expect.throws(() { 384 Expect.throws(() {
413 l8 = (f8 as dynamic); 385 l8 = (f8 as dynamic);
414 }); 386 });
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 x10 = confuse(m10); 443 x10 = confuse(m10);
472 l10 = confuse(m10); 444 l10 = confuse(m10);
473 if (!tIsBool) { 445 if (!tIsBool) {
474 Expect.isTrue(f10 is F10<int>); 446 Expect.isTrue(f10 is F10<int>);
475 Expect.isFalse(f10 is F10<bool>); 447 Expect.isFalse(f10 is F10<bool>);
476 Expect.isTrue(confuse(f10) is F10<int>); 448 Expect.isTrue(confuse(f10) is F10<int>);
477 Expect.isFalse(confuse(f10) is F10<bool>); 449 Expect.isFalse(confuse(f10) is F10<bool>);
478 Expect.equals(tIsDynamic, m10 is F10<bool>); 450 Expect.equals(tIsDynamic, m10 is F10<bool>);
479 Expect.equals(tIsDynamic, confuse(m10) is F10<bool>); 451 Expect.equals(tIsDynamic, confuse(m10) is F10<bool>);
480 } else { 452 } else {
481 if (inCheckedMode) { 453 if (typeAssertionsEnabled) {
482 Expect.throws(() { 454 Expect.throws(() {
483 x10 = (f10 as dynamic); 455 x10 = (f10 as dynamic);
484 }); 456 });
485 Expect.throws(() { 457 Expect.throws(() {
486 x10 = confuse(f10); 458 x10 = confuse(f10);
487 }); 459 });
488 List<Function> Function([List<T> x]) Function() l10; 460 List<Function> Function([List<T> x]) Function() l10;
489 Expect.throws(() { 461 Expect.throws(() {
490 l10 = (f10 as dynamic); 462 l10 = (f10 as dynamic);
491 }); 463 });
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 // The static function f12 sets `T` to `int`. 507 // The static function f12 sets `T` to `int`.
536 if (!tIsBool) { 508 if (!tIsBool) {
537 x12 = f12 as dynamic; 509 x12 = f12 as dynamic;
538 l12 = f12 as dynamic; 510 l12 = f12 as dynamic;
539 x12 = confuse(f12); 511 x12 = confuse(f12);
540 l12 = confuse(f12); 512 l12 = confuse(f12);
541 } 513 }
542 514
543 Expect.isTrue(m12 is F12); 515 Expect.isTrue(m12 is F12);
544 Expect.isTrue(m12 is core.List<core.int> Function(int x1, 516 Expect.isTrue(m12 is core.List<core.int> Function(int x1,
545 [core.List<core.int> x2]) Function()); 517 [core.List<core.int> x2])
518 Function());
546 Expect.isTrue(confuse(m12) is F12); 519 Expect.isTrue(confuse(m12) is F12);
547 // In checked mode, verifies the type. 520 // In checked mode, verifies the type.
548 x12 = m12; 521 x12 = m12;
549 l12 = m12; 522 l12 = m12;
550 x12 = confuse(m12); 523 x12 = confuse(m12);
551 l12 = confuse(m12); 524 l12 = confuse(m12);
552 } 525 }
553 526
554 /// List<T> Function({int x}) Function() 527 /// List<T> Function({int x}) Function()
555 void testF13() { 528 void testF13() {
(...skipping 18 matching lines...) Expand all
574 x13 = confuse(m13); 547 x13 = confuse(m13);
575 l13 = confuse(m13); 548 l13 = confuse(m13);
576 if (!tIsBool) { 549 if (!tIsBool) {
577 Expect.isTrue(f13 is F13<int>); 550 Expect.isTrue(f13 is F13<int>);
578 Expect.isFalse(f13 is F13<bool>); 551 Expect.isFalse(f13 is F13<bool>);
579 Expect.isTrue(confuse(f13) is F13<int>); 552 Expect.isTrue(confuse(f13) is F13<int>);
580 Expect.isFalse(confuse(f13) is F13<bool>); 553 Expect.isFalse(confuse(f13) is F13<bool>);
581 Expect.equals(tIsDynamic, m13 is F13<bool>); 554 Expect.equals(tIsDynamic, m13 is F13<bool>);
582 Expect.equals(tIsDynamic, confuse(m13) is F13<bool>); 555 Expect.equals(tIsDynamic, confuse(m13) is F13<bool>);
583 } else { 556 } else {
584 if (inCheckedMode) { 557 if (typeAssertionsEnabled) {
585 Expect.throws(() { 558 Expect.throws(() {
586 x13 = (f13 as dynamic); 559 x13 = (f13 as dynamic);
587 }); 560 });
588 Expect.throws(() { 561 Expect.throws(() {
589 x13 = confuse(f13); 562 x13 = confuse(f13);
590 }); 563 });
591 List<T> Function({int x}) Function() l13; 564 List<T> Function({int x}) Function() l13;
592 Expect.throws(() { 565 Expect.throws(() {
593 l13 = (f13 as dynamic); 566 l13 = (f13 as dynamic);
594 }); 567 });
(...skipping 31 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(core.List<core.int> x) Function() l14; 616 List<T> Function(core.List<core.int> 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({List<T> x}) Function() l17; 716 Function({List<T> x}) 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(int x0, [List<T> x]) Function() l19; 792 void Function(int x0, [List<T> x]) Function() l19;
820 Expect.throws(() { 793 Expect.throws(() {
821 l19 = (f19 as dynamic); 794 l19 = (f19 as dynamic);
822 }); 795 });
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 x22 = confuse(m22); 875 x22 = confuse(m22);
903 l22 = confuse(m22); 876 l22 = confuse(m22);
904 } 877 }
905 } 878 }
906 879
907 void main() { 880 void main() {
908 new U92().runTests(); 881 new U92().runTests();
909 new U92<int>(tIsInt: true).runTests(); 882 new U92<int>(tIsInt: true).runTests();
910 new U92<bool>(tIsBool: true).runTests(); 883 new U92<bool>(tIsBool: true).runTests();
911 } 884 }
OLDNEW
« no previous file with comments | « tests/language/function_type/function_type91_test.dart ('k') | tests/language/function_type/function_type93_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698