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

Side by Side Diff: tests/language/function_type/function_type10_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, {int x});
23 bool result = false; 23 typedef F1<T> = Function Function(int y, {List<T> x});
24 assert(result = true); 24 typedef F2<T> = core.List<core.int> Function(int x0, {core.List<core.int> x});
25 return result; 25 typedef F3<T> = Function({List<Function> x});
26 })(); 26 typedef F4<T> = List<Function> Function<A>(List<Function> x);
27 27 typedef F5<T> = int Function(Function x) Function<B extends core.int>();
28 typedef F0<T> 28 typedef F6<T> = int Function(int y, [core.List<core.int> x])
29 = int Function(int y, {int x}); 29 Function<B extends core.int>();
30 typedef F1<T> 30 typedef F7<T> = Function Function([int x1]) Function<B extends core.int>();
31 = Function Function(int y, {List<T> x}); 31 typedef F8<T> = Function Function({List<Function> x})
32 typedef F2<T> 32 Function<B extends core.int>();
33 = core.List<core.int> Function(int x0, {core.List<core.int> x}); 33 typedef F9<T> = Function Function() Function<B extends core.int>();
34 typedef F3<T> 34 typedef F10<T> = List<Function> Function(int x1, [List<Function> x])
35 = Function({List<Function> x}); 35 Function<B extends core.int>();
36 typedef F4<T> 36 typedef F11<T> = List<Function> Function([List<T> x1])
37 = List<Function> Function<A>(List<Function> x); 37 Function<B extends core.int>();
38 typedef F5<T> 38 typedef F12<T> = core.List<core.int> Function(int x, [Function x1])
39 = int Function(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, {core.List<core.int> x})
41 = int Function(int y, 41 Function<B extends core.int>();
42 [core.List<core.int> x]) Function<B extends core.int>(); 42 typedef F14<T> = List<T> Function([Function x]) Function<B extends core.int>();
43 typedef F7<T> 43 typedef F15<T> = List<T> Function(core.List<core.int> x1)
44 = Function Function([int x1]) Function<B extends core.int>(); 44 Function<B extends core.int>();
45 typedef F8<T> 45 typedef F16<T> = Function(int x2, [int x3]) Function<B extends core.int>();
46 = Function Function({List<Function> x}) Function<B extends core.int>(); 46 typedef F17<T> = Function(int x1, {List<Function> x})
47 typedef F9<T> 47 Function<B extends core.int>();
48 = Function Function() Function<B extends core.int>(); 48 typedef F18<T> = void Function(int x) Function<B extends core.int>();
49 typedef F10<T> 49 typedef F19<T> = void Function(int y, [List<Function> x])
50 = List<Function> Function(int x1, 50 Function<B extends core.int>();
51 [List<Function> x]) Function<B extends core.int>(); 51 typedef F20<T> = void Function(int x2, [List<T> x3])
52 typedef F11<T> 52 Function<B extends core.int>();
53 = List<Function> Function([List<T> x1]) Function<B extends core.int>(); 53 typedef F21<T> = List<Function> Function<A>(core.List<core.int> x)
54 typedef F12<T> 54 Function<B extends core.int>();
55 = core.List<core.int> Function(int x, 55 typedef F22<T> = Function<A>(List<T> x) Function<B extends core.int>();
56 [Function x1]) Function<B extends core.int>(); 56 typedef F23<T> = void Function<A>() Function<B extends core.int>();
57 typedef F13<T>
58 = core.List<core.int> Function(int y,
59 {core.List<core.int> x}) Function<B extends core.int>();
60 typedef F14<T>
61 = List<T> Function([Function x]) Function<B extends core.int>();
62 typedef F15<T>
63 = List<T> Function(core.List<core.int> x1) Function<B extends core.int>();
64 typedef F16<T>
65 = Function(int x2, [int x3]) Function<B extends core.int>();
66 typedef F17<T>
67 = Function(int x1, {List<Function> x}) Function<B extends core.int>();
68 typedef F18<T>
69 = void Function(int x) Function<B extends core.int>();
70 typedef F19<T>
71 = void Function(int y, [List<Function> x]) Function<B extends core.int>();
72 typedef F20<T>
73 = void Function(int x2, [List<T> x3]) Function<B extends core.int>();
74 typedef F21<T>
75 = List<Function> Function<A>(
76 core.List<core.int> x) Function<B extends core.int>();
77 typedef F22<T>
78 = Function<A>(List<T> x) Function<B extends core.int>();
79 typedef F23<T>
80 = void Function<A>() Function<B extends core.int>();
81 57
82 int f0(int y, {int x}) => null; 58 int f0(int y, {int x}) => null;
83 Function f1(int y, {List<int> x}) => null; 59 Function f1(int y, {List<int> x}) => null;
84 core.List<core.int> f2(int x0, {core.List<core.int> x}) => null; 60 core.List<core.int> f2(int x0, {core.List<core.int> x}) => null;
85 f3({List<Function> x}) => null; 61 f3({List<Function> x}) => null;
86 List<Function> f4<A>(List<Function> x) => null; 62 List<Function> f4<A>(List<Function> x) => null;
87 int Function(Function x) f5<B extends core.int>() => null; 63 int Function(Function x) f5<B extends core.int>() => null;
88 int Function(int y, [core.List<core.int> x]) f6<B extends core.int>() => null; 64 int Function(int y, [core.List<core.int> x]) f6<B extends core.int>() => null;
89 Function Function([int x0]) f7<B extends core.int>() => null; 65 Function Function([int x0]) f7<B extends core.int>() => null;
90 Function Function({List<Function> x}) f8<B extends core.int>() => null; 66 Function Function({List<Function> x}) f8<B extends core.int>() => null;
(...skipping 26 matching lines...) Expand all
117 Function Function(int y, {List<T> x}) x1; 93 Function Function(int y, {List<T> x}) x1;
118 core.List<core.int> Function(int x0, {core.List<core.int> x}) x2; 94 core.List<core.int> Function(int x0, {core.List<core.int> x}) x2;
119 Function({List<Function> x}) x3; 95 Function({List<Function> x}) x3;
120 List<Function> Function<A>(List<Function> x) x4; 96 List<Function> Function<A>(List<Function> x) x4;
121 int Function(Function x) Function<B extends core.int>() x5; 97 int Function(Function x) Function<B extends core.int>() x5;
122 int Function(int y, [core.List<core.int> x]) Function<B extends core.int>() 98 int Function(int y, [core.List<core.int> x]) Function<B extends core.int>()
123 x6; 99 x6;
124 Function Function([int x1]) Function<B extends core.int>() x7; 100 Function Function([int x1]) Function<B extends core.int>() x7;
125 Function Function({List<Function> x}) Function<B extends core.int>() x8; 101 Function Function({List<Function> x}) Function<B extends core.int>() x8;
126 Function Function() Function<B extends core.int>() x9; 102 Function Function() Function<B extends core.int>() x9;
127 List<Function> Function(int x1, 103 List<Function> Function(int x1, [List<Function> x])
128 [List<Function> x]) Function<B extends core.int>() x10; 104 Function<B extends core.int>() x10;
129 List<Function> Function([List<T> x1]) Function<B extends core.int>() x11; 105 List<Function> Function([List<T> x1]) Function<B extends core.int>() x11;
130 core.List<core.int> Function(int x, 106 core.List<core.int> Function(int x, [Function x1])
131 [Function x1]) Function<B extends core.int>() x12; 107 Function<B extends core.int>() x12;
132 core.List<core.int> Function(int y, 108 core.List<core.int> Function(int y, {core.List<core.int> x})
133 {core.List<core.int> x}) Function<B extends core.int>() x13; 109 Function<B extends core.int>() x13;
134 List<T> Function([Function x]) Function<B extends core.int>() x14; 110 List<T> Function([Function x]) Function<B extends core.int>() x14;
135 List<T> Function(core.List<core.int> x1) Function<B extends core.int>() x15; 111 List<T> Function(core.List<core.int> x1) Function<B extends core.int>() x15;
136 Function(int x2, [int x3]) Function<B extends core.int>() x16; 112 Function(int x2, [int x3]) Function<B extends core.int>() x16;
137 Function(int x1, {List<Function> x}) Function<B extends core.int>() x17; 113 Function(int x1, {List<Function> x}) Function<B extends core.int>() x17;
138 void Function(int x) Function<B extends core.int>() x18; 114 void Function(int x) Function<B extends core.int>() x18;
139 void Function(int y, [List<Function> x]) Function<B extends core.int>() x19; 115 void Function(int y, [List<Function> x]) Function<B extends core.int>() x19;
140 void Function(int x2, [List<T> x3]) Function<B extends core.int>() x20; 116 void Function(int x2, [List<T> x3]) Function<B extends core.int>() x20;
141 List<Function> Function<A>( 117 List<Function> Function<A>(core.List<core.int> x)
142 core.List<core.int> x) Function<B extends core.int>() x21; 118 Function<B extends core.int>() x21;
143 Function<A>(List<T> x) Function<B extends core.int>() x22; 119 Function<A>(List<T> x) Function<B extends core.int>() x22;
144 void Function<A>() Function<B extends core.int>() x23; 120 void Function<A>() Function<B extends core.int>() x23;
145 121
146 U10({this.tIsBool: false, this.tIsInt: false}) 122 U10({this.tIsBool: false, this.tIsInt: false})
147 : tIsDynamic = !tIsBool && !tIsInt; 123 : tIsDynamic = !tIsBool && !tIsInt;
148 124
149 int m0(int y, {int x}) => null; 125 int m0(int y, {int x}) => null;
150 Function m1(int y, {List<T> x}) => null; 126 Function m1(int y, {List<T> x}) => null;
151 core.List<core.int> m2(int x0, {core.List<core.int> x}) => null; 127 core.List<core.int> m2(int x0, {core.List<core.int> x}) => null;
152 m3({List<Function> x}) => null; 128 m3({List<Function> x}) => null;
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 x1 = confuse(m1); 225 x1 = confuse(m1);
250 l1 = confuse(m1); 226 l1 = confuse(m1);
251 if (!tIsBool) { 227 if (!tIsBool) {
252 Expect.isTrue(f1 is F1<int>); 228 Expect.isTrue(f1 is F1<int>);
253 Expect.isFalse(f1 is F1<bool>); 229 Expect.isFalse(f1 is F1<bool>);
254 Expect.isTrue(confuse(f1) is F1<int>); 230 Expect.isTrue(confuse(f1) is F1<int>);
255 Expect.isFalse(confuse(f1) is F1<bool>); 231 Expect.isFalse(confuse(f1) is F1<bool>);
256 Expect.equals(tIsDynamic, m1 is F1<bool>); 232 Expect.equals(tIsDynamic, m1 is F1<bool>);
257 Expect.equals(tIsDynamic, confuse(m1) is F1<bool>); 233 Expect.equals(tIsDynamic, confuse(m1) is F1<bool>);
258 } else { 234 } else {
259 if (inCheckedMode) { 235 if (typeAssertionsEnabled) {
260 Expect.throws(() { 236 Expect.throws(() {
261 x1 = (f1 as dynamic); 237 x1 = (f1 as dynamic);
262 }); 238 });
263 Expect.throws(() { 239 Expect.throws(() {
264 x1 = confuse(f1); 240 x1 = confuse(f1);
265 }); 241 });
266 Function Function(int y, {List<T> x}) l1; 242 Function Function(int y, {List<T> x}) l1;
267 Expect.throws(() { 243 Expect.throws(() {
268 l1 = (f1 as dynamic); 244 l1 = (f1 as dynamic);
269 }); 245 });
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 l6; 361 l6;
386 // The static function f6 sets `T` to `int`. 362 // The static function f6 sets `T` to `int`.
387 if (!tIsBool) { 363 if (!tIsBool) {
388 x6 = f6 as dynamic; 364 x6 = f6 as dynamic;
389 l6 = f6 as dynamic; 365 l6 = f6 as dynamic;
390 x6 = confuse(f6); 366 x6 = confuse(f6);
391 l6 = confuse(f6); 367 l6 = confuse(f6);
392 } 368 }
393 369
394 Expect.isTrue(m6 is F6); 370 Expect.isTrue(m6 is F6);
395 Expect.isTrue(m6 is int Function(int y, 371 Expect.isTrue(m6 is int Function(int y, [core.List<core.int> x])
396 [core.List<core.int> x]) Function<B extends core.int>()); 372 Function<B extends core.int>());
397 Expect.isTrue(confuse(m6) is F6); 373 Expect.isTrue(confuse(m6) is F6);
398 // In checked mode, verifies the type. 374 // In checked mode, verifies the type.
399 x6 = m6; 375 x6 = m6;
400 l6 = m6; 376 l6 = m6;
401 x6 = confuse(m6); 377 x6 = confuse(m6);
402 l6 = confuse(m6); 378 l6 = confuse(m6);
403 } 379 }
404 380
405 /// Function Function([int x1]) Function<B extends core.int>() 381 /// Function Function([int x1]) Function<B extends core.int>()
406 void testF7() { 382 void testF7() {
(...skipping 28 matching lines...) Expand all
435 Function Function({List<Function> x}) Function<B extends core.int>() l8; 411 Function Function({List<Function> x}) Function<B extends core.int>() l8;
436 // The static function f8 sets `T` to `int`. 412 // The static function f8 sets `T` to `int`.
437 if (!tIsBool) { 413 if (!tIsBool) {
438 x8 = f8 as dynamic; 414 x8 = f8 as dynamic;
439 l8 = f8 as dynamic; 415 l8 = f8 as dynamic;
440 x8 = confuse(f8); 416 x8 = confuse(f8);
441 l8 = confuse(f8); 417 l8 = confuse(f8);
442 } 418 }
443 419
444 Expect.isTrue(m8 is F8); 420 Expect.isTrue(m8 is F8);
445 Expect.isTrue(m8 is Function Function( 421 Expect.isTrue(m8 is Function Function({List<Function> x})
446 {List<Function> x}) Function<B extends core.int>()); 422 Function<B extends core.int>());
447 Expect.isTrue(confuse(m8) is F8); 423 Expect.isTrue(confuse(m8) is F8);
448 // In checked mode, verifies the type. 424 // In checked mode, verifies the type.
449 x8 = m8; 425 x8 = m8;
450 l8 = m8; 426 l8 = m8;
451 x8 = confuse(m8); 427 x8 = confuse(m8);
452 l8 = confuse(m8); 428 l8 = confuse(m8);
453 } 429 }
454 430
455 /// Function Function() Function<B extends core.int>() 431 /// Function Function() Function<B extends core.int>()
456 void testF9() { 432 void testF9() {
(...skipping 17 matching lines...) Expand all
474 l9 = m9; 450 l9 = m9;
475 x9 = confuse(m9); 451 x9 = confuse(m9);
476 l9 = confuse(m9); 452 l9 = confuse(m9);
477 } 453 }
478 454
479 /// List<Function> Function(int x1, [List<Function> x]) Function<B extends cor e.int>() 455 /// List<Function> Function(int x1, [List<Function> x]) Function<B extends cor e.int>()
480 void testF10() { 456 void testF10() {
481 Expect.isTrue(f10 is F10); 457 Expect.isTrue(f10 is F10);
482 Expect.isTrue(confuse(f10) is F10); 458 Expect.isTrue(confuse(f10) is F10);
483 // In checked mode, verifies the type. 459 // In checked mode, verifies the type.
484 List<Function> Function(int x1, 460 List<Function> Function(int x1, [List<Function> x])
485 [List<Function> x]) Function<B extends core.int>() l10; 461 Function<B extends core.int>() l10;
486 // The static function f10 sets `T` to `int`. 462 // The static function f10 sets `T` to `int`.
487 if (!tIsBool) { 463 if (!tIsBool) {
488 x10 = f10 as dynamic; 464 x10 = f10 as dynamic;
489 l10 = f10 as dynamic; 465 l10 = f10 as dynamic;
490 x10 = confuse(f10); 466 x10 = confuse(f10);
491 l10 = confuse(f10); 467 l10 = confuse(f10);
492 } 468 }
493 469
494 Expect.isTrue(m10 is F10); 470 Expect.isTrue(m10 is F10);
495 Expect.isTrue(m10 is List<Function> Function(int x1, 471 Expect.isTrue(m10 is List<Function> Function(int x1, [List<Function> x])
496 [List<Function> x]) Function<B extends core.int>()); 472 Function<B extends core.int>());
497 Expect.isTrue(confuse(m10) is F10); 473 Expect.isTrue(confuse(m10) is F10);
498 // In checked mode, verifies the type. 474 // In checked mode, verifies the type.
499 x10 = m10; 475 x10 = m10;
500 l10 = m10; 476 l10 = m10;
501 x10 = confuse(m10); 477 x10 = confuse(m10);
502 l10 = confuse(m10); 478 l10 = confuse(m10);
503 } 479 }
504 480
505 /// List<Function> Function([List<T> x1]) Function<B extends core.int>() 481 /// List<Function> Function([List<T> x1]) Function<B extends core.int>()
506 void testF11() { 482 void testF11() {
507 Expect.isTrue(f11 is F11); 483 Expect.isTrue(f11 is F11);
508 Expect.isTrue(confuse(f11) is F11); 484 Expect.isTrue(confuse(f11) is F11);
509 // In checked mode, verifies the type. 485 // In checked mode, verifies the type.
510 List<Function> Function([List<T> x1]) Function<B extends core.int>() l11; 486 List<Function> Function([List<T> x1]) Function<B extends core.int>() l11;
511 // The static function f11 sets `T` to `int`. 487 // The static function f11 sets `T` to `int`.
512 if (!tIsBool) { 488 if (!tIsBool) {
513 x11 = f11 as dynamic; 489 x11 = f11 as dynamic;
514 l11 = f11 as dynamic; 490 l11 = f11 as dynamic;
515 x11 = confuse(f11); 491 x11 = confuse(f11);
516 l11 = confuse(f11); 492 l11 = confuse(f11);
517 } 493 }
518 494
519 Expect.isTrue(m11 is F11); 495 Expect.isTrue(m11 is F11);
520 Expect.isTrue(m11 is List<Function> Function( 496 Expect.isTrue(m11 is List<Function> Function([List<T> x1])
521 [List<T> x1]) Function<B extends core.int>()); 497 Function<B extends core.int>());
522 Expect.isTrue(confuse(m11) is F11); 498 Expect.isTrue(confuse(m11) is F11);
523 // In checked mode, verifies the type. 499 // In checked mode, verifies the type.
524 x11 = m11; 500 x11 = m11;
525 l11 = m11; 501 l11 = m11;
526 x11 = confuse(m11); 502 x11 = confuse(m11);
527 l11 = confuse(m11); 503 l11 = confuse(m11);
528 if (!tIsBool) { 504 if (!tIsBool) {
529 Expect.isTrue(f11 is F11<int>); 505 Expect.isTrue(f11 is F11<int>);
530 Expect.isFalse(f11 is F11<bool>); 506 Expect.isFalse(f11 is F11<bool>);
531 Expect.isTrue(confuse(f11) is F11<int>); 507 Expect.isTrue(confuse(f11) is F11<int>);
532 Expect.isFalse(confuse(f11) is F11<bool>); 508 Expect.isFalse(confuse(f11) is F11<bool>);
533 Expect.equals(tIsDynamic, m11 is F11<bool>); 509 Expect.equals(tIsDynamic, m11 is F11<bool>);
534 Expect.equals(tIsDynamic, confuse(m11) is F11<bool>); 510 Expect.equals(tIsDynamic, confuse(m11) is F11<bool>);
535 } else { 511 } else {
536 if (inCheckedMode) { 512 if (typeAssertionsEnabled) {
537 Expect.throws(() { 513 Expect.throws(() {
538 x11 = (f11 as dynamic); 514 x11 = (f11 as dynamic);
539 }); 515 });
540 Expect.throws(() { 516 Expect.throws(() {
541 x11 = confuse(f11); 517 x11 = confuse(f11);
542 }); 518 });
543 List<Function> Function([List<T> x1]) Function<B extends core.int>() 519 List<Function> Function([List<T> x1]) Function<B extends core.int>()
544 l11; 520 l11;
545 Expect.throws(() { 521 Expect.throws(() {
546 l11 = (f11 as dynamic); 522 l11 = (f11 as dynamic);
547 }); 523 });
548 Expect.throws(() { 524 Expect.throws(() {
549 l11 = confuse(f11); 525 l11 = confuse(f11);
550 }); 526 });
551 } 527 }
552 List<Function> Function([List<T> x1]) Function<B extends core.int>() l11 = 528 List<Function> Function([List<T> x1]) Function<B extends core.int>() l11 =
553 m11; 529 m11;
554 // In checked mode, verifies the type. 530 // In checked mode, verifies the type.
555 x11 = m11; 531 x11 = m11;
556 x11 = confuse(m11); 532 x11 = confuse(m11);
557 } 533 }
558 } 534 }
559 535
560 /// core.List<core.int> Function(int x, [Function x1]) Function<B extends core .int>() 536 /// core.List<core.int> Function(int x, [Function x1]) Function<B extends core .int>()
561 void testF12() { 537 void testF12() {
562 Expect.isTrue(f12 is F12); 538 Expect.isTrue(f12 is F12);
563 Expect.isTrue(confuse(f12) is F12); 539 Expect.isTrue(confuse(f12) is F12);
564 // In checked mode, verifies the type. 540 // In checked mode, verifies the type.
565 core.List<core.int> Function(int x, 541 core.List<core.int> Function(int x, [Function x1])
566 [Function x1]) Function<B extends core.int>() l12; 542 Function<B extends core.int>() l12;
567 // The static function f12 sets `T` to `int`. 543 // The static function f12 sets `T` to `int`.
568 if (!tIsBool) { 544 if (!tIsBool) {
569 x12 = f12 as dynamic; 545 x12 = f12 as dynamic;
570 l12 = f12 as dynamic; 546 l12 = f12 as dynamic;
571 x12 = confuse(f12); 547 x12 = confuse(f12);
572 l12 = confuse(f12); 548 l12 = confuse(f12);
573 } 549 }
574 550
575 Expect.isTrue(m12 is F12); 551 Expect.isTrue(m12 is F12);
576 Expect.isTrue(m12 is core.List<core.int> Function(int x, 552 Expect.isTrue(m12 is core.List<core.int> Function(int x, [Function x1])
577 [Function x1]) Function<B extends core.int>()); 553 Function<B extends core.int>());
578 Expect.isTrue(confuse(m12) is F12); 554 Expect.isTrue(confuse(m12) is F12);
579 // In checked mode, verifies the type. 555 // In checked mode, verifies the type.
580 x12 = m12; 556 x12 = m12;
581 l12 = m12; 557 l12 = m12;
582 x12 = confuse(m12); 558 x12 = confuse(m12);
583 l12 = confuse(m12); 559 l12 = confuse(m12);
584 } 560 }
585 561
586 /// core.List<core.int> Function(int y, {core.List<core.int> x}) Function<B ex tends core.int>() 562 /// core.List<core.int> Function(int y, {core.List<core.int> x}) Function<B ex tends core.int>()
587 void testF13() { 563 void testF13() {
588 Expect.isTrue(f13 is F13); 564 Expect.isTrue(f13 is F13);
589 Expect.isTrue(confuse(f13) is F13); 565 Expect.isTrue(confuse(f13) is F13);
590 // In checked mode, verifies the type. 566 // In checked mode, verifies the type.
591 core.List<core.int> Function(int y, 567 core.List<core.int> Function(int y, {core.List<core.int> x})
592 {core.List<core.int> x}) Function<B extends core.int>() l13; 568 Function<B extends core.int>() l13;
593 // The static function f13 sets `T` to `int`. 569 // The static function f13 sets `T` to `int`.
594 if (!tIsBool) { 570 if (!tIsBool) {
595 x13 = f13 as dynamic; 571 x13 = f13 as dynamic;
596 l13 = f13 as dynamic; 572 l13 = f13 as dynamic;
597 x13 = confuse(f13); 573 x13 = confuse(f13);
598 l13 = confuse(f13); 574 l13 = confuse(f13);
599 } 575 }
600 576
601 Expect.isTrue(m13 is F13); 577 Expect.isTrue(m13 is F13);
602 Expect.isTrue(m13 is core.List<core.int> Function(int y, 578 Expect.isTrue(m13 is core.List<core.int> Function(int y,
603 {core.List<core.int> x}) Function<B extends core.int>()); 579 {core.List<core.int> x})
580 Function<B extends core.int>());
604 Expect.isTrue(confuse(m13) is F13); 581 Expect.isTrue(confuse(m13) is F13);
605 // In checked mode, verifies the type. 582 // In checked mode, verifies the type.
606 x13 = m13; 583 x13 = m13;
607 l13 = m13; 584 l13 = m13;
608 x13 = confuse(m13); 585 x13 = confuse(m13);
609 l13 = confuse(m13); 586 l13 = confuse(m13);
610 } 587 }
611 588
612 /// List<T> Function([Function x]) Function<B extends core.int>() 589 /// List<T> Function([Function x]) Function<B extends core.int>()
613 void testF14() { 590 void testF14() {
(...skipping 19 matching lines...) Expand all
633 x14 = confuse(m14); 610 x14 = confuse(m14);
634 l14 = confuse(m14); 611 l14 = confuse(m14);
635 if (!tIsBool) { 612 if (!tIsBool) {
636 Expect.isTrue(f14 is F14<int>); 613 Expect.isTrue(f14 is F14<int>);
637 Expect.isFalse(f14 is F14<bool>); 614 Expect.isFalse(f14 is F14<bool>);
638 Expect.isTrue(confuse(f14) is F14<int>); 615 Expect.isTrue(confuse(f14) is F14<int>);
639 Expect.isFalse(confuse(f14) is F14<bool>); 616 Expect.isFalse(confuse(f14) is F14<bool>);
640 Expect.equals(tIsDynamic, m14 is F14<bool>); 617 Expect.equals(tIsDynamic, m14 is F14<bool>);
641 Expect.equals(tIsDynamic, confuse(m14) is F14<bool>); 618 Expect.equals(tIsDynamic, confuse(m14) is F14<bool>);
642 } else { 619 } else {
643 if (inCheckedMode) { 620 if (typeAssertionsEnabled) {
644 Expect.throws(() { 621 Expect.throws(() {
645 x14 = (f14 as dynamic); 622 x14 = (f14 as dynamic);
646 }); 623 });
647 Expect.throws(() { 624 Expect.throws(() {
648 x14 = confuse(f14); 625 x14 = confuse(f14);
649 }); 626 });
650 List<T> Function([Function x]) Function<B extends core.int>() l14; 627 List<T> Function([Function x]) Function<B extends core.int>() l14;
651 Expect.throws(() { 628 Expect.throws(() {
652 l14 = (f14 as dynamic); 629 l14 = (f14 as dynamic);
653 }); 630 });
(...skipping 16 matching lines...) Expand all
670 List<T> Function(core.List<core.int> x1) Function<B extends core.int>() l15; 647 List<T> Function(core.List<core.int> x1) Function<B extends core.int>() l15;
671 // The static function f15 sets `T` to `int`. 648 // The static function f15 sets `T` to `int`.
672 if (!tIsBool) { 649 if (!tIsBool) {
673 x15 = f15 as dynamic; 650 x15 = f15 as dynamic;
674 l15 = f15 as dynamic; 651 l15 = f15 as dynamic;
675 x15 = confuse(f15); 652 x15 = confuse(f15);
676 l15 = confuse(f15); 653 l15 = confuse(f15);
677 } 654 }
678 655
679 Expect.isTrue(m15 is F15); 656 Expect.isTrue(m15 is F15);
680 Expect.isTrue(m15 is List<T> Function( 657 Expect.isTrue(m15 is List<T> Function(core.List<core.int> x1)
681 core.List<core.int> x1) Function<B extends core.int>()); 658 Function<B extends core.int>());
682 Expect.isTrue(confuse(m15) is F15); 659 Expect.isTrue(confuse(m15) is F15);
683 // In checked mode, verifies the type. 660 // In checked mode, verifies the type.
684 x15 = m15; 661 x15 = m15;
685 l15 = m15; 662 l15 = m15;
686 x15 = confuse(m15); 663 x15 = confuse(m15);
687 l15 = confuse(m15); 664 l15 = confuse(m15);
688 if (!tIsBool) { 665 if (!tIsBool) {
689 Expect.isTrue(f15 is F15<int>); 666 Expect.isTrue(f15 is F15<int>);
690 Expect.isFalse(f15 is F15<bool>); 667 Expect.isFalse(f15 is F15<bool>);
691 Expect.isTrue(confuse(f15) is F15<int>); 668 Expect.isTrue(confuse(f15) is F15<int>);
692 Expect.isFalse(confuse(f15) is F15<bool>); 669 Expect.isFalse(confuse(f15) is F15<bool>);
693 Expect.equals(tIsDynamic, m15 is F15<bool>); 670 Expect.equals(tIsDynamic, m15 is F15<bool>);
694 Expect.equals(tIsDynamic, confuse(m15) is F15<bool>); 671 Expect.equals(tIsDynamic, confuse(m15) is F15<bool>);
695 } else { 672 } else {
696 if (inCheckedMode) { 673 if (typeAssertionsEnabled) {
697 Expect.throws(() { 674 Expect.throws(() {
698 x15 = (f15 as dynamic); 675 x15 = (f15 as dynamic);
699 }); 676 });
700 Expect.throws(() { 677 Expect.throws(() {
701 x15 = confuse(f15); 678 x15 = confuse(f15);
702 }); 679 });
703 List<T> Function(core.List<core.int> x1) Function<B extends core.int>() 680 List<T> Function(core.List<core.int> x1) Function<B extends core.int>()
704 l15; 681 l15;
705 Expect.throws(() { 682 Expect.throws(() {
706 l15 = (f15 as dynamic); 683 l15 = (f15 as dynamic);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 Function(int x1, {List<Function> x}) Function<B extends core.int>() l17; 727 Function(int x1, {List<Function> x}) Function<B extends core.int>() l17;
751 // The static function f17 sets `T` to `int`. 728 // The static function f17 sets `T` to `int`.
752 if (!tIsBool) { 729 if (!tIsBool) {
753 x17 = f17 as dynamic; 730 x17 = f17 as dynamic;
754 l17 = f17 as dynamic; 731 l17 = f17 as dynamic;
755 x17 = confuse(f17); 732 x17 = confuse(f17);
756 l17 = confuse(f17); 733 l17 = confuse(f17);
757 } 734 }
758 735
759 Expect.isTrue(m17 is F17); 736 Expect.isTrue(m17 is F17);
760 Expect.isTrue(m17 is Function(int x1, 737 Expect.isTrue(m17 is Function(int x1, {List<Function> x})
761 {List<Function> x}) Function<B extends core.int>()); 738 Function<B extends core.int>());
762 Expect.isTrue(confuse(m17) is F17); 739 Expect.isTrue(confuse(m17) is F17);
763 // In checked mode, verifies the type. 740 // In checked mode, verifies the type.
764 x17 = m17; 741 x17 = m17;
765 l17 = m17; 742 l17 = m17;
766 x17 = confuse(m17); 743 x17 = confuse(m17);
767 l17 = confuse(m17); 744 l17 = confuse(m17);
768 } 745 }
769 746
770 /// void Function(int x) Function<B extends core.int>() 747 /// void Function(int x) Function<B extends core.int>()
771 void testF18() { 748 void testF18() {
(...skipping 27 matching lines...) Expand all
799 void Function(int y, [List<Function> x]) Function<B extends core.int>() l19; 776 void Function(int y, [List<Function> x]) Function<B extends core.int>() l19;
800 // The static function f19 sets `T` to `int`. 777 // The static function f19 sets `T` to `int`.
801 if (!tIsBool) { 778 if (!tIsBool) {
802 x19 = f19 as dynamic; 779 x19 = f19 as dynamic;
803 l19 = f19 as dynamic; 780 l19 = f19 as dynamic;
804 x19 = confuse(f19); 781 x19 = confuse(f19);
805 l19 = confuse(f19); 782 l19 = confuse(f19);
806 } 783 }
807 784
808 Expect.isTrue(m19 is F19); 785 Expect.isTrue(m19 is F19);
809 Expect.isTrue(m19 is void Function(int y, 786 Expect.isTrue(m19 is void Function(int y, [List<Function> x])
810 [List<Function> x]) Function<B extends core.int>()); 787 Function<B extends core.int>());
811 Expect.isTrue(confuse(m19) is F19); 788 Expect.isTrue(confuse(m19) is F19);
812 // In checked mode, verifies the type. 789 // In checked mode, verifies the type.
813 x19 = m19; 790 x19 = m19;
814 l19 = m19; 791 l19 = m19;
815 x19 = confuse(m19); 792 x19 = confuse(m19);
816 l19 = confuse(m19); 793 l19 = confuse(m19);
817 } 794 }
818 795
819 /// void Function(int x2, [List<T> x3]) Function<B extends core.int>() 796 /// void Function(int x2, [List<T> x3]) Function<B extends core.int>()
820 void testF20() { 797 void testF20() {
821 Expect.isTrue(f20 is F20); 798 Expect.isTrue(f20 is F20);
822 Expect.isTrue(confuse(f20) is F20); 799 Expect.isTrue(confuse(f20) is F20);
823 // In checked mode, verifies the type. 800 // In checked mode, verifies the type.
824 void Function(int x2, [List<T> x3]) Function<B extends core.int>() l20; 801 void Function(int x2, [List<T> x3]) Function<B extends core.int>() l20;
825 // The static function f20 sets `T` to `int`. 802 // The static function f20 sets `T` to `int`.
826 if (!tIsBool) { 803 if (!tIsBool) {
827 x20 = f20 as dynamic; 804 x20 = f20 as dynamic;
828 l20 = f20 as dynamic; 805 l20 = f20 as dynamic;
829 x20 = confuse(f20); 806 x20 = confuse(f20);
830 l20 = confuse(f20); 807 l20 = confuse(f20);
831 } 808 }
832 809
833 Expect.isTrue(m20 is F20); 810 Expect.isTrue(m20 is F20);
834 Expect.isTrue(m20 is void Function(int x2, 811 Expect.isTrue(m20 is void Function(int x2, [List<T> x3])
835 [List<T> x3]) Function<B extends core.int>()); 812 Function<B extends core.int>());
836 Expect.isTrue(confuse(m20) is F20); 813 Expect.isTrue(confuse(m20) is F20);
837 // In checked mode, verifies the type. 814 // In checked mode, verifies the type.
838 x20 = m20; 815 x20 = m20;
839 l20 = m20; 816 l20 = m20;
840 x20 = confuse(m20); 817 x20 = confuse(m20);
841 l20 = confuse(m20); 818 l20 = confuse(m20);
842 if (!tIsBool) { 819 if (!tIsBool) {
843 Expect.isTrue(f20 is F20<int>); 820 Expect.isTrue(f20 is F20<int>);
844 Expect.isFalse(f20 is F20<bool>); 821 Expect.isFalse(f20 is F20<bool>);
845 Expect.isTrue(confuse(f20) is F20<int>); 822 Expect.isTrue(confuse(f20) is F20<int>);
846 Expect.isFalse(confuse(f20) is F20<bool>); 823 Expect.isFalse(confuse(f20) is F20<bool>);
847 Expect.equals(tIsDynamic, m20 is F20<bool>); 824 Expect.equals(tIsDynamic, m20 is F20<bool>);
848 Expect.equals(tIsDynamic, confuse(m20) is F20<bool>); 825 Expect.equals(tIsDynamic, confuse(m20) is F20<bool>);
849 } else { 826 } else {
850 if (inCheckedMode) { 827 if (typeAssertionsEnabled) {
851 Expect.throws(() { 828 Expect.throws(() {
852 x20 = (f20 as dynamic); 829 x20 = (f20 as dynamic);
853 }); 830 });
854 Expect.throws(() { 831 Expect.throws(() {
855 x20 = confuse(f20); 832 x20 = confuse(f20);
856 }); 833 });
857 void Function(int x2, [List<T> x3]) Function<B extends core.int>() l20; 834 void Function(int x2, [List<T> x3]) Function<B extends core.int>() l20;
858 Expect.throws(() { 835 Expect.throws(() {
859 l20 = (f20 as dynamic); 836 l20 = (f20 as dynamic);
860 }); 837 });
861 Expect.throws(() { 838 Expect.throws(() {
862 l20 = confuse(f20); 839 l20 = confuse(f20);
863 }); 840 });
864 } 841 }
865 void Function(int x2, [List<T> x3]) Function<B extends core.int>() l20 = 842 void Function(int x2, [List<T> x3]) Function<B extends core.int>() l20 =
866 m20; 843 m20;
867 // In checked mode, verifies the type. 844 // In checked mode, verifies the type.
868 x20 = m20; 845 x20 = m20;
869 x20 = confuse(m20); 846 x20 = confuse(m20);
870 } 847 }
871 } 848 }
872 849
873 /// List<Function> Function<A>(core.List<core.int> x) Function<B extends core. int>() 850 /// List<Function> Function<A>(core.List<core.int> x) Function<B extends core. int>()
874 void testF21() { 851 void testF21() {
875 Expect.isTrue(f21 is F21); 852 Expect.isTrue(f21 is F21);
876 Expect.isTrue(confuse(f21) is F21); 853 Expect.isTrue(confuse(f21) is F21);
877 // In checked mode, verifies the type. 854 // In checked mode, verifies the type.
878 List<Function> Function<A>( 855 List<Function> Function<A>(core.List<core.int> x)
879 core.List<core.int> x) Function<B extends core.int>() l21; 856 Function<B extends core.int>() l21;
880 // The static function f21 sets `T` to `int`. 857 // The static function f21 sets `T` to `int`.
881 if (!tIsBool) { 858 if (!tIsBool) {
882 x21 = f21 as dynamic; 859 x21 = f21 as dynamic;
883 l21 = f21 as dynamic; 860 l21 = f21 as dynamic;
884 x21 = confuse(f21); 861 x21 = confuse(f21);
885 l21 = confuse(f21); 862 l21 = confuse(f21);
886 } 863 }
887 864
888 Expect.isTrue(m21 is F21); 865 Expect.isTrue(m21 is F21);
889 Expect.isTrue(m21 is List<Function> Function<A>( 866 Expect.isTrue(m21 is List<Function> Function<A>(core.List<core.int> x)
890 core.List<core.int> x) Function<B extends core.int>()); 867 Function<B extends core.int>());
891 Expect.isTrue(confuse(m21) is F21); 868 Expect.isTrue(confuse(m21) is F21);
892 // In checked mode, verifies the type. 869 // In checked mode, verifies the type.
893 x21 = m21; 870 x21 = m21;
894 l21 = m21; 871 l21 = m21;
895 x21 = confuse(m21); 872 x21 = confuse(m21);
896 l21 = confuse(m21); 873 l21 = confuse(m21);
897 } 874 }
898 875
899 /// Function<A>(List<T> x) Function<B extends core.int>() 876 /// Function<A>(List<T> x) Function<B extends core.int>()
900 void testF22() { 877 void testF22() {
(...skipping 18 matching lines...) Expand all
919 x22 = confuse(m22); 896 x22 = confuse(m22);
920 l22 = confuse(m22); 897 l22 = confuse(m22);
921 if (!tIsBool) { 898 if (!tIsBool) {
922 Expect.isTrue(f22 is F22<int>); 899 Expect.isTrue(f22 is F22<int>);
923 Expect.isFalse(f22 is F22<bool>); 900 Expect.isFalse(f22 is F22<bool>);
924 Expect.isTrue(confuse(f22) is F22<int>); 901 Expect.isTrue(confuse(f22) is F22<int>);
925 Expect.isFalse(confuse(f22) is F22<bool>); 902 Expect.isFalse(confuse(f22) is F22<bool>);
926 Expect.equals(tIsDynamic, m22 is F22<bool>); 903 Expect.equals(tIsDynamic, m22 is F22<bool>);
927 Expect.equals(tIsDynamic, confuse(m22) is F22<bool>); 904 Expect.equals(tIsDynamic, confuse(m22) is F22<bool>);
928 } else { 905 } else {
929 if (inCheckedMode) { 906 if (typeAssertionsEnabled) {
930 Expect.throws(() { 907 Expect.throws(() {
931 x22 = (f22 as dynamic); 908 x22 = (f22 as dynamic);
932 }); 909 });
933 Expect.throws(() { 910 Expect.throws(() {
934 x22 = confuse(f22); 911 x22 = confuse(f22);
935 }); 912 });
936 Function<A>(List<T> x) Function<B extends core.int>() l22; 913 Function<A>(List<T> x) Function<B extends core.int>() l22;
937 Expect.throws(() { 914 Expect.throws(() {
938 l22 = (f22 as dynamic); 915 l22 = (f22 as dynamic);
939 }); 916 });
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
971 x23 = confuse(m23); 948 x23 = confuse(m23);
972 l23 = confuse(m23); 949 l23 = confuse(m23);
973 } 950 }
974 } 951 }
975 952
976 void main() { 953 void main() {
977 new U10().runTests(); 954 new U10().runTests();
978 new U10<int>(tIsInt: true).runTests(); 955 new U10<int>(tIsInt: true).runTests();
979 new U10<bool>(tIsBool: true).runTests(); 956 new U10<bool>(tIsBool: true).runTests();
980 } 957 }
OLDNEW
« no previous file with comments | « tests/language/function_type/function_type0_test.dart ('k') | tests/language/function_type/function_type11_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698