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

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

Powered by Google App Engine
This is Rietveld 408576698