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_type54_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 y, {List<T> x});
23 bool result = false; 23 typedef F1<T> = List<Function> Function(int x0, {core.List<core.int> x});
24 assert(result = true); 24 typedef F2<T> = List<T> Function({List<Function> x});
25 return result; 25 typedef F3<T> = void Function(int x, [Function x2]);
26 })(); 26 typedef F4<T> = List<A> Function<A>(A x);
27 27 typedef F5<T> = int Function(List<Function> x) Function<B extends core.int>();
28 typedef F0<T> 28 typedef F6<T> = int Function(int y, [List<T> x]) Function<B extends core.int>();
29 = int Function(int y, {List<T> x}); 29 typedef F7<T> = Function Function([Function x1]) Function<B extends core.int>();
30 typedef F1<T> 30 typedef F8<T> = Function Function({core.List<core.int> x})
31 = List<Function> Function(int x0, {core.List<core.int> x}); 31 Function<B extends core.int>();
32 typedef F2<T> 32 typedef F9<T> = List<Function> Function(int y, {int x})
33 = List<T> Function({List<Function> x}); 33 Function<B extends core.int>();
34 typedef F3<T> 34 typedef F10<T> = List<Function> Function(int x1, [core.List<core.int> x])
35 = void Function(int x, [Function x2]); 35 Function<B extends core.int>();
36 typedef F4<T> 36 typedef F11<T> = core.List<core.int> Function(int x1)
37 = List<A> Function<A>(A x); 37 Function<B extends core.int>();
38 typedef F5<T> 38 typedef F12<T> = core.List<core.int> Function(int x, [List<Function> x1])
39 = int Function(List<Function> x) Function<B extends core.int>(); 39 Function<B extends core.int>();
40 typedef F6<T> 40 typedef F13<T> = core.List<core.int> Function(int y, {List<T> x})
41 = int Function(int y, [List<T> x]) Function<B extends core.int>(); 41 Function<B extends core.int>();
42 typedef F7<T> 42 typedef F14<T> = List<T> Function([List<Function> x])
43 = Function Function([Function x1]) Function<B extends core.int>(); 43 Function<B extends core.int>();
44 typedef F8<T> 44 typedef F15<T> = List<T> Function(List<T> x1) Function<B extends core.int>();
45 = Function Function({core.List<core.int> x}) Function<B extends core.int>(); 45 typedef F16<T> = Function(int x2, [Function x3]) Function<B extends core.int>();
46 typedef F9<T> 46 typedef F17<T> = Function(int x1, {core.List<core.int> x})
47 = List<Function> Function(int y, {int x}) Function<B extends core.int>(); 47 Function<B extends core.int>();
48 typedef F10<T> 48 typedef F18<T> = void Function(Function x) Function<B extends core.int>();
49 = List<Function> Function(int x1, 49 typedef F19<T> = void Function(int y, [core.List<core.int> x])
50 [core.List<core.int> x]) Function<B extends core.int>(); 50 Function<B extends core.int>();
51 typedef F11<T> 51 typedef F20<T> = int Function<A>() Function<B extends core.int>();
52 = core.List<core.int> Function(int x1) Function<B extends core.int>(); 52 typedef F21<T> = core.List<core.int> Function<A>(A x)
53 typedef F12<T> 53 Function<B extends core.int>();
54 = core.List<core.int> Function(int x, 54 typedef F22<T> = A Function<A>(List<A> x) Function<B extends core.int>();
55 [List<Function> x1]) Function<B extends core.int>();
56 typedef F13<T>
57 = core.List<core.int> Function(int y,
58 {List<T> x}) Function<B extends core.int>();
59 typedef F14<T>
60 = List<T> Function([List<Function> x]) Function<B extends core.int>();
61 typedef F15<T>
62 = List<T> Function(List<T> x1) Function<B extends core.int>();
63 typedef F16<T>
64 = Function(int x2, [Function x3]) Function<B extends core.int>();
65 typedef F17<T>
66 = Function(int x1, {core.List<core.int> x}) Function<B extends core.int>();
67 typedef F18<T>
68 = void Function(Function x) Function<B extends core.int>();
69 typedef F19<T>
70 = void Function(int y,
71 [core.List<core.int> x]) Function<B extends core.int>();
72 typedef F20<T>
73 = int Function<A>() Function<B extends core.int>();
74 typedef F21<T>
75 = core.List<core.int> Function<A>(A x) Function<B extends core.int>();
76 typedef F22<T>
77 = A Function<A>(List<A> x) Function<B extends core.int>();
78 55
79 int f0(int y, {List<int> x}) => null; 56 int f0(int y, {List<int> x}) => null;
80 List<Function> f1(int x0, {core.List<core.int> x}) => null; 57 List<Function> f1(int x0, {core.List<core.int> x}) => null;
81 List<int> f2({List<Function> x}) => null; 58 List<int> f2({List<Function> x}) => null;
82 void f3(int x, [Function x0]) => null; 59 void f3(int x, [Function x0]) => null;
83 List<A> f4<A>(A x) => null; 60 List<A> f4<A>(A x) => null;
84 int Function(List<Function> x) f5<B extends core.int>() => null; 61 int Function(List<Function> x) f5<B extends core.int>() => null;
85 int Function(int y, [List<int> x]) f6<B extends core.int>() => null; 62 int Function(int y, [List<int> x]) f6<B extends core.int>() => null;
86 Function Function([Function x0]) f7<B extends core.int>() => null; 63 Function Function([Function x0]) f7<B extends core.int>() => null;
87 Function Function({core.List<core.int> x}) f8<B extends core.int>() => null; 64 Function Function({core.List<core.int> x}) f8<B extends core.int>() => null;
(...skipping 23 matching lines...) Expand all
111 int Function(int y, {List<T> x}) x0; 88 int Function(int y, {List<T> x}) x0;
112 List<Function> Function(int x0, {core.List<core.int> x}) x1; 89 List<Function> Function(int x0, {core.List<core.int> x}) x1;
113 List<T> Function({List<Function> x}) x2; 90 List<T> Function({List<Function> x}) x2;
114 void Function(int x, [Function x2]) x3; 91 void Function(int x, [Function x2]) x3;
115 List<A> Function<A>(A x) x4; 92 List<A> Function<A>(A x) x4;
116 int Function(List<Function> x) Function<B extends core.int>() x5; 93 int Function(List<Function> x) Function<B extends core.int>() x5;
117 int Function(int y, [List<T> x]) Function<B extends core.int>() x6; 94 int Function(int y, [List<T> x]) Function<B extends core.int>() x6;
118 Function Function([Function x1]) Function<B extends core.int>() x7; 95 Function Function([Function x1]) Function<B extends core.int>() x7;
119 Function Function({core.List<core.int> x}) Function<B extends core.int>() x8; 96 Function Function({core.List<core.int> x}) Function<B extends core.int>() x8;
120 List<Function> Function(int y, {int x}) Function<B extends core.int>() x9; 97 List<Function> Function(int y, {int x}) Function<B extends core.int>() x9;
121 List<Function> Function(int x1, 98 List<Function> Function(int x1, [core.List<core.int> x])
122 [core.List<core.int> x]) Function<B extends core.int>() x10; 99 Function<B extends core.int>() x10;
123 core.List<core.int> Function(int x1) Function<B extends core.int>() x11; 100 core.List<core.int> Function(int x1) Function<B extends core.int>() x11;
124 core.List<core.int> Function(int x, 101 core.List<core.int> Function(int x, [List<Function> x1])
125 [List<Function> x1]) Function<B extends core.int>() x12; 102 Function<B extends core.int>() x12;
126 core.List<core.int> Function(int y, 103 core.List<core.int> Function(int y, {List<T> x})
127 {List<T> x}) Function<B extends core.int>() x13; 104 Function<B extends core.int>() x13;
128 List<T> Function([List<Function> x]) Function<B extends core.int>() x14; 105 List<T> Function([List<Function> x]) Function<B extends core.int>() x14;
129 List<T> Function(List<T> x1) Function<B extends core.int>() x15; 106 List<T> Function(List<T> x1) Function<B extends core.int>() x15;
130 Function(int x2, [Function x3]) Function<B extends core.int>() x16; 107 Function(int x2, [Function x3]) Function<B extends core.int>() x16;
131 Function(int x1, {core.List<core.int> x}) Function<B extends core.int>() x17; 108 Function(int x1, {core.List<core.int> x}) Function<B extends core.int>() x17;
132 void Function(Function x) Function<B extends core.int>() x18; 109 void Function(Function x) Function<B extends core.int>() x18;
133 void Function(int y, [core.List<core.int> x]) Function<B extends core.int>() 110 void Function(int y, [core.List<core.int> x]) Function<B extends core.int>()
134 x19; 111 x19;
135 int Function<A>() Function<B extends core.int>() x20; 112 int Function<A>() Function<B extends core.int>() x20;
136 core.List<core.int> Function<A>(A x) Function<B extends core.int>() x21; 113 core.List<core.int> Function<A>(A x) Function<B extends core.int>() x21;
137 A Function<A>(List<A> x) Function<B extends core.int>() x22; 114 A Function<A>(List<A> x) Function<B extends core.int>() x22;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 x0 = confuse(m0); 193 x0 = confuse(m0);
217 l0 = confuse(m0); 194 l0 = confuse(m0);
218 if (!tIsBool) { 195 if (!tIsBool) {
219 Expect.isTrue(f0 is F0<int>); 196 Expect.isTrue(f0 is F0<int>);
220 Expect.isFalse(f0 is F0<bool>); 197 Expect.isFalse(f0 is F0<bool>);
221 Expect.isTrue(confuse(f0) is F0<int>); 198 Expect.isTrue(confuse(f0) is F0<int>);
222 Expect.isFalse(confuse(f0) is F0<bool>); 199 Expect.isFalse(confuse(f0) is F0<bool>);
223 Expect.equals(tIsDynamic, m0 is F0<bool>); 200 Expect.equals(tIsDynamic, m0 is F0<bool>);
224 Expect.equals(tIsDynamic, confuse(m0) is F0<bool>); 201 Expect.equals(tIsDynamic, confuse(m0) is F0<bool>);
225 } else { 202 } else {
226 if (inCheckedMode) { 203 if (typeAssertionsEnabled) {
227 Expect.throws(() { 204 Expect.throws(() {
228 x0 = (f0 as dynamic); 205 x0 = (f0 as dynamic);
229 }); 206 });
230 Expect.throws(() { 207 Expect.throws(() {
231 x0 = confuse(f0); 208 x0 = confuse(f0);
232 }); 209 });
233 int Function(int y, {List<T> x}) l0; 210 int Function(int y, {List<T> x}) l0;
234 Expect.throws(() { 211 Expect.throws(() {
235 l0 = (f0 as dynamic); 212 l0 = (f0 as dynamic);
236 }); 213 });
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 x2 = confuse(m2); 270 x2 = confuse(m2);
294 l2 = confuse(m2); 271 l2 = confuse(m2);
295 if (!tIsBool) { 272 if (!tIsBool) {
296 Expect.isTrue(f2 is F2<int>); 273 Expect.isTrue(f2 is F2<int>);
297 Expect.isFalse(f2 is F2<bool>); 274 Expect.isFalse(f2 is F2<bool>);
298 Expect.isTrue(confuse(f2) is F2<int>); 275 Expect.isTrue(confuse(f2) is F2<int>);
299 Expect.isFalse(confuse(f2) is F2<bool>); 276 Expect.isFalse(confuse(f2) is F2<bool>);
300 Expect.equals(tIsDynamic, m2 is F2<bool>); 277 Expect.equals(tIsDynamic, m2 is F2<bool>);
301 Expect.equals(tIsDynamic, confuse(m2) is F2<bool>); 278 Expect.equals(tIsDynamic, confuse(m2) is F2<bool>);
302 } else { 279 } else {
303 if (inCheckedMode) { 280 if (typeAssertionsEnabled) {
304 Expect.throws(() { 281 Expect.throws(() {
305 x2 = (f2 as dynamic); 282 x2 = (f2 as dynamic);
306 }); 283 });
307 Expect.throws(() { 284 Expect.throws(() {
308 x2 = confuse(f2); 285 x2 = confuse(f2);
309 }); 286 });
310 List<T> Function({List<Function> x}) l2; 287 List<T> Function({List<Function> x}) l2;
311 Expect.throws(() { 288 Expect.throws(() {
312 l2 = (f2 as dynamic); 289 l2 = (f2 as dynamic);
313 }); 290 });
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 x6 = confuse(m6); 396 x6 = confuse(m6);
420 l6 = confuse(m6); 397 l6 = confuse(m6);
421 if (!tIsBool) { 398 if (!tIsBool) {
422 Expect.isTrue(f6 is F6<int>); 399 Expect.isTrue(f6 is F6<int>);
423 Expect.isFalse(f6 is F6<bool>); 400 Expect.isFalse(f6 is F6<bool>);
424 Expect.isTrue(confuse(f6) is F6<int>); 401 Expect.isTrue(confuse(f6) is F6<int>);
425 Expect.isFalse(confuse(f6) is F6<bool>); 402 Expect.isFalse(confuse(f6) is F6<bool>);
426 Expect.equals(tIsDynamic, m6 is F6<bool>); 403 Expect.equals(tIsDynamic, m6 is F6<bool>);
427 Expect.equals(tIsDynamic, confuse(m6) is F6<bool>); 404 Expect.equals(tIsDynamic, confuse(m6) is F6<bool>);
428 } else { 405 } else {
429 if (inCheckedMode) { 406 if (typeAssertionsEnabled) {
430 Expect.throws(() { 407 Expect.throws(() {
431 x6 = (f6 as dynamic); 408 x6 = (f6 as dynamic);
432 }); 409 });
433 Expect.throws(() { 410 Expect.throws(() {
434 x6 = confuse(f6); 411 x6 = confuse(f6);
435 }); 412 });
436 int Function(int y, [List<T> x]) Function<B extends core.int>() l6; 413 int Function(int y, [List<T> x]) Function<B extends core.int>() l6;
437 Expect.throws(() { 414 Expect.throws(() {
438 l6 = (f6 as dynamic); 415 l6 = (f6 as dynamic);
439 }); 416 });
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 l8; 459 l8;
483 // The static function f8 sets `T` to `int`. 460 // The static function f8 sets `T` to `int`.
484 if (!tIsBool) { 461 if (!tIsBool) {
485 x8 = f8 as dynamic; 462 x8 = f8 as dynamic;
486 l8 = f8 as dynamic; 463 l8 = f8 as dynamic;
487 x8 = confuse(f8); 464 x8 = confuse(f8);
488 l8 = confuse(f8); 465 l8 = confuse(f8);
489 } 466 }
490 467
491 Expect.isTrue(m8 is F8); 468 Expect.isTrue(m8 is F8);
492 Expect.isTrue(m8 is Function Function( 469 Expect.isTrue(m8 is Function Function({core.List<core.int> x})
493 {core.List<core.int> x}) Function<B extends core.int>()); 470 Function<B extends core.int>());
494 Expect.isTrue(confuse(m8) is F8); 471 Expect.isTrue(confuse(m8) is F8);
495 // In checked mode, verifies the type. 472 // In checked mode, verifies the type.
496 x8 = m8; 473 x8 = m8;
497 l8 = m8; 474 l8 = m8;
498 x8 = confuse(m8); 475 x8 = confuse(m8);
499 l8 = confuse(m8); 476 l8 = confuse(m8);
500 } 477 }
501 478
502 /// List<Function> Function(int y, {int x}) Function<B extends core.int>() 479 /// List<Function> Function(int y, {int x}) Function<B extends core.int>()
503 void testF9() { 480 void testF9() {
504 Expect.isTrue(f9 is F9); 481 Expect.isTrue(f9 is F9);
505 Expect.isTrue(confuse(f9) is F9); 482 Expect.isTrue(confuse(f9) is F9);
506 // In checked mode, verifies the type. 483 // In checked mode, verifies the type.
507 List<Function> Function(int y, {int x}) Function<B extends core.int>() l9; 484 List<Function> Function(int y, {int x}) Function<B extends core.int>() l9;
508 // The static function f9 sets `T` to `int`. 485 // The static function f9 sets `T` to `int`.
509 if (!tIsBool) { 486 if (!tIsBool) {
510 x9 = f9 as dynamic; 487 x9 = f9 as dynamic;
511 l9 = f9 as dynamic; 488 l9 = f9 as dynamic;
512 x9 = confuse(f9); 489 x9 = confuse(f9);
513 l9 = confuse(f9); 490 l9 = confuse(f9);
514 } 491 }
515 492
516 Expect.isTrue(m9 is F9); 493 Expect.isTrue(m9 is F9);
517 Expect.isTrue(m9 is List<Function> Function(int y, 494 Expect.isTrue(m9 is List<Function> Function(int y, {int x})
518 {int x}) Function<B extends core.int>()); 495 Function<B extends core.int>());
519 Expect.isTrue(confuse(m9) is F9); 496 Expect.isTrue(confuse(m9) is F9);
520 // In checked mode, verifies the type. 497 // In checked mode, verifies the type.
521 x9 = m9; 498 x9 = m9;
522 l9 = m9; 499 l9 = m9;
523 x9 = confuse(m9); 500 x9 = confuse(m9);
524 l9 = confuse(m9); 501 l9 = confuse(m9);
525 } 502 }
526 503
527 /// List<Function> Function(int x1, [core.List<core.int> x]) Function<B extend s core.int>() 504 /// List<Function> Function(int x1, [core.List<core.int> x]) Function<B extend s core.int>()
528 void testF10() { 505 void testF10() {
529 Expect.isTrue(f10 is F10); 506 Expect.isTrue(f10 is F10);
530 Expect.isTrue(confuse(f10) is F10); 507 Expect.isTrue(confuse(f10) is F10);
531 // In checked mode, verifies the type. 508 // In checked mode, verifies the type.
532 List<Function> Function(int x1, 509 List<Function> Function(int x1, [core.List<core.int> x])
533 [core.List<core.int> x]) Function<B extends core.int>() l10; 510 Function<B extends core.int>() l10;
534 // The static function f10 sets `T` to `int`. 511 // The static function f10 sets `T` to `int`.
535 if (!tIsBool) { 512 if (!tIsBool) {
536 x10 = f10 as dynamic; 513 x10 = f10 as dynamic;
537 l10 = f10 as dynamic; 514 l10 = f10 as dynamic;
538 x10 = confuse(f10); 515 x10 = confuse(f10);
539 l10 = confuse(f10); 516 l10 = confuse(f10);
540 } 517 }
541 518
542 Expect.isTrue(m10 is F10); 519 Expect.isTrue(m10 is F10);
543 Expect.isTrue(m10 is List<Function> Function(int x1, 520 Expect.isTrue(m10 is List<Function> Function(int x1,
544 [core.List<core.int> x]) Function<B extends core.int>()); 521 [core.List<core.int> x])
522 Function<B extends core.int>());
545 Expect.isTrue(confuse(m10) is F10); 523 Expect.isTrue(confuse(m10) is F10);
546 // In checked mode, verifies the type. 524 // In checked mode, verifies the type.
547 x10 = m10; 525 x10 = m10;
548 l10 = m10; 526 l10 = m10;
549 x10 = confuse(m10); 527 x10 = confuse(m10);
550 l10 = confuse(m10); 528 l10 = confuse(m10);
551 } 529 }
552 530
553 /// core.List<core.int> Function(int x1) Function<B extends core.int>() 531 /// core.List<core.int> Function(int x1) Function<B extends core.int>()
554 void testF11() { 532 void testF11() {
555 Expect.isTrue(f11 is F11); 533 Expect.isTrue(f11 is F11);
556 Expect.isTrue(confuse(f11) is F11); 534 Expect.isTrue(confuse(f11) is F11);
557 // In checked mode, verifies the type. 535 // In checked mode, verifies the type.
558 core.List<core.int> Function(int x1) Function<B extends core.int>() l11; 536 core.List<core.int> Function(int x1) Function<B extends core.int>() l11;
559 // The static function f11 sets `T` to `int`. 537 // The static function f11 sets `T` to `int`.
560 if (!tIsBool) { 538 if (!tIsBool) {
561 x11 = f11 as dynamic; 539 x11 = f11 as dynamic;
562 l11 = f11 as dynamic; 540 l11 = f11 as dynamic;
563 x11 = confuse(f11); 541 x11 = confuse(f11);
564 l11 = confuse(f11); 542 l11 = confuse(f11);
565 } 543 }
566 544
567 Expect.isTrue(m11 is F11); 545 Expect.isTrue(m11 is F11);
568 Expect.isTrue(m11 is core.List<core.int> Function( 546 Expect.isTrue(m11 is core.List<core.int> Function(int x1)
569 int x1) Function<B extends core.int>()); 547 Function<B extends core.int>());
570 Expect.isTrue(confuse(m11) is F11); 548 Expect.isTrue(confuse(m11) is F11);
571 // In checked mode, verifies the type. 549 // In checked mode, verifies the type.
572 x11 = m11; 550 x11 = m11;
573 l11 = m11; 551 l11 = m11;
574 x11 = confuse(m11); 552 x11 = confuse(m11);
575 l11 = confuse(m11); 553 l11 = confuse(m11);
576 } 554 }
577 555
578 /// core.List<core.int> Function(int x, [List<Function> x1]) Function<B extend s core.int>() 556 /// core.List<core.int> Function(int x, [List<Function> x1]) Function<B extend s core.int>()
579 void testF12() { 557 void testF12() {
580 Expect.isTrue(f12 is F12); 558 Expect.isTrue(f12 is F12);
581 Expect.isTrue(confuse(f12) is F12); 559 Expect.isTrue(confuse(f12) is F12);
582 // In checked mode, verifies the type. 560 // In checked mode, verifies the type.
583 core.List<core.int> Function(int x, 561 core.List<core.int> Function(int x, [List<Function> x1])
584 [List<Function> x1]) Function<B extends core.int>() l12; 562 Function<B extends core.int>() l12;
585 // The static function f12 sets `T` to `int`. 563 // The static function f12 sets `T` to `int`.
586 if (!tIsBool) { 564 if (!tIsBool) {
587 x12 = f12 as dynamic; 565 x12 = f12 as dynamic;
588 l12 = f12 as dynamic; 566 l12 = f12 as dynamic;
589 x12 = confuse(f12); 567 x12 = confuse(f12);
590 l12 = confuse(f12); 568 l12 = confuse(f12);
591 } 569 }
592 570
593 Expect.isTrue(m12 is F12); 571 Expect.isTrue(m12 is F12);
594 Expect.isTrue(m12 is core.List<core.int> Function(int x, 572 Expect.isTrue(m12 is core.List<core.int> Function(int x,
595 [List<Function> x1]) Function<B extends core.int>()); 573 [List<Function> x1])
574 Function<B extends core.int>());
596 Expect.isTrue(confuse(m12) is F12); 575 Expect.isTrue(confuse(m12) is F12);
597 // In checked mode, verifies the type. 576 // In checked mode, verifies the type.
598 x12 = m12; 577 x12 = m12;
599 l12 = m12; 578 l12 = m12;
600 x12 = confuse(m12); 579 x12 = confuse(m12);
601 l12 = confuse(m12); 580 l12 = confuse(m12);
602 } 581 }
603 582
604 /// core.List<core.int> Function(int y, {List<T> x}) Function<B extends core.i nt>() 583 /// core.List<core.int> Function(int y, {List<T> x}) Function<B extends core.i nt>()
605 void testF13() { 584 void testF13() {
606 Expect.isTrue(f13 is F13); 585 Expect.isTrue(f13 is F13);
607 Expect.isTrue(confuse(f13) is F13); 586 Expect.isTrue(confuse(f13) is F13);
608 // In checked mode, verifies the type. 587 // In checked mode, verifies the type.
609 core.List<core.int> Function(int y, 588 core.List<core.int> Function(int y, {List<T> x})
610 {List<T> x}) Function<B extends core.int>() l13; 589 Function<B extends core.int>() l13;
611 // The static function f13 sets `T` to `int`. 590 // The static function f13 sets `T` to `int`.
612 if (!tIsBool) { 591 if (!tIsBool) {
613 x13 = f13 as dynamic; 592 x13 = f13 as dynamic;
614 l13 = f13 as dynamic; 593 l13 = f13 as dynamic;
615 x13 = confuse(f13); 594 x13 = confuse(f13);
616 l13 = confuse(f13); 595 l13 = confuse(f13);
617 } 596 }
618 597
619 Expect.isTrue(m13 is F13); 598 Expect.isTrue(m13 is F13);
620 Expect.isTrue(m13 is core.List<core.int> Function(int y, 599 Expect.isTrue(m13 is core.List<core.int> Function(int y, {List<T> x})
621 {List<T> x}) Function<B extends core.int>()); 600 Function<B extends core.int>());
622 Expect.isTrue(confuse(m13) is F13); 601 Expect.isTrue(confuse(m13) is F13);
623 // In checked mode, verifies the type. 602 // In checked mode, verifies the type.
624 x13 = m13; 603 x13 = m13;
625 l13 = m13; 604 l13 = m13;
626 x13 = confuse(m13); 605 x13 = confuse(m13);
627 l13 = confuse(m13); 606 l13 = confuse(m13);
628 if (!tIsBool) { 607 if (!tIsBool) {
629 Expect.isTrue(f13 is F13<int>); 608 Expect.isTrue(f13 is F13<int>);
630 Expect.isFalse(f13 is F13<bool>); 609 Expect.isFalse(f13 is F13<bool>);
631 Expect.isTrue(confuse(f13) is F13<int>); 610 Expect.isTrue(confuse(f13) is F13<int>);
632 Expect.isFalse(confuse(f13) is F13<bool>); 611 Expect.isFalse(confuse(f13) is F13<bool>);
633 Expect.equals(tIsDynamic, m13 is F13<bool>); 612 Expect.equals(tIsDynamic, m13 is F13<bool>);
634 Expect.equals(tIsDynamic, confuse(m13) is F13<bool>); 613 Expect.equals(tIsDynamic, confuse(m13) is F13<bool>);
635 } else { 614 } else {
636 if (inCheckedMode) { 615 if (typeAssertionsEnabled) {
637 Expect.throws(() { 616 Expect.throws(() {
638 x13 = (f13 as dynamic); 617 x13 = (f13 as dynamic);
639 }); 618 });
640 Expect.throws(() { 619 Expect.throws(() {
641 x13 = confuse(f13); 620 x13 = confuse(f13);
642 }); 621 });
643 core.List<core.int> Function(int y, 622 core.List<core.int> Function(int y, {List<T> x})
644 {List<T> x}) Function<B extends core.int>() l13; 623 Function<B extends core.int>() l13;
645 Expect.throws(() { 624 Expect.throws(() {
646 l13 = (f13 as dynamic); 625 l13 = (f13 as dynamic);
647 }); 626 });
648 Expect.throws(() { 627 Expect.throws(() {
649 l13 = confuse(f13); 628 l13 = confuse(f13);
650 }); 629 });
651 } 630 }
652 core.List<core.int> Function(int y, 631 core.List<core.int> Function(int y, {List<T> x})
653 {List<T> x}) Function<B extends core.int>() l13 = m13; 632 Function<B extends core.int>() l13 = m13;
654 // In checked mode, verifies the type. 633 // In checked mode, verifies the type.
655 x13 = m13; 634 x13 = m13;
656 x13 = confuse(m13); 635 x13 = confuse(m13);
657 } 636 }
658 } 637 }
659 638
660 /// List<T> Function([List<Function> x]) Function<B extends core.int>() 639 /// List<T> Function([List<Function> x]) Function<B extends core.int>()
661 void testF14() { 640 void testF14() {
662 Expect.isTrue(f14 is F14); 641 Expect.isTrue(f14 is F14);
663 Expect.isTrue(confuse(f14) is F14); 642 Expect.isTrue(confuse(f14) is F14);
664 // In checked mode, verifies the type. 643 // In checked mode, verifies the type.
665 List<T> Function([List<Function> x]) Function<B extends core.int>() l14; 644 List<T> Function([List<Function> x]) Function<B extends core.int>() l14;
666 // The static function f14 sets `T` to `int`. 645 // The static function f14 sets `T` to `int`.
667 if (!tIsBool) { 646 if (!tIsBool) {
668 x14 = f14 as dynamic; 647 x14 = f14 as dynamic;
669 l14 = f14 as dynamic; 648 l14 = f14 as dynamic;
670 x14 = confuse(f14); 649 x14 = confuse(f14);
671 l14 = confuse(f14); 650 l14 = confuse(f14);
672 } 651 }
673 652
674 Expect.isTrue(m14 is F14); 653 Expect.isTrue(m14 is F14);
675 Expect.isTrue(m14 is List<T> Function( 654 Expect.isTrue(m14 is List<T> Function([List<Function> x])
676 [List<Function> x]) Function<B extends core.int>()); 655 Function<B extends core.int>());
677 Expect.isTrue(confuse(m14) is F14); 656 Expect.isTrue(confuse(m14) is F14);
678 // In checked mode, verifies the type. 657 // In checked mode, verifies the type.
679 x14 = m14; 658 x14 = m14;
680 l14 = m14; 659 l14 = m14;
681 x14 = confuse(m14); 660 x14 = confuse(m14);
682 l14 = confuse(m14); 661 l14 = confuse(m14);
683 if (!tIsBool) { 662 if (!tIsBool) {
684 Expect.isTrue(f14 is F14<int>); 663 Expect.isTrue(f14 is F14<int>);
685 Expect.isFalse(f14 is F14<bool>); 664 Expect.isFalse(f14 is F14<bool>);
686 Expect.isTrue(confuse(f14) is F14<int>); 665 Expect.isTrue(confuse(f14) is F14<int>);
687 Expect.isFalse(confuse(f14) is F14<bool>); 666 Expect.isFalse(confuse(f14) is F14<bool>);
688 Expect.equals(tIsDynamic, m14 is F14<bool>); 667 Expect.equals(tIsDynamic, m14 is F14<bool>);
689 Expect.equals(tIsDynamic, confuse(m14) is F14<bool>); 668 Expect.equals(tIsDynamic, confuse(m14) is F14<bool>);
690 } else { 669 } else {
691 if (inCheckedMode) { 670 if (typeAssertionsEnabled) {
692 Expect.throws(() { 671 Expect.throws(() {
693 x14 = (f14 as dynamic); 672 x14 = (f14 as dynamic);
694 }); 673 });
695 Expect.throws(() { 674 Expect.throws(() {
696 x14 = confuse(f14); 675 x14 = confuse(f14);
697 }); 676 });
698 List<T> Function([List<Function> x]) Function<B extends core.int>() l14; 677 List<T> Function([List<Function> x]) Function<B extends core.int>() l14;
699 Expect.throws(() { 678 Expect.throws(() {
700 l14 = (f14 as dynamic); 679 l14 = (f14 as dynamic);
701 }); 680 });
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 x15 = confuse(m15); 714 x15 = confuse(m15);
736 l15 = confuse(m15); 715 l15 = confuse(m15);
737 if (!tIsBool) { 716 if (!tIsBool) {
738 Expect.isTrue(f15 is F15<int>); 717 Expect.isTrue(f15 is F15<int>);
739 Expect.isFalse(f15 is F15<bool>); 718 Expect.isFalse(f15 is F15<bool>);
740 Expect.isTrue(confuse(f15) is F15<int>); 719 Expect.isTrue(confuse(f15) is F15<int>);
741 Expect.isFalse(confuse(f15) is F15<bool>); 720 Expect.isFalse(confuse(f15) is F15<bool>);
742 Expect.equals(tIsDynamic, m15 is F15<bool>); 721 Expect.equals(tIsDynamic, m15 is F15<bool>);
743 Expect.equals(tIsDynamic, confuse(m15) is F15<bool>); 722 Expect.equals(tIsDynamic, confuse(m15) is F15<bool>);
744 } else { 723 } else {
745 if (inCheckedMode) { 724 if (typeAssertionsEnabled) {
746 Expect.throws(() { 725 Expect.throws(() {
747 x15 = (f15 as dynamic); 726 x15 = (f15 as dynamic);
748 }); 727 });
749 Expect.throws(() { 728 Expect.throws(() {
750 x15 = confuse(f15); 729 x15 = confuse(f15);
751 }); 730 });
752 List<T> Function(List<T> x1) Function<B extends core.int>() l15; 731 List<T> Function(List<T> x1) Function<B extends core.int>() l15;
753 Expect.throws(() { 732 Expect.throws(() {
754 l15 = (f15 as dynamic); 733 l15 = (f15 as dynamic);
755 }); 734 });
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 l17; 777 l17;
799 // The static function f17 sets `T` to `int`. 778 // The static function f17 sets `T` to `int`.
800 if (!tIsBool) { 779 if (!tIsBool) {
801 x17 = f17 as dynamic; 780 x17 = f17 as dynamic;
802 l17 = f17 as dynamic; 781 l17 = f17 as dynamic;
803 x17 = confuse(f17); 782 x17 = confuse(f17);
804 l17 = confuse(f17); 783 l17 = confuse(f17);
805 } 784 }
806 785
807 Expect.isTrue(m17 is F17); 786 Expect.isTrue(m17 is F17);
808 Expect.isTrue(m17 is Function(int x1, 787 Expect.isTrue(m17 is Function(int x1, {core.List<core.int> x})
809 {core.List<core.int> x}) Function<B extends core.int>()); 788 Function<B extends core.int>());
810 Expect.isTrue(confuse(m17) is F17); 789 Expect.isTrue(confuse(m17) is F17);
811 // In checked mode, verifies the type. 790 // In checked mode, verifies the type.
812 x17 = m17; 791 x17 = m17;
813 l17 = m17; 792 l17 = m17;
814 x17 = confuse(m17); 793 x17 = confuse(m17);
815 l17 = confuse(m17); 794 l17 = confuse(m17);
816 } 795 }
817 796
818 /// void Function(Function x) Function<B extends core.int>() 797 /// void Function(Function x) Function<B extends core.int>()
819 void testF18() { 798 void testF18() {
(...skipping 29 matching lines...) Expand all
849 l19; 828 l19;
850 // The static function f19 sets `T` to `int`. 829 // The static function f19 sets `T` to `int`.
851 if (!tIsBool) { 830 if (!tIsBool) {
852 x19 = f19 as dynamic; 831 x19 = f19 as dynamic;
853 l19 = f19 as dynamic; 832 l19 = f19 as dynamic;
854 x19 = confuse(f19); 833 x19 = confuse(f19);
855 l19 = confuse(f19); 834 l19 = confuse(f19);
856 } 835 }
857 836
858 Expect.isTrue(m19 is F19); 837 Expect.isTrue(m19 is F19);
859 Expect.isTrue(m19 is void Function(int y, 838 Expect.isTrue(m19 is void Function(int y, [core.List<core.int> x])
860 [core.List<core.int> x]) Function<B extends core.int>()); 839 Function<B extends core.int>());
861 Expect.isTrue(confuse(m19) is F19); 840 Expect.isTrue(confuse(m19) is F19);
862 // In checked mode, verifies the type. 841 // In checked mode, verifies the type.
863 x19 = m19; 842 x19 = m19;
864 l19 = m19; 843 l19 = m19;
865 x19 = confuse(m19); 844 x19 = confuse(m19);
866 l19 = confuse(m19); 845 l19 = confuse(m19);
867 } 846 }
868 847
869 /// int Function<A>() Function<B extends core.int>() 848 /// int Function<A>() Function<B extends core.int>()
870 void testF20() { 849 void testF20() {
(...skipping 27 matching lines...) Expand all
898 core.List<core.int> Function<A>(A x) Function<B extends core.int>() l21; 877 core.List<core.int> Function<A>(A x) Function<B extends core.int>() l21;
899 // The static function f21 sets `T` to `int`. 878 // The static function f21 sets `T` to `int`.
900 if (!tIsBool) { 879 if (!tIsBool) {
901 x21 = f21 as dynamic; 880 x21 = f21 as dynamic;
902 l21 = f21 as dynamic; 881 l21 = f21 as dynamic;
903 x21 = confuse(f21); 882 x21 = confuse(f21);
904 l21 = confuse(f21); 883 l21 = confuse(f21);
905 } 884 }
906 885
907 Expect.isTrue(m21 is F21); 886 Expect.isTrue(m21 is F21);
908 Expect.isTrue(m21 is core.List<core.int> Function<A>( 887 Expect.isTrue(m21 is core.List<core.int> Function<A>(A x)
909 A x) Function<B extends core.int>()); 888 Function<B extends core.int>());
910 Expect.isTrue(confuse(m21) is F21); 889 Expect.isTrue(confuse(m21) is F21);
911 // In checked mode, verifies the type. 890 // In checked mode, verifies the type.
912 x21 = m21; 891 x21 = m21;
913 l21 = m21; 892 l21 = m21;
914 x21 = confuse(m21); 893 x21 = confuse(m21);
915 l21 = confuse(m21); 894 l21 = confuse(m21);
916 } 895 }
917 896
918 /// A Function<A>(List<A> x) Function<B extends core.int>() 897 /// A Function<A>(List<A> x) Function<B extends core.int>()
919 void testF22() { 898 void testF22() {
(...skipping 19 matching lines...) Expand all
939 x22 = confuse(m22); 918 x22 = confuse(m22);
940 l22 = confuse(m22); 919 l22 = confuse(m22);
941 } 920 }
942 } 921 }
943 922
944 void main() { 923 void main() {
945 new U54().runTests(); 924 new U54().runTests();
946 new U54<int>(tIsInt: true).runTests(); 925 new U54<int>(tIsInt: true).runTests();
947 new U54<bool>(tIsBool: true).runTests(); 926 new U54<bool>(tIsBool: true).runTests();
948 } 927 }
OLDNEW
« no previous file with comments | « tests/language/function_type/function_type53_test.dart ('k') | tests/language/function_type/function_type55_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698