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

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

Powered by Google App Engine
This is Rietveld 408576698