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

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

Powered by Google App Engine
This is Rietveld 408576698