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

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

Powered by Google App Engine
This is Rietveld 408576698