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

Side by Side Diff: tests/language/function_type/function_type70_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, [Function x]);
23 bool result = false; 23 typedef F1<T> = core.List<core.int> Function(int x0, [int x]);
24 assert(result = true); 24 typedef F2<T> = List<T> Function(int x0, [List<T> x]);
25 return result; 25 typedef F3<T> = void Function([core.List<core.int> x]);
26 })(); 26 typedef F4<T> = int Function([int x]) Function<B extends core.int>();
27 27 typedef F5<T> = int Function(List<Function> x1) Function<B extends core.int>();
28 typedef F0<T> 28 typedef F6<T> = int Function(int x, [List<T> x1])
29 = Function Function(int y, [Function x]); 29 Function<B extends core.int>();
30 typedef F1<T> 30 typedef F7<T> = Function Function(int x1, {Function x})
31 = core.List<core.int> Function(int x0, [int x]); 31 Function<B extends core.int>();
32 typedef F2<T> 32 typedef F8<T> = Function Function([List<T> x]) Function<B extends core.int>();
33 = List<T> Function(int x0, [List<T> x]); 33 typedef F9<T> = List<Function> Function(int y, [Function x])
34 typedef F3<T> 34 Function<B extends core.int>();
35 = void Function([core.List<core.int> x]); 35 typedef F10<T> = List<Function> Function(int x2, [core.List<core.int> x3])
36 typedef F4<T> 36 Function<B extends core.int>();
37 = int Function([int x]) Function<B extends core.int>(); 37 typedef F11<T> = core.List<core.int> Function({int x})
38 typedef F5<T> 38 Function<B extends core.int>();
39 = int Function(List<Function> x1) Function<B extends core.int>(); 39 typedef F12<T> = core.List<core.int> Function(core.List<core.int> x)
40 typedef F6<T> 40 Function<B extends core.int>();
41 = int Function(int x, [List<T> x1]) Function<B extends core.int>(); 41 typedef F13<T> = List<T> Function(int x1, [int x])
42 typedef F7<T> 42 Function<B extends core.int>();
43 = Function Function(int x1, {Function x}) Function<B extends core.int>(); 43 typedef F14<T> = List<T> Function([List<Function> x1])
44 typedef F8<T> 44 Function<B extends core.int>();
45 = Function Function([List<T> x]) Function<B extends core.int>(); 45 typedef F15<T> = List<T> Function({List<T> x}) Function<B extends core.int>();
46 typedef F9<T> 46 typedef F16<T> = Function(int y, {Function x}) Function<B extends core.int>();
47 = List<Function> Function(int y, 47 typedef F17<T> = Function(int x1, [List<T> x]) Function<B extends core.int>();
48 [Function x]) Function<B extends core.int>(); 48 typedef F18<T> = void Function(Function x1) Function<B extends core.int>();
49 typedef F10<T> 49 typedef F19<T> = void Function(int x, [core.List<core.int> x1])
50 = List<Function> Function(int x2, 50 Function<B extends core.int>();
51 [core.List<core.int> x3]) Function<B extends core.int>(); 51 typedef F20<T> = Function Function<A>(Function x)
52 typedef F11<T> 52 Function<B extends core.int>();
53 = core.List<core.int> Function({int x}) Function<B extends core.int>(); 53 typedef F21<T> = List<T> Function<A>(List<Function> x)
54 typedef F12<T> 54 Function<B extends core.int>();
55 = core.List<core.int> Function( 55 typedef F22<T> = List<A> Function<A>(core.List<core.int> x)
56 core.List<core.int> x) Function<B extends core.int>(); 56 Function<B extends core.int>();
57 typedef F13<T>
58 = List<T> Function(int x1, [int x]) Function<B extends core.int>();
59 typedef F14<T>
60 = List<T> Function([List<Function> x1]) Function<B extends core.int>();
61 typedef F15<T>
62 = List<T> Function({List<T> x}) Function<B extends core.int>();
63 typedef F16<T>
64 = Function(int y, {Function x}) Function<B extends core.int>();
65 typedef F17<T>
66 = Function(int x1, [List<T> x]) Function<B extends core.int>();
67 typedef F18<T>
68 = void Function(Function x1) Function<B extends core.int>();
69 typedef F19<T>
70 = void Function(int x,
71 [core.List<core.int> x1]) Function<B extends core.int>();
72 typedef F20<T>
73 = Function Function<A>(Function x) Function<B extends core.int>();
74 typedef F21<T>
75 = List<T> Function<A>(List<Function> x) Function<B extends core.int>();
76 typedef F22<T>
77 = List<A> Function<A>(core.List<core.int> x) Function<B extends core.int>();
78 57
79 Function f0(int y, [Function x]) => null; 58 Function f0(int y, [Function x]) => null;
80 core.List<core.int> f1(int x0, [int x]) => null; 59 core.List<core.int> f1(int x0, [int x]) => null;
81 List<int> f2(int x0, [List<int> x]) => null; 60 List<int> f2(int x0, [List<int> x]) => null;
82 void f3([core.List<core.int> x]) => null; 61 void f3([core.List<core.int> x]) => null;
83 int Function([int x]) f4<B extends core.int>() => null; 62 int Function([int x]) f4<B extends core.int>() => null;
84 int Function(List<Function> x0) f5<B extends core.int>() => null; 63 int Function(List<Function> x0) f5<B extends core.int>() => null;
85 int Function(int x, [List<int> x0]) f6<B extends core.int>() => null; 64 int Function(int x, [List<int> x0]) f6<B extends core.int>() => null;
86 Function Function(int x0, {Function x}) f7<B extends core.int>() => null; 65 Function Function(int x0, {Function x}) f7<B extends core.int>() => null;
87 Function Function([List<int> x]) f8<B extends core.int>() => null; 66 Function Function([List<int> x]) f8<B extends core.int>() => null;
(...skipping 24 matching lines...) Expand all
112 core.List<core.int> Function(int x0, [int x]) x1; 91 core.List<core.int> Function(int x0, [int x]) x1;
113 List<T> Function(int x0, [List<T> x]) x2; 92 List<T> Function(int x0, [List<T> x]) x2;
114 void Function([core.List<core.int> x]) x3; 93 void Function([core.List<core.int> x]) x3;
115 int Function([int x]) Function<B extends core.int>() x4; 94 int Function([int x]) Function<B extends core.int>() x4;
116 int Function(List<Function> x1) Function<B extends core.int>() x5; 95 int Function(List<Function> x1) Function<B extends core.int>() x5;
117 int Function(int x, [List<T> x1]) Function<B extends core.int>() x6; 96 int Function(int x, [List<T> x1]) Function<B extends core.int>() x6;
118 Function Function(int x1, {Function x}) Function<B extends core.int>() x7; 97 Function Function(int x1, {Function x}) Function<B extends core.int>() x7;
119 Function Function([List<T> x]) Function<B extends core.int>() x8; 98 Function Function([List<T> x]) Function<B extends core.int>() x8;
120 List<Function> Function(int y, [Function x]) Function<B extends core.int>() 99 List<Function> Function(int y, [Function x]) Function<B extends core.int>()
121 x9; 100 x9;
122 List<Function> Function(int x2, 101 List<Function> Function(int x2, [core.List<core.int> x3])
123 [core.List<core.int> x3]) Function<B extends core.int>() x10; 102 Function<B extends core.int>() x10;
124 core.List<core.int> Function({int x}) Function<B extends core.int>() x11; 103 core.List<core.int> Function({int x}) Function<B extends core.int>() x11;
125 core.List<core.int> Function( 104 core.List<core.int> Function(core.List<core.int> x)
126 core.List<core.int> x) Function<B extends core.int>() x12; 105 Function<B extends core.int>() x12;
127 List<T> Function(int x1, [int x]) Function<B extends core.int>() x13; 106 List<T> Function(int x1, [int x]) Function<B extends core.int>() x13;
128 List<T> Function([List<Function> x1]) Function<B extends core.int>() x14; 107 List<T> Function([List<Function> x1]) Function<B extends core.int>() x14;
129 List<T> Function({List<T> x}) Function<B extends core.int>() x15; 108 List<T> Function({List<T> x}) Function<B extends core.int>() x15;
130 Function(int y, {Function x}) Function<B extends core.int>() x16; 109 Function(int y, {Function x}) Function<B extends core.int>() x16;
131 Function(int x1, [List<T> x]) Function<B extends core.int>() x17; 110 Function(int x1, [List<T> x]) Function<B extends core.int>() x17;
132 void Function(Function x1) Function<B extends core.int>() x18; 111 void Function(Function x1) Function<B extends core.int>() x18;
133 void Function(int x, [core.List<core.int> x1]) Function<B extends core.int>() 112 void Function(int x, [core.List<core.int> x1]) Function<B extends core.int>()
134 x19; 113 x19;
135 Function Function<A>(Function x) Function<B extends core.int>() x20; 114 Function Function<A>(Function x) Function<B extends core.int>() x20;
136 List<T> Function<A>(List<Function> x) Function<B extends core.int>() x21; 115 List<T> Function<A>(List<Function> x) Function<B extends core.int>() x21;
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 x2 = confuse(m2); 242 x2 = confuse(m2);
264 l2 = confuse(m2); 243 l2 = confuse(m2);
265 if (!tIsBool) { 244 if (!tIsBool) {
266 Expect.isTrue(f2 is F2<int>); 245 Expect.isTrue(f2 is F2<int>);
267 Expect.isFalse(f2 is F2<bool>); 246 Expect.isFalse(f2 is F2<bool>);
268 Expect.isTrue(confuse(f2) is F2<int>); 247 Expect.isTrue(confuse(f2) is F2<int>);
269 Expect.isFalse(confuse(f2) is F2<bool>); 248 Expect.isFalse(confuse(f2) is F2<bool>);
270 Expect.equals(tIsDynamic, m2 is F2<bool>); 249 Expect.equals(tIsDynamic, m2 is F2<bool>);
271 Expect.equals(tIsDynamic, confuse(m2) is F2<bool>); 250 Expect.equals(tIsDynamic, confuse(m2) is F2<bool>);
272 } else { 251 } else {
273 if (inCheckedMode) { 252 if (typeAssertionsEnabled) {
274 Expect.throws(() { 253 Expect.throws(() {
275 x2 = (f2 as dynamic); 254 x2 = (f2 as dynamic);
276 }); 255 });
277 Expect.throws(() { 256 Expect.throws(() {
278 x2 = confuse(f2); 257 x2 = confuse(f2);
279 }); 258 });
280 List<T> Function(int x0, [List<T> x]) l2; 259 List<T> Function(int x0, [List<T> x]) l2;
281 Expect.throws(() { 260 Expect.throws(() {
282 l2 = (f2 as dynamic); 261 l2 = (f2 as dynamic);
283 }); 262 });
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 x6 = confuse(m6); 368 x6 = confuse(m6);
390 l6 = confuse(m6); 369 l6 = confuse(m6);
391 if (!tIsBool) { 370 if (!tIsBool) {
392 Expect.isTrue(f6 is F6<int>); 371 Expect.isTrue(f6 is F6<int>);
393 Expect.isFalse(f6 is F6<bool>); 372 Expect.isFalse(f6 is F6<bool>);
394 Expect.isTrue(confuse(f6) is F6<int>); 373 Expect.isTrue(confuse(f6) is F6<int>);
395 Expect.isFalse(confuse(f6) is F6<bool>); 374 Expect.isFalse(confuse(f6) is F6<bool>);
396 Expect.equals(tIsDynamic, m6 is F6<bool>); 375 Expect.equals(tIsDynamic, m6 is F6<bool>);
397 Expect.equals(tIsDynamic, confuse(m6) is F6<bool>); 376 Expect.equals(tIsDynamic, confuse(m6) is F6<bool>);
398 } else { 377 } else {
399 if (inCheckedMode) { 378 if (typeAssertionsEnabled) {
400 Expect.throws(() { 379 Expect.throws(() {
401 x6 = (f6 as dynamic); 380 x6 = (f6 as dynamic);
402 }); 381 });
403 Expect.throws(() { 382 Expect.throws(() {
404 x6 = confuse(f6); 383 x6 = confuse(f6);
405 }); 384 });
406 int Function(int x, [List<T> x1]) Function<B extends core.int>() l6; 385 int Function(int x, [List<T> x1]) Function<B extends core.int>() l6;
407 Expect.throws(() { 386 Expect.throws(() {
408 l6 = (f6 as dynamic); 387 l6 = (f6 as dynamic);
409 }); 388 });
(...skipping 16 matching lines...) Expand all
426 Function Function(int x1, {Function x}) Function<B extends core.int>() l7; 405 Function Function(int x1, {Function x}) Function<B extends core.int>() l7;
427 // The static function f7 sets `T` to `int`. 406 // The static function f7 sets `T` to `int`.
428 if (!tIsBool) { 407 if (!tIsBool) {
429 x7 = f7 as dynamic; 408 x7 = f7 as dynamic;
430 l7 = f7 as dynamic; 409 l7 = f7 as dynamic;
431 x7 = confuse(f7); 410 x7 = confuse(f7);
432 l7 = confuse(f7); 411 l7 = confuse(f7);
433 } 412 }
434 413
435 Expect.isTrue(m7 is F7); 414 Expect.isTrue(m7 is F7);
436 Expect.isTrue(m7 is Function Function(int x1, 415 Expect.isTrue(m7 is Function Function(int x1, {Function x})
437 {Function x}) Function<B extends core.int>()); 416 Function<B extends core.int>());
438 Expect.isTrue(confuse(m7) is F7); 417 Expect.isTrue(confuse(m7) is F7);
439 // In checked mode, verifies the type. 418 // In checked mode, verifies the type.
440 x7 = m7; 419 x7 = m7;
441 l7 = m7; 420 l7 = m7;
442 x7 = confuse(m7); 421 x7 = confuse(m7);
443 l7 = confuse(m7); 422 l7 = confuse(m7);
444 } 423 }
445 424
446 /// Function Function([List<T> x]) Function<B extends core.int>() 425 /// Function Function([List<T> x]) Function<B extends core.int>()
447 void testF8() { 426 void testF8() {
(...skipping 19 matching lines...) Expand all
467 x8 = confuse(m8); 446 x8 = confuse(m8);
468 l8 = confuse(m8); 447 l8 = confuse(m8);
469 if (!tIsBool) { 448 if (!tIsBool) {
470 Expect.isTrue(f8 is F8<int>); 449 Expect.isTrue(f8 is F8<int>);
471 Expect.isFalse(f8 is F8<bool>); 450 Expect.isFalse(f8 is F8<bool>);
472 Expect.isTrue(confuse(f8) is F8<int>); 451 Expect.isTrue(confuse(f8) is F8<int>);
473 Expect.isFalse(confuse(f8) is F8<bool>); 452 Expect.isFalse(confuse(f8) is F8<bool>);
474 Expect.equals(tIsDynamic, m8 is F8<bool>); 453 Expect.equals(tIsDynamic, m8 is F8<bool>);
475 Expect.equals(tIsDynamic, confuse(m8) is F8<bool>); 454 Expect.equals(tIsDynamic, confuse(m8) is F8<bool>);
476 } else { 455 } else {
477 if (inCheckedMode) { 456 if (typeAssertionsEnabled) {
478 Expect.throws(() { 457 Expect.throws(() {
479 x8 = (f8 as dynamic); 458 x8 = (f8 as dynamic);
480 }); 459 });
481 Expect.throws(() { 460 Expect.throws(() {
482 x8 = confuse(f8); 461 x8 = confuse(f8);
483 }); 462 });
484 Function Function([List<T> x]) Function<B extends core.int>() l8; 463 Function Function([List<T> x]) Function<B extends core.int>() l8;
485 Expect.throws(() { 464 Expect.throws(() {
486 l8 = (f8 as dynamic); 465 l8 = (f8 as dynamic);
487 }); 466 });
(...skipping 17 matching lines...) Expand all
505 l9; 484 l9;
506 // The static function f9 sets `T` to `int`. 485 // The static function f9 sets `T` to `int`.
507 if (!tIsBool) { 486 if (!tIsBool) {
508 x9 = f9 as dynamic; 487 x9 = f9 as dynamic;
509 l9 = f9 as dynamic; 488 l9 = f9 as dynamic;
510 x9 = confuse(f9); 489 x9 = confuse(f9);
511 l9 = confuse(f9); 490 l9 = confuse(f9);
512 } 491 }
513 492
514 Expect.isTrue(m9 is F9); 493 Expect.isTrue(m9 is F9);
515 Expect.isTrue(m9 is List<Function> Function(int y, 494 Expect.isTrue(m9 is List<Function> Function(int y, [Function x])
516 [Function x]) Function<B extends core.int>()); 495 Function<B extends core.int>());
517 Expect.isTrue(confuse(m9) is F9); 496 Expect.isTrue(confuse(m9) is F9);
518 // In checked mode, verifies the type. 497 // In checked mode, verifies the type.
519 x9 = m9; 498 x9 = m9;
520 l9 = m9; 499 l9 = m9;
521 x9 = confuse(m9); 500 x9 = confuse(m9);
522 l9 = confuse(m9); 501 l9 = confuse(m9);
523 } 502 }
524 503
525 /// List<Function> Function(int x2, [core.List<core.int> x3]) Function<B exten ds core.int>() 504 /// List<Function> Function(int x2, [core.List<core.int> x3]) Function<B exten ds core.int>()
526 void testF10() { 505 void testF10() {
527 Expect.isTrue(f10 is F10); 506 Expect.isTrue(f10 is F10);
528 Expect.isTrue(confuse(f10) is F10); 507 Expect.isTrue(confuse(f10) is F10);
529 // In checked mode, verifies the type. 508 // In checked mode, verifies the type.
530 List<Function> Function(int x2, 509 List<Function> Function(int x2, [core.List<core.int> x3])
531 [core.List<core.int> x3]) Function<B extends core.int>() l10; 510 Function<B extends core.int>() l10;
532 // The static function f10 sets `T` to `int`. 511 // The static function f10 sets `T` to `int`.
533 if (!tIsBool) { 512 if (!tIsBool) {
534 x10 = f10 as dynamic; 513 x10 = f10 as dynamic;
535 l10 = f10 as dynamic; 514 l10 = f10 as dynamic;
536 x10 = confuse(f10); 515 x10 = confuse(f10);
537 l10 = confuse(f10); 516 l10 = confuse(f10);
538 } 517 }
539 518
540 Expect.isTrue(m10 is F10); 519 Expect.isTrue(m10 is F10);
541 Expect.isTrue(m10 is List<Function> Function(int x2, 520 Expect.isTrue(m10 is List<Function> Function(int x2,
542 [core.List<core.int> x3]) Function<B extends core.int>()); 521 [core.List<core.int> x3])
522 Function<B extends core.int>());
543 Expect.isTrue(confuse(m10) is F10); 523 Expect.isTrue(confuse(m10) is F10);
544 // In checked mode, verifies the type. 524 // In checked mode, verifies the type.
545 x10 = m10; 525 x10 = m10;
546 l10 = m10; 526 l10 = m10;
547 x10 = confuse(m10); 527 x10 = confuse(m10);
548 l10 = confuse(m10); 528 l10 = confuse(m10);
549 } 529 }
550 530
551 /// core.List<core.int> Function({int x}) Function<B extends core.int>() 531 /// core.List<core.int> Function({int x}) Function<B extends core.int>()
552 void testF11() { 532 void testF11() {
553 Expect.isTrue(f11 is F11); 533 Expect.isTrue(f11 is F11);
554 Expect.isTrue(confuse(f11) is F11); 534 Expect.isTrue(confuse(f11) is F11);
555 // In checked mode, verifies the type. 535 // In checked mode, verifies the type.
556 core.List<core.int> Function({int x}) Function<B extends core.int>() l11; 536 core.List<core.int> Function({int x}) Function<B extends core.int>() l11;
557 // The static function f11 sets `T` to `int`. 537 // The static function f11 sets `T` to `int`.
558 if (!tIsBool) { 538 if (!tIsBool) {
559 x11 = f11 as dynamic; 539 x11 = f11 as dynamic;
560 l11 = f11 as dynamic; 540 l11 = f11 as dynamic;
561 x11 = confuse(f11); 541 x11 = confuse(f11);
562 l11 = confuse(f11); 542 l11 = confuse(f11);
563 } 543 }
564 544
565 Expect.isTrue(m11 is F11); 545 Expect.isTrue(m11 is F11);
566 Expect.isTrue(m11 is core.List<core.int> Function( 546 Expect.isTrue(m11 is core.List<core.int> Function({int x})
567 {int x}) Function<B extends core.int>()); 547 Function<B extends core.int>());
568 Expect.isTrue(confuse(m11) is F11); 548 Expect.isTrue(confuse(m11) is F11);
569 // In checked mode, verifies the type. 549 // In checked mode, verifies the type.
570 x11 = m11; 550 x11 = m11;
571 l11 = m11; 551 l11 = m11;
572 x11 = confuse(m11); 552 x11 = confuse(m11);
573 l11 = confuse(m11); 553 l11 = confuse(m11);
574 } 554 }
575 555
576 /// core.List<core.int> Function(core.List<core.int> x) Function<B extends cor e.int>() 556 /// core.List<core.int> Function(core.List<core.int> x) Function<B extends cor e.int>()
577 void testF12() { 557 void testF12() {
578 Expect.isTrue(f12 is F12); 558 Expect.isTrue(f12 is F12);
579 Expect.isTrue(confuse(f12) is F12); 559 Expect.isTrue(confuse(f12) is F12);
580 // In checked mode, verifies the type. 560 // In checked mode, verifies the type.
581 core.List<core.int> Function( 561 core.List<core.int> Function(core.List<core.int> x)
582 core.List<core.int> x) Function<B extends core.int>() l12; 562 Function<B extends core.int>() l12;
583 // The static function f12 sets `T` to `int`. 563 // The static function f12 sets `T` to `int`.
584 if (!tIsBool) { 564 if (!tIsBool) {
585 x12 = f12 as dynamic; 565 x12 = f12 as dynamic;
586 l12 = f12 as dynamic; 566 l12 = f12 as dynamic;
587 x12 = confuse(f12); 567 x12 = confuse(f12);
588 l12 = confuse(f12); 568 l12 = confuse(f12);
589 } 569 }
590 570
591 Expect.isTrue(m12 is F12); 571 Expect.isTrue(m12 is F12);
592 Expect.isTrue(m12 is core.List<core.int> Function( 572 Expect.isTrue(m12 is core.List<core.int> Function(core.List<core.int> x)
593 core.List<core.int> x) Function<B extends core.int>()); 573 Function<B extends core.int>());
594 Expect.isTrue(confuse(m12) is F12); 574 Expect.isTrue(confuse(m12) is F12);
595 // In checked mode, verifies the type. 575 // In checked mode, verifies the type.
596 x12 = m12; 576 x12 = m12;
597 l12 = m12; 577 l12 = m12;
598 x12 = confuse(m12); 578 x12 = confuse(m12);
599 l12 = confuse(m12); 579 l12 = confuse(m12);
600 } 580 }
601 581
602 /// List<T> Function(int x1, [int x]) Function<B extends core.int>() 582 /// List<T> Function(int x1, [int x]) Function<B extends core.int>()
603 void testF13() { 583 void testF13() {
604 Expect.isTrue(f13 is F13); 584 Expect.isTrue(f13 is F13);
605 Expect.isTrue(confuse(f13) is F13); 585 Expect.isTrue(confuse(f13) is F13);
606 // In checked mode, verifies the type. 586 // In checked mode, verifies the type.
607 List<T> Function(int x1, [int x]) Function<B extends core.int>() l13; 587 List<T> Function(int x1, [int x]) Function<B extends core.int>() l13;
608 // The static function f13 sets `T` to `int`. 588 // The static function f13 sets `T` to `int`.
609 if (!tIsBool) { 589 if (!tIsBool) {
610 x13 = f13 as dynamic; 590 x13 = f13 as dynamic;
611 l13 = f13 as dynamic; 591 l13 = f13 as dynamic;
612 x13 = confuse(f13); 592 x13 = confuse(f13);
613 l13 = confuse(f13); 593 l13 = confuse(f13);
614 } 594 }
615 595
616 Expect.isTrue(m13 is F13); 596 Expect.isTrue(m13 is F13);
617 Expect.isTrue(m13 is List<T> Function(int x1, 597 Expect.isTrue(m13 is List<T> Function(int x1, [int x])
618 [int x]) Function<B extends core.int>()); 598 Function<B extends core.int>());
619 Expect.isTrue(confuse(m13) is F13); 599 Expect.isTrue(confuse(m13) is F13);
620 // In checked mode, verifies the type. 600 // In checked mode, verifies the type.
621 x13 = m13; 601 x13 = m13;
622 l13 = m13; 602 l13 = m13;
623 x13 = confuse(m13); 603 x13 = confuse(m13);
624 l13 = confuse(m13); 604 l13 = confuse(m13);
625 if (!tIsBool) { 605 if (!tIsBool) {
626 Expect.isTrue(f13 is F13<int>); 606 Expect.isTrue(f13 is F13<int>);
627 Expect.isFalse(f13 is F13<bool>); 607 Expect.isFalse(f13 is F13<bool>);
628 Expect.isTrue(confuse(f13) is F13<int>); 608 Expect.isTrue(confuse(f13) is F13<int>);
629 Expect.isFalse(confuse(f13) is F13<bool>); 609 Expect.isFalse(confuse(f13) is F13<bool>);
630 Expect.equals(tIsDynamic, m13 is F13<bool>); 610 Expect.equals(tIsDynamic, m13 is F13<bool>);
631 Expect.equals(tIsDynamic, confuse(m13) is F13<bool>); 611 Expect.equals(tIsDynamic, confuse(m13) is F13<bool>);
632 } else { 612 } else {
633 if (inCheckedMode) { 613 if (typeAssertionsEnabled) {
634 Expect.throws(() { 614 Expect.throws(() {
635 x13 = (f13 as dynamic); 615 x13 = (f13 as dynamic);
636 }); 616 });
637 Expect.throws(() { 617 Expect.throws(() {
638 x13 = confuse(f13); 618 x13 = confuse(f13);
639 }); 619 });
640 List<T> Function(int x1, [int x]) Function<B extends core.int>() l13; 620 List<T> Function(int x1, [int x]) Function<B extends core.int>() l13;
641 Expect.throws(() { 621 Expect.throws(() {
642 l13 = (f13 as dynamic); 622 l13 = (f13 as dynamic);
643 }); 623 });
(...skipping 17 matching lines...) Expand all
661 List<T> Function([List<Function> x1]) Function<B extends core.int>() l14; 641 List<T> Function([List<Function> x1]) Function<B extends core.int>() l14;
662 // The static function f14 sets `T` to `int`. 642 // The static function f14 sets `T` to `int`.
663 if (!tIsBool) { 643 if (!tIsBool) {
664 x14 = f14 as dynamic; 644 x14 = f14 as dynamic;
665 l14 = f14 as dynamic; 645 l14 = f14 as dynamic;
666 x14 = confuse(f14); 646 x14 = confuse(f14);
667 l14 = confuse(f14); 647 l14 = confuse(f14);
668 } 648 }
669 649
670 Expect.isTrue(m14 is F14); 650 Expect.isTrue(m14 is F14);
671 Expect.isTrue(m14 is List<T> Function( 651 Expect.isTrue(m14 is List<T> Function([List<Function> x1])
672 [List<Function> x1]) Function<B extends core.int>()); 652 Function<B extends core.int>());
673 Expect.isTrue(confuse(m14) is F14); 653 Expect.isTrue(confuse(m14) is F14);
674 // In checked mode, verifies the type. 654 // In checked mode, verifies the type.
675 x14 = m14; 655 x14 = m14;
676 l14 = m14; 656 l14 = m14;
677 x14 = confuse(m14); 657 x14 = confuse(m14);
678 l14 = confuse(m14); 658 l14 = confuse(m14);
679 if (!tIsBool) { 659 if (!tIsBool) {
680 Expect.isTrue(f14 is F14<int>); 660 Expect.isTrue(f14 is F14<int>);
681 Expect.isFalse(f14 is F14<bool>); 661 Expect.isFalse(f14 is F14<bool>);
682 Expect.isTrue(confuse(f14) is F14<int>); 662 Expect.isTrue(confuse(f14) is F14<int>);
683 Expect.isFalse(confuse(f14) is F14<bool>); 663 Expect.isFalse(confuse(f14) is F14<bool>);
684 Expect.equals(tIsDynamic, m14 is F14<bool>); 664 Expect.equals(tIsDynamic, m14 is F14<bool>);
685 Expect.equals(tIsDynamic, confuse(m14) is F14<bool>); 665 Expect.equals(tIsDynamic, confuse(m14) is F14<bool>);
686 } else { 666 } else {
687 if (inCheckedMode) { 667 if (typeAssertionsEnabled) {
688 Expect.throws(() { 668 Expect.throws(() {
689 x14 = (f14 as dynamic); 669 x14 = (f14 as dynamic);
690 }); 670 });
691 Expect.throws(() { 671 Expect.throws(() {
692 x14 = confuse(f14); 672 x14 = confuse(f14);
693 }); 673 });
694 List<T> Function([List<Function> x1]) Function<B extends core.int>() 674 List<T> Function([List<Function> x1]) Function<B extends core.int>()
695 l14; 675 l14;
696 Expect.throws(() { 676 Expect.throws(() {
697 l14 = (f14 as dynamic); 677 l14 = (f14 as dynamic);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 x15 = confuse(m15); 712 x15 = confuse(m15);
733 l15 = confuse(m15); 713 l15 = confuse(m15);
734 if (!tIsBool) { 714 if (!tIsBool) {
735 Expect.isTrue(f15 is F15<int>); 715 Expect.isTrue(f15 is F15<int>);
736 Expect.isFalse(f15 is F15<bool>); 716 Expect.isFalse(f15 is F15<bool>);
737 Expect.isTrue(confuse(f15) is F15<int>); 717 Expect.isTrue(confuse(f15) is F15<int>);
738 Expect.isFalse(confuse(f15) is F15<bool>); 718 Expect.isFalse(confuse(f15) is F15<bool>);
739 Expect.equals(tIsDynamic, m15 is F15<bool>); 719 Expect.equals(tIsDynamic, m15 is F15<bool>);
740 Expect.equals(tIsDynamic, confuse(m15) is F15<bool>); 720 Expect.equals(tIsDynamic, confuse(m15) is F15<bool>);
741 } else { 721 } else {
742 if (inCheckedMode) { 722 if (typeAssertionsEnabled) {
743 Expect.throws(() { 723 Expect.throws(() {
744 x15 = (f15 as dynamic); 724 x15 = (f15 as dynamic);
745 }); 725 });
746 Expect.throws(() { 726 Expect.throws(() {
747 x15 = confuse(f15); 727 x15 = confuse(f15);
748 }); 728 });
749 List<T> Function({List<T> x}) Function<B extends core.int>() l15; 729 List<T> Function({List<T> x}) Function<B extends core.int>() l15;
750 Expect.throws(() { 730 Expect.throws(() {
751 l15 = (f15 as dynamic); 731 l15 = (f15 as dynamic);
752 }); 732 });
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 x17 = confuse(m17); 790 x17 = confuse(m17);
811 l17 = confuse(m17); 791 l17 = confuse(m17);
812 if (!tIsBool) { 792 if (!tIsBool) {
813 Expect.isTrue(f17 is F17<int>); 793 Expect.isTrue(f17 is F17<int>);
814 Expect.isFalse(f17 is F17<bool>); 794 Expect.isFalse(f17 is F17<bool>);
815 Expect.isTrue(confuse(f17) is F17<int>); 795 Expect.isTrue(confuse(f17) is F17<int>);
816 Expect.isFalse(confuse(f17) is F17<bool>); 796 Expect.isFalse(confuse(f17) is F17<bool>);
817 Expect.equals(tIsDynamic, m17 is F17<bool>); 797 Expect.equals(tIsDynamic, m17 is F17<bool>);
818 Expect.equals(tIsDynamic, confuse(m17) is F17<bool>); 798 Expect.equals(tIsDynamic, confuse(m17) is F17<bool>);
819 } else { 799 } else {
820 if (inCheckedMode) { 800 if (typeAssertionsEnabled) {
821 Expect.throws(() { 801 Expect.throws(() {
822 x17 = (f17 as dynamic); 802 x17 = (f17 as dynamic);
823 }); 803 });
824 Expect.throws(() { 804 Expect.throws(() {
825 x17 = confuse(f17); 805 x17 = confuse(f17);
826 }); 806 });
827 Function(int x1, [List<T> x]) Function<B extends core.int>() l17; 807 Function(int x1, [List<T> x]) Function<B extends core.int>() l17;
828 Expect.throws(() { 808 Expect.throws(() {
829 l17 = (f17 as dynamic); 809 l17 = (f17 as dynamic);
830 }); 810 });
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 l18 = m18; 842 l18 = m18;
863 x18 = confuse(m18); 843 x18 = confuse(m18);
864 l18 = confuse(m18); 844 l18 = confuse(m18);
865 } 845 }
866 846
867 /// void Function(int x, [core.List<core.int> x1]) Function<B extends core.int >() 847 /// void Function(int x, [core.List<core.int> x1]) Function<B extends core.int >()
868 void testF19() { 848 void testF19() {
869 Expect.isTrue(f19 is F19); 849 Expect.isTrue(f19 is F19);
870 Expect.isTrue(confuse(f19) is F19); 850 Expect.isTrue(confuse(f19) is F19);
871 // In checked mode, verifies the type. 851 // In checked mode, verifies the type.
872 void Function(int x, 852 void Function(int x, [core.List<core.int> x1])
873 [core.List<core.int> x1]) Function<B extends core.int>() l19; 853 Function<B extends core.int>() l19;
874 // The static function f19 sets `T` to `int`. 854 // The static function f19 sets `T` to `int`.
875 if (!tIsBool) { 855 if (!tIsBool) {
876 x19 = f19 as dynamic; 856 x19 = f19 as dynamic;
877 l19 = f19 as dynamic; 857 l19 = f19 as dynamic;
878 x19 = confuse(f19); 858 x19 = confuse(f19);
879 l19 = confuse(f19); 859 l19 = confuse(f19);
880 } 860 }
881 861
882 Expect.isTrue(m19 is F19); 862 Expect.isTrue(m19 is F19);
883 Expect.isTrue(m19 is void Function(int x, 863 Expect.isTrue(m19 is void Function(int x, [core.List<core.int> x1])
884 [core.List<core.int> x1]) Function<B extends core.int>()); 864 Function<B extends core.int>());
885 Expect.isTrue(confuse(m19) is F19); 865 Expect.isTrue(confuse(m19) is F19);
886 // In checked mode, verifies the type. 866 // In checked mode, verifies the type.
887 x19 = m19; 867 x19 = m19;
888 l19 = m19; 868 l19 = m19;
889 x19 = confuse(m19); 869 x19 = confuse(m19);
890 l19 = confuse(m19); 870 l19 = confuse(m19);
891 } 871 }
892 872
893 /// Function Function<A>(Function x) Function<B extends core.int>() 873 /// Function Function<A>(Function x) Function<B extends core.int>()
894 void testF20() { 874 void testF20() {
(...skipping 28 matching lines...) Expand all
923 List<T> Function<A>(List<Function> x) Function<B extends core.int>() l21; 903 List<T> Function<A>(List<Function> x) Function<B extends core.int>() l21;
924 // The static function f21 sets `T` to `int`. 904 // The static function f21 sets `T` to `int`.
925 if (!tIsBool) { 905 if (!tIsBool) {
926 x21 = f21 as dynamic; 906 x21 = f21 as dynamic;
927 l21 = f21 as dynamic; 907 l21 = f21 as dynamic;
928 x21 = confuse(f21); 908 x21 = confuse(f21);
929 l21 = confuse(f21); 909 l21 = confuse(f21);
930 } 910 }
931 911
932 Expect.isTrue(m21 is F21); 912 Expect.isTrue(m21 is F21);
933 Expect.isTrue(m21 is List<T> Function<A>( 913 Expect.isTrue(m21 is List<T> Function<A>(List<Function> x)
934 List<Function> x) Function<B extends core.int>()); 914 Function<B extends core.int>());
935 Expect.isTrue(confuse(m21) is F21); 915 Expect.isTrue(confuse(m21) is F21);
936 // In checked mode, verifies the type. 916 // In checked mode, verifies the type.
937 x21 = m21; 917 x21 = m21;
938 l21 = m21; 918 l21 = m21;
939 x21 = confuse(m21); 919 x21 = confuse(m21);
940 l21 = confuse(m21); 920 l21 = confuse(m21);
941 if (!tIsBool) { 921 if (!tIsBool) {
942 Expect.isTrue(f21 is F21<int>); 922 Expect.isTrue(f21 is F21<int>);
943 Expect.isFalse(f21 is F21<bool>); 923 Expect.isFalse(f21 is F21<bool>);
944 Expect.isTrue(confuse(f21) is F21<int>); 924 Expect.isTrue(confuse(f21) is F21<int>);
945 Expect.isFalse(confuse(f21) is F21<bool>); 925 Expect.isFalse(confuse(f21) is F21<bool>);
946 Expect.equals(tIsDynamic, m21 is F21<bool>); 926 Expect.equals(tIsDynamic, m21 is F21<bool>);
947 Expect.equals(tIsDynamic, confuse(m21) is F21<bool>); 927 Expect.equals(tIsDynamic, confuse(m21) is F21<bool>);
948 } else { 928 } else {
949 if (inCheckedMode) { 929 if (typeAssertionsEnabled) {
950 Expect.throws(() { 930 Expect.throws(() {
951 x21 = (f21 as dynamic); 931 x21 = (f21 as dynamic);
952 }); 932 });
953 Expect.throws(() { 933 Expect.throws(() {
954 x21 = confuse(f21); 934 x21 = confuse(f21);
955 }); 935 });
956 List<T> Function<A>(List<Function> x) Function<B extends core.int>() 936 List<T> Function<A>(List<Function> x) Function<B extends core.int>()
957 l21; 937 l21;
958 Expect.throws(() { 938 Expect.throws(() {
959 l21 = (f21 as dynamic); 939 l21 = (f21 as dynamic);
(...skipping 19 matching lines...) Expand all
979 l22; 959 l22;
980 // The static function f22 sets `T` to `int`. 960 // The static function f22 sets `T` to `int`.
981 if (!tIsBool) { 961 if (!tIsBool) {
982 x22 = f22 as dynamic; 962 x22 = f22 as dynamic;
983 l22 = f22 as dynamic; 963 l22 = f22 as dynamic;
984 x22 = confuse(f22); 964 x22 = confuse(f22);
985 l22 = confuse(f22); 965 l22 = confuse(f22);
986 } 966 }
987 967
988 Expect.isTrue(m22 is F22); 968 Expect.isTrue(m22 is F22);
989 Expect.isTrue(m22 is List<A> Function<A>( 969 Expect.isTrue(m22 is List<A> Function<A>(core.List<core.int> x)
990 core.List<core.int> x) Function<B extends core.int>()); 970 Function<B extends core.int>());
991 Expect.isTrue(confuse(m22) is F22); 971 Expect.isTrue(confuse(m22) is F22);
992 // In checked mode, verifies the type. 972 // In checked mode, verifies the type.
993 x22 = m22; 973 x22 = m22;
994 l22 = m22; 974 l22 = m22;
995 x22 = confuse(m22); 975 x22 = confuse(m22);
996 l22 = confuse(m22); 976 l22 = confuse(m22);
997 } 977 }
998 } 978 }
999 979
1000 void main() { 980 void main() {
1001 new U70().runTests(); 981 new U70().runTests();
1002 new U70<int>(tIsInt: true).runTests(); 982 new U70<int>(tIsInt: true).runTests();
1003 new U70<bool>(tIsBool: true).runTests(); 983 new U70<bool>(tIsBool: true).runTests();
1004 } 984 }
OLDNEW
« no previous file with comments | « tests/language/function_type/function_type6_test.dart ('k') | tests/language/function_type/function_type71_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698