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

Side by Side Diff: tests/language/function_type/function_type33_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(core.List<core.int> x);
23 bool result = false; 23 typedef F1<T> = List<Function> Function(int y, {Function x});
24 assert(result = true); 24 typedef F2<T> = List<T> Function(int x0, {int x});
25 return result; 25 typedef F3<T> = Function(int x0, {List<T> x});
26 })(); 26 typedef F4<T> = Function<A>(Function x);
27 27 typedef F5<T> = int Function(int x2, [Function x3]) Function(int x);
28 typedef F0<T> 28 typedef F6<T> = int Function(int x1, {core.List<core.int> x}) Function(int x);
29 = int Function(core.List<core.int> x); 29 typedef F7<T> = Function Function(Function x) Function(int x);
30 typedef F1<T> 30 typedef F8<T> = Function Function(int y, [core.List<core.int> x]) Function(
31 = List<Function> Function(int y, {Function x}); 31 int x);
32 typedef F2<T> 32 typedef F9<T> = List<Function> Function([int x1]) Function(int x);
33 = List<T> Function(int x0, {int x}); 33 typedef F10<T> = List<Function> Function({List<Function> x}) Function(int x);
34 typedef F3<T> 34 typedef F11<T> = List<Function> Function() Function(int x);
35 = Function(int x0, {List<T> x}); 35 typedef F12<T> = core.List<core.int> Function(int x1, [List<Function> x])
36 typedef F4<T> 36 Function(int x);
37 = Function<A>(Function x); 37 typedef F13<T> = core.List<core.int> Function([List<T> x1]) Function(int x);
38 typedef F5<T> 38 typedef F14<T> = List<T> Function(int x, [Function x1]) Function(int x);
39 = int Function(int x2, [Function x3]) Function(int x); 39 typedef F15<T> = List<T> Function(int y, {core.List<core.int> x}) Function(
40 typedef F6<T> 40 int x);
41 = int Function(int x1, {core.List<core.int> x}) Function(int x); 41 typedef F16<T> = Function([Function x]) Function(int x);
42 typedef F7<T> 42 typedef F17<T> = Function(core.List<core.int> x1) Function(int x);
43 = Function Function(Function x) Function(int x); 43 typedef F18<T> = void Function(int x2, [int x3]) Function(int x);
44 typedef F8<T> 44 typedef F19<T> = void Function(int x1, {List<Function> x}) Function(int x);
45 = Function Function(int y, [core.List<core.int> x]) Function(int x); 45 typedef F20<T> = int Function<A>(int x) Function(int x);
46 typedef F9<T> 46 typedef F21<T> = core.List<core.int> Function<A>(Function x) Function(int x);
47 = List<Function> Function([int x1]) Function(int x); 47 typedef F22<T> = A Function<A>(List<Function> x) Function(int x);
48 typedef F10<T> 48 typedef F23<T> = B Function(B x) Function<B extends core.int>(int x);
49 = List<Function> Function({List<Function> x}) Function(int x);
50 typedef F11<T>
51 = List<Function> Function() Function(int x);
52 typedef F12<T>
53 = core.List<core.int> Function(int x1, [List<Function> x]) Function(int x);
54 typedef F13<T>
55 = core.List<core.int> Function([List<T> x1]) Function(int x);
56 typedef F14<T>
57 = List<T> Function(int x, [Function x1]) Function(int x);
58 typedef F15<T>
59 = List<T> Function(int y, {core.List<core.int> x}) Function(int x);
60 typedef F16<T>
61 = Function([Function x]) Function(int x);
62 typedef F17<T>
63 = Function(core.List<core.int> x1) Function(int x);
64 typedef F18<T>
65 = void Function(int x2, [int x3]) Function(int x);
66 typedef F19<T>
67 = void Function(int x1, {List<Function> x}) Function(int x);
68 typedef F20<T>
69 = int Function<A>(int x) Function(int x);
70 typedef F21<T>
71 = core.List<core.int> Function<A>(Function x) Function(int x);
72 typedef F22<T>
73 = A Function<A>(List<Function> x) Function(int x);
74 typedef F23<T>
75 = B Function(B x) Function<B extends core.int>(int x);
76 49
77 int f0(core.List<core.int> x) => null; 50 int f0(core.List<core.int> x) => null;
78 List<Function> f1(int y, {Function x}) => null; 51 List<Function> f1(int y, {Function x}) => null;
79 List<int> f2(int x0, {int x}) => null; 52 List<int> f2(int x0, {int x}) => null;
80 f3(int x0, {List<int> x}) => null; 53 f3(int x0, {List<int> x}) => null;
81 f4<A>(Function x) => null; 54 f4<A>(Function x) => null;
82 int Function(int x0, [Function x1]) f5(int x) => null; 55 int Function(int x0, [Function x1]) f5(int x) => null;
83 int Function(int x0, {core.List<core.int> x}) f6(int x) => null; 56 int Function(int x0, {core.List<core.int> x}) f6(int x) => null;
84 Function Function(Function x) f7(int x) => null; 57 Function Function(Function x) f7(int x) => null;
85 Function Function(int y, [core.List<core.int> x]) f8(int x) => null; 58 Function Function(int y, [core.List<core.int> x]) f8(int x) => null;
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 x2 = confuse(m2); 228 x2 = confuse(m2);
256 l2 = confuse(m2); 229 l2 = confuse(m2);
257 if (!tIsBool) { 230 if (!tIsBool) {
258 Expect.isTrue(f2 is F2<int>); 231 Expect.isTrue(f2 is F2<int>);
259 Expect.isFalse(f2 is F2<bool>); 232 Expect.isFalse(f2 is F2<bool>);
260 Expect.isTrue(confuse(f2) is F2<int>); 233 Expect.isTrue(confuse(f2) is F2<int>);
261 Expect.isFalse(confuse(f2) is F2<bool>); 234 Expect.isFalse(confuse(f2) is F2<bool>);
262 Expect.equals(tIsDynamic, m2 is F2<bool>); 235 Expect.equals(tIsDynamic, m2 is F2<bool>);
263 Expect.equals(tIsDynamic, confuse(m2) is F2<bool>); 236 Expect.equals(tIsDynamic, confuse(m2) is F2<bool>);
264 } else { 237 } else {
265 if (inCheckedMode) { 238 if (typeAssertionsEnabled) {
266 Expect.throws(() { 239 Expect.throws(() {
267 x2 = (f2 as dynamic); 240 x2 = (f2 as dynamic);
268 }); 241 });
269 Expect.throws(() { 242 Expect.throws(() {
270 x2 = confuse(f2); 243 x2 = confuse(f2);
271 }); 244 });
272 List<T> Function(int x0, {int x}) l2; 245 List<T> Function(int x0, {int x}) l2;
273 Expect.throws(() { 246 Expect.throws(() {
274 l2 = (f2 as dynamic); 247 l2 = (f2 as dynamic);
275 }); 248 });
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 x3 = confuse(m3); 280 x3 = confuse(m3);
308 l3 = confuse(m3); 281 l3 = confuse(m3);
309 if (!tIsBool) { 282 if (!tIsBool) {
310 Expect.isTrue(f3 is F3<int>); 283 Expect.isTrue(f3 is F3<int>);
311 Expect.isFalse(f3 is F3<bool>); 284 Expect.isFalse(f3 is F3<bool>);
312 Expect.isTrue(confuse(f3) is F3<int>); 285 Expect.isTrue(confuse(f3) is F3<int>);
313 Expect.isFalse(confuse(f3) is F3<bool>); 286 Expect.isFalse(confuse(f3) is F3<bool>);
314 Expect.equals(tIsDynamic, m3 is F3<bool>); 287 Expect.equals(tIsDynamic, m3 is F3<bool>);
315 Expect.equals(tIsDynamic, confuse(m3) is F3<bool>); 288 Expect.equals(tIsDynamic, confuse(m3) is F3<bool>);
316 } else { 289 } else {
317 if (inCheckedMode) { 290 if (typeAssertionsEnabled) {
318 Expect.throws(() { 291 Expect.throws(() {
319 x3 = (f3 as dynamic); 292 x3 = (f3 as dynamic);
320 }); 293 });
321 Expect.throws(() { 294 Expect.throws(() {
322 x3 = confuse(f3); 295 x3 = confuse(f3);
323 }); 296 });
324 Function(int x0, {List<T> x}) l3; 297 Function(int x0, {List<T> x}) l3;
325 Expect.throws(() { 298 Expect.throws(() {
326 l3 = (f3 as dynamic); 299 l3 = (f3 as dynamic);
327 }); 300 });
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 Function Function(int y, [core.List<core.int> x]) Function(int x) l8; 414 Function Function(int y, [core.List<core.int> x]) Function(int x) l8;
442 // The static function f8 sets `T` to `int`. 415 // The static function f8 sets `T` to `int`.
443 if (!tIsBool) { 416 if (!tIsBool) {
444 x8 = f8 as dynamic; 417 x8 = f8 as dynamic;
445 l8 = f8 as dynamic; 418 l8 = f8 as dynamic;
446 x8 = confuse(f8); 419 x8 = confuse(f8);
447 l8 = confuse(f8); 420 l8 = confuse(f8);
448 } 421 }
449 422
450 Expect.isTrue(m8 is F8); 423 Expect.isTrue(m8 is F8);
451 Expect.isTrue(m8 is Function Function(int y, 424 Expect.isTrue(m8 is Function Function(int y, [core.List<core.int> x])
452 [core.List<core.int> x]) Function(int x)); 425 Function(int x));
453 Expect.isTrue(confuse(m8) is F8); 426 Expect.isTrue(confuse(m8) is F8);
454 // In checked mode, verifies the type. 427 // In checked mode, verifies the type.
455 x8 = m8; 428 x8 = m8;
456 l8 = m8; 429 l8 = m8;
457 x8 = confuse(m8); 430 x8 = confuse(m8);
458 l8 = confuse(m8); 431 l8 = confuse(m8);
459 } 432 }
460 433
461 /// List<Function> Function([int x1]) Function(int x) 434 /// List<Function> Function([int x1]) Function(int x)
462 void testF9() { 435 void testF9() {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 // The static function f12 sets `T` to `int`. 514 // The static function f12 sets `T` to `int`.
542 if (!tIsBool) { 515 if (!tIsBool) {
543 x12 = f12 as dynamic; 516 x12 = f12 as dynamic;
544 l12 = f12 as dynamic; 517 l12 = f12 as dynamic;
545 x12 = confuse(f12); 518 x12 = confuse(f12);
546 l12 = confuse(f12); 519 l12 = confuse(f12);
547 } 520 }
548 521
549 Expect.isTrue(m12 is F12); 522 Expect.isTrue(m12 is F12);
550 Expect.isTrue(m12 is core.List<core.int> Function(int x1, 523 Expect.isTrue(m12 is core.List<core.int> Function(int x1,
551 [List<Function> x]) Function(int x)); 524 [List<Function> x])
525 Function(int x));
552 Expect.isTrue(confuse(m12) is F12); 526 Expect.isTrue(confuse(m12) is F12);
553 // In checked mode, verifies the type. 527 // In checked mode, verifies the type.
554 x12 = m12; 528 x12 = m12;
555 l12 = m12; 529 l12 = m12;
556 x12 = confuse(m12); 530 x12 = confuse(m12);
557 l12 = confuse(m12); 531 l12 = confuse(m12);
558 } 532 }
559 533
560 /// core.List<core.int> Function([List<T> x1]) Function(int x) 534 /// core.List<core.int> Function([List<T> x1]) Function(int x)
561 void testF13() { 535 void testF13() {
(...skipping 19 matching lines...) Expand all
581 x13 = confuse(m13); 555 x13 = confuse(m13);
582 l13 = confuse(m13); 556 l13 = confuse(m13);
583 if (!tIsBool) { 557 if (!tIsBool) {
584 Expect.isTrue(f13 is F13<int>); 558 Expect.isTrue(f13 is F13<int>);
585 Expect.isFalse(f13 is F13<bool>); 559 Expect.isFalse(f13 is F13<bool>);
586 Expect.isTrue(confuse(f13) is F13<int>); 560 Expect.isTrue(confuse(f13) is F13<int>);
587 Expect.isFalse(confuse(f13) is F13<bool>); 561 Expect.isFalse(confuse(f13) is F13<bool>);
588 Expect.equals(tIsDynamic, m13 is F13<bool>); 562 Expect.equals(tIsDynamic, m13 is F13<bool>);
589 Expect.equals(tIsDynamic, confuse(m13) is F13<bool>); 563 Expect.equals(tIsDynamic, confuse(m13) is F13<bool>);
590 } else { 564 } else {
591 if (inCheckedMode) { 565 if (typeAssertionsEnabled) {
592 Expect.throws(() { 566 Expect.throws(() {
593 x13 = (f13 as dynamic); 567 x13 = (f13 as dynamic);
594 }); 568 });
595 Expect.throws(() { 569 Expect.throws(() {
596 x13 = confuse(f13); 570 x13 = confuse(f13);
597 }); 571 });
598 core.List<core.int> Function([List<T> x1]) Function(int x) l13; 572 core.List<core.int> Function([List<T> x1]) Function(int x) l13;
599 Expect.throws(() { 573 Expect.throws(() {
600 l13 = (f13 as dynamic); 574 l13 = (f13 as dynamic);
601 }); 575 });
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 x14 = confuse(m14); 608 x14 = confuse(m14);
635 l14 = confuse(m14); 609 l14 = confuse(m14);
636 if (!tIsBool) { 610 if (!tIsBool) {
637 Expect.isTrue(f14 is F14<int>); 611 Expect.isTrue(f14 is F14<int>);
638 Expect.isFalse(f14 is F14<bool>); 612 Expect.isFalse(f14 is F14<bool>);
639 Expect.isTrue(confuse(f14) is F14<int>); 613 Expect.isTrue(confuse(f14) is F14<int>);
640 Expect.isFalse(confuse(f14) is F14<bool>); 614 Expect.isFalse(confuse(f14) is F14<bool>);
641 Expect.equals(tIsDynamic, m14 is F14<bool>); 615 Expect.equals(tIsDynamic, m14 is F14<bool>);
642 Expect.equals(tIsDynamic, confuse(m14) is F14<bool>); 616 Expect.equals(tIsDynamic, confuse(m14) is F14<bool>);
643 } else { 617 } else {
644 if (inCheckedMode) { 618 if (typeAssertionsEnabled) {
645 Expect.throws(() { 619 Expect.throws(() {
646 x14 = (f14 as dynamic); 620 x14 = (f14 as dynamic);
647 }); 621 });
648 Expect.throws(() { 622 Expect.throws(() {
649 x14 = confuse(f14); 623 x14 = confuse(f14);
650 }); 624 });
651 List<T> Function(int x, [Function x1]) Function(int x) l14; 625 List<T> Function(int x, [Function x1]) Function(int x) l14;
652 Expect.throws(() { 626 Expect.throws(() {
653 l14 = (f14 as dynamic); 627 l14 = (f14 as dynamic);
654 }); 628 });
(...skipping 16 matching lines...) Expand all
671 List<T> Function(int y, {core.List<core.int> x}) Function(int x) l15; 645 List<T> Function(int y, {core.List<core.int> x}) Function(int x) l15;
672 // The static function f15 sets `T` to `int`. 646 // The static function f15 sets `T` to `int`.
673 if (!tIsBool) { 647 if (!tIsBool) {
674 x15 = f15 as dynamic; 648 x15 = f15 as dynamic;
675 l15 = f15 as dynamic; 649 l15 = f15 as dynamic;
676 x15 = confuse(f15); 650 x15 = confuse(f15);
677 l15 = confuse(f15); 651 l15 = confuse(f15);
678 } 652 }
679 653
680 Expect.isTrue(m15 is F15); 654 Expect.isTrue(m15 is F15);
681 Expect.isTrue(m15 is List<T> Function(int y, 655 Expect.isTrue(m15 is List<T> Function(int y, {core.List<core.int> x})
682 {core.List<core.int> x}) Function(int x)); 656 Function(int x));
683 Expect.isTrue(confuse(m15) is F15); 657 Expect.isTrue(confuse(m15) is F15);
684 // In checked mode, verifies the type. 658 // In checked mode, verifies the type.
685 x15 = m15; 659 x15 = m15;
686 l15 = m15; 660 l15 = m15;
687 x15 = confuse(m15); 661 x15 = confuse(m15);
688 l15 = confuse(m15); 662 l15 = confuse(m15);
689 if (!tIsBool) { 663 if (!tIsBool) {
690 Expect.isTrue(f15 is F15<int>); 664 Expect.isTrue(f15 is F15<int>);
691 Expect.isFalse(f15 is F15<bool>); 665 Expect.isFalse(f15 is F15<bool>);
692 Expect.isTrue(confuse(f15) is F15<int>); 666 Expect.isTrue(confuse(f15) is F15<int>);
693 Expect.isFalse(confuse(f15) is F15<bool>); 667 Expect.isFalse(confuse(f15) is F15<bool>);
694 Expect.equals(tIsDynamic, m15 is F15<bool>); 668 Expect.equals(tIsDynamic, m15 is F15<bool>);
695 Expect.equals(tIsDynamic, confuse(m15) is F15<bool>); 669 Expect.equals(tIsDynamic, confuse(m15) is F15<bool>);
696 } else { 670 } else {
697 if (inCheckedMode) { 671 if (typeAssertionsEnabled) {
698 Expect.throws(() { 672 Expect.throws(() {
699 x15 = (f15 as dynamic); 673 x15 = (f15 as dynamic);
700 }); 674 });
701 Expect.throws(() { 675 Expect.throws(() {
702 x15 = confuse(f15); 676 x15 = confuse(f15);
703 }); 677 });
704 List<T> Function(int y, {core.List<core.int> x}) Function(int x) l15; 678 List<T> Function(int y, {core.List<core.int> x}) Function(int x) l15;
705 Expect.throws(() { 679 Expect.throws(() {
706 l15 = (f15 as dynamic); 680 l15 = (f15 as dynamic);
707 }); 681 });
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
910 x23 = confuse(m23); 884 x23 = confuse(m23);
911 l23 = confuse(m23); 885 l23 = confuse(m23);
912 } 886 }
913 } 887 }
914 888
915 void main() { 889 void main() {
916 new U33().runTests(); 890 new U33().runTests();
917 new U33<int>(tIsInt: true).runTests(); 891 new U33<int>(tIsInt: true).runTests();
918 new U33<bool>(tIsBool: true).runTests(); 892 new U33<bool>(tIsBool: true).runTests();
919 } 893 }
OLDNEW
« no previous file with comments | « tests/language/function_type/function_type32_test.dart ('k') | tests/language/function_type/function_type34_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698