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

Side by Side Diff: tests/language/function_type/function_type95_test.dart

Issue 2879153005: Add support to dart2js for option --enable-asserts. (Closed)
Patch Set: Added !$checked to section predicate in co19 status file Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // GENERATED - DON'T EDIT. 5 // GENERATED - DON'T EDIT.
6 // GENERATED - DON'T EDIT. 6 // GENERATED - DON'T EDIT.
7 // GENERATED - DON'T EDIT. 7 // GENERATED - DON'T EDIT.
8 // GENERATED - DON'T EDIT. 8 // GENERATED - DON'T EDIT.
9 // GENERATED - DON'T EDIT. 9 // GENERATED - DON'T EDIT.
10 // GENERATED - DON'T EDIT. 10 // GENERATED - DON'T EDIT.
11 // GENERATED - DON'T EDIT. 11 // GENERATED - DON'T EDIT.
12 // GENERATED - DON'T EDIT. 12 // GENERATED - DON'T EDIT.
13 13
14 import 'dart:core'; 14 import 'dart:core';
15 import 'dart:core' as core; 15 import 'dart:core' as core;
16 import 'package:expect/expect.dart'; 16 import 'package:expect/expect.dart';
17 17
18 @NoInline() 18 @NoInline()
19 @AssumeDynamic() 19 @AssumeDynamic()
20 confuse(f) => f; 20 confuse(f) => f;
21 21
22 final bool inCheckedMode = (() { 22 typedef F0<T> = Function Function(int x1, [core.List<core.int> x2]);
23 bool result = false; 23 typedef F1<T> = core.List<core.int> Function([List<Function> x1]);
24 assert(result = true); 24 typedef F2<T> = Function(Function x0);
25 return result; 25 typedef F3<T> = int Function<A>(core.List<core.int> x);
26 })(); 26 typedef F4<T> = int Function(int x, [int x1]) Function<B extends core.int>(
27 27 int x);
28 typedef F0<T> 28 typedef F5<T> = int Function(int y, {List<Function> x})
29 = Function Function(int x1, [core.List<core.int> x2]); 29 Function<B extends core.int>(int x);
30 typedef F1<T> 30 typedef F6<T> = Function Function([int x]) Function<B extends core.int>(int x);
31 = core.List<core.int> Function([List<Function> x1]); 31 typedef F7<T> = Function Function(List<Function> x1)
32 typedef F2<T> 32 Function<B extends core.int>(int x);
33 = Function(Function x0); 33 typedef F8<T> = Function Function(int x, [List<T> x1])
34 typedef F3<T> 34 Function<B extends core.int>(int x);
35 = int Function<A>(core.List<core.int> 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, [int x1]) Function<B extends core.int>(int x); 37 typedef F10<T> = List<Function> Function([List<T> x])
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 y, [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 x2, [core.List<core.int> x3])
42 = Function Function([int 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 x}) Function<B extends core.int>(int x);
44 = Function Function(List<Function> x1) Function<B extends core.int>(int x); 44 typedef F14<T> = List<T> Function(core.List<core.int> x)
45 typedef F8<T> 45 Function<B extends core.int>(int x);
46 = Function Function(int x, [List<T> x1]) Function<B extends core.int>( 46 typedef F15<T> = Function(int x1, [int x]) Function<B extends core.int>(int x);
47 int x); 47 typedef F16<T> = Function([List<Function> x1]) Function<B extends core.int>(
48 typedef F9<T> 48 int x);
49 = List<Function> Function(int x1, 49 typedef F17<T> = Function({List<T> x}) Function<B extends core.int>(int x);
50 {Function x}) Function<B extends core.int>(int x); 50 typedef F18<T> = void Function(int y, {Function x})
51 typedef F10<T> 51 Function<B extends core.int>(int x);
52 = List<Function> Function([List<T> x]) Function<B extends core.int>(int x); 52 typedef F19<T> = void Function(int x1, [List<T> x])
53 typedef F11<T> 53 Function<B extends core.int>(int x);
54 = core.List<core.int> Function(int y, 54 typedef F20<T> = Function Function<A>(List<A> x) Function<B extends core.int>(
55 [Function x]) Function<B extends core.int>(int x); 55 int x);
56 typedef F12<T> 56 typedef F21<T> = Function<A>(int x) Function<B extends core.int>(int x);
57 = core.List<core.int> Function(int x2, 57 typedef F22<T> = void Function<A>(Function x) Function<B extends core.int>(
58 [core.List<core.int> x3]) Function<B extends core.int>(int x); 58 int x);
59 typedef F13<T>
60 = List<T> Function({int x}) Function<B extends core.int>(int x);
61 typedef F14<T>
62 = List<T> Function(core.List<core.int> x) Function<B extends core.int>(
63 int x);
64 typedef F15<T>
65 = Function(int x1, [int x]) Function<B extends core.int>(int x);
66 typedef F16<T>
67 = Function([List<Function> x1]) Function<B extends core.int>(int x);
68 typedef F17<T>
69 = Function({List<T> x}) Function<B extends core.int>(int x);
70 typedef F18<T>
71 = void Function(int y, {Function x}) Function<B extends core.int>(int x);
72 typedef F19<T>
73 = void Function(int x1, [List<T> x]) Function<B extends core.int>(int x);
74 typedef F20<T>
75 = Function Function<A>(List<A> x) Function<B extends core.int>(int x);
76 typedef F21<T>
77 = Function<A>(int x) Function<B extends core.int>(int x);
78 typedef F22<T>
79 = void Function<A>(Function x) Function<B extends core.int>(int x);
80 59
81 Function f0(int x0, [core.List<core.int> x1]) => null; 60 Function f0(int x0, [core.List<core.int> x1]) => null;
82 core.List<core.int> f1([List<Function> x0]) => null; 61 core.List<core.int> f1([List<Function> x0]) => null;
83 f2(Function x0) => null; 62 f2(Function x0) => null;
84 int f3<A>(core.List<core.int> x) => null; 63 int f3<A>(core.List<core.int> x) => null;
85 int Function(int x, [int x0]) f4<B extends core.int>(int x) => null; 64 int Function(int x, [int x0]) f4<B extends core.int>(int x) => null;
86 int Function(int y, {List<Function> x}) f5<B extends core.int>(int x) => null; 65 int Function(int y, {List<Function> x}) f5<B extends core.int>(int x) => null;
87 Function Function([int x]) f6<B extends core.int>(int x) => null; 66 Function Function([int x]) f6<B extends core.int>(int x) => null;
88 Function Function(List<Function> x0) f7<B extends core.int>(int x) => null; 67 Function Function(List<Function> x0) f7<B extends core.int>(int x) => null;
89 Function Function(int x, [List<int> x0]) f8<B extends core.int>(int x) => null; 68 Function Function(int x, [List<int> x0]) f8<B extends core.int>(int x) => null;
(...skipping 28 matching lines...) Expand all
118 int Function<A>(core.List<core.int> x) x3; 97 int Function<A>(core.List<core.int> x) x3;
119 int Function(int x, [int x1]) Function<B extends core.int>(int x) x4; 98 int Function(int x, [int x1]) Function<B extends core.int>(int x) x4;
120 int Function(int y, {List<Function> x}) Function<B extends core.int>(int x) 99 int Function(int y, {List<Function> x}) Function<B extends core.int>(int x)
121 x5; 100 x5;
122 Function Function([int x]) Function<B extends core.int>(int x) x6; 101 Function Function([int x]) Function<B extends core.int>(int x) x6;
123 Function Function(List<Function> x1) Function<B extends core.int>(int x) x7; 102 Function Function(List<Function> x1) Function<B extends core.int>(int x) x7;
124 Function Function(int x, [List<T> x1]) Function<B extends core.int>(int x) x8; 103 Function Function(int x, [List<T> x1]) Function<B extends core.int>(int x) x8;
125 List<Function> Function(int x1, {Function x}) Function<B extends core.int>( 104 List<Function> Function(int x1, {Function x}) Function<B extends core.int>(
126 int x) x9; 105 int x) x9;
127 List<Function> Function([List<T> x]) Function<B extends core.int>(int x) x10; 106 List<Function> Function([List<T> x]) Function<B extends core.int>(int x) x10;
128 core.List<core.int> Function(int y, 107 core.List<core.int> Function(int y, [Function x])
129 [Function x]) Function<B extends core.int>(int x) x11; 108 Function<B extends core.int>(int x) x11;
130 core.List<core.int> Function(int x2, 109 core.List<core.int> Function(int x2, [core.List<core.int> x3])
131 [core.List<core.int> x3]) Function<B extends core.int>(int x) x12; 110 Function<B extends core.int>(int x) x12;
132 List<T> Function({int x}) Function<B extends core.int>(int x) x13; 111 List<T> Function({int x}) Function<B extends core.int>(int x) x13;
133 List<T> Function(core.List<core.int> x) Function<B extends core.int>(int x) 112 List<T> Function(core.List<core.int> x) Function<B extends core.int>(int x)
134 x14; 113 x14;
135 Function(int x1, [int x]) Function<B extends core.int>(int x) x15; 114 Function(int x1, [int x]) Function<B extends core.int>(int x) x15;
136 Function([List<Function> x1]) Function<B extends core.int>(int x) x16; 115 Function([List<Function> x1]) Function<B extends core.int>(int x) x16;
137 Function({List<T> x}) Function<B extends core.int>(int x) x17; 116 Function({List<T> x}) Function<B extends core.int>(int x) x17;
138 void Function(int y, {Function x}) Function<B extends core.int>(int x) x18; 117 void Function(int y, {Function x}) Function<B extends core.int>(int x) x18;
139 void Function(int x1, [List<T> x]) Function<B extends core.int>(int x) x19; 118 void Function(int x1, [List<T> x]) Function<B extends core.int>(int x) x19;
140 Function Function<A>(List<A> x) Function<B extends core.int>(int x) x20; 119 Function Function<A>(List<A> x) Function<B extends core.int>(int x) x20;
141 Function<A>(int x) Function<B extends core.int>(int x) x21; 120 Function<A>(int x) Function<B extends core.int>(int x) x21;
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 int Function(int x, [int x1]) Function<B extends core.int>(int x) l4; 282 int Function(int x, [int x1]) Function<B extends core.int>(int x) l4;
304 // The static function f4 sets `T` to `int`. 283 // The static function f4 sets `T` to `int`.
305 if (!tIsBool) { 284 if (!tIsBool) {
306 x4 = f4 as dynamic; 285 x4 = f4 as dynamic;
307 l4 = f4 as dynamic; 286 l4 = f4 as dynamic;
308 x4 = confuse(f4); 287 x4 = confuse(f4);
309 l4 = confuse(f4); 288 l4 = confuse(f4);
310 } 289 }
311 290
312 Expect.isTrue(m4 is F4); 291 Expect.isTrue(m4 is F4);
313 Expect.isTrue(m4 is int Function(int x, 292 Expect.isTrue(m4 is int Function(int x, [int x1])
314 [int x1]) Function<B extends core.int>(int x)); 293 Function<B extends core.int>(int x));
315 Expect.isTrue(confuse(m4) is F4); 294 Expect.isTrue(confuse(m4) is F4);
316 // In checked mode, verifies the type. 295 // In checked mode, verifies the type.
317 x4 = m4; 296 x4 = m4;
318 l4 = m4; 297 l4 = m4;
319 x4 = confuse(m4); 298 x4 = confuse(m4);
320 l4 = confuse(m4); 299 l4 = confuse(m4);
321 } 300 }
322 301
323 /// int Function(int y, {List<Function> x}) Function<B extends core.int>(int x ) 302 /// int Function(int y, {List<Function> x}) Function<B extends core.int>(int x )
324 void testF5() { 303 void testF5() {
325 Expect.isTrue(f5 is F5); 304 Expect.isTrue(f5 is F5);
326 Expect.isTrue(confuse(f5) is F5); 305 Expect.isTrue(confuse(f5) is F5);
327 // In checked mode, verifies the type. 306 // In checked mode, verifies the type.
328 int Function(int y, {List<Function> x}) Function<B extends core.int>(int x) 307 int Function(int y, {List<Function> x}) Function<B extends core.int>(int x)
329 l5; 308 l5;
330 // The static function f5 sets `T` to `int`. 309 // The static function f5 sets `T` to `int`.
331 if (!tIsBool) { 310 if (!tIsBool) {
332 x5 = f5 as dynamic; 311 x5 = f5 as dynamic;
333 l5 = f5 as dynamic; 312 l5 = f5 as dynamic;
334 x5 = confuse(f5); 313 x5 = confuse(f5);
335 l5 = confuse(f5); 314 l5 = confuse(f5);
336 } 315 }
337 316
338 Expect.isTrue(m5 is F5); 317 Expect.isTrue(m5 is F5);
339 Expect.isTrue(m5 is int Function(int y, 318 Expect.isTrue(m5 is int Function(int y, {List<Function> x})
340 {List<Function> x}) Function<B extends core.int>(int x)); 319 Function<B extends core.int>(int x));
341 Expect.isTrue(confuse(m5) is F5); 320 Expect.isTrue(confuse(m5) is F5);
342 // In checked mode, verifies the type. 321 // In checked mode, verifies the type.
343 x5 = m5; 322 x5 = m5;
344 l5 = m5; 323 l5 = m5;
345 x5 = confuse(m5); 324 x5 = confuse(m5);
346 l5 = confuse(m5); 325 l5 = confuse(m5);
347 } 326 }
348 327
349 /// Function Function([int x]) Function<B extends core.int>(int x) 328 /// Function Function([int x]) Function<B extends core.int>(int x)
350 void testF6() { 329 void testF6() {
(...skipping 28 matching lines...) Expand all
379 Function Function(List<Function> x1) Function<B extends core.int>(int x) l7; 358 Function Function(List<Function> x1) Function<B extends core.int>(int x) l7;
380 // The static function f7 sets `T` to `int`. 359 // The static function f7 sets `T` to `int`.
381 if (!tIsBool) { 360 if (!tIsBool) {
382 x7 = f7 as dynamic; 361 x7 = f7 as dynamic;
383 l7 = f7 as dynamic; 362 l7 = f7 as dynamic;
384 x7 = confuse(f7); 363 x7 = confuse(f7);
385 l7 = confuse(f7); 364 l7 = confuse(f7);
386 } 365 }
387 366
388 Expect.isTrue(m7 is F7); 367 Expect.isTrue(m7 is F7);
389 Expect.isTrue(m7 is Function Function( 368 Expect.isTrue(m7 is Function Function(List<Function> x1)
390 List<Function> x1) Function<B extends core.int>(int x)); 369 Function<B extends core.int>(int x));
391 Expect.isTrue(confuse(m7) is F7); 370 Expect.isTrue(confuse(m7) is F7);
392 // In checked mode, verifies the type. 371 // In checked mode, verifies the type.
393 x7 = m7; 372 x7 = m7;
394 l7 = m7; 373 l7 = m7;
395 x7 = confuse(m7); 374 x7 = confuse(m7);
396 l7 = confuse(m7); 375 l7 = confuse(m7);
397 } 376 }
398 377
399 /// Function Function(int x, [List<T> x1]) Function<B extends core.int>(int x) 378 /// Function Function(int x, [List<T> x1]) Function<B extends core.int>(int x)
400 void testF8() { 379 void testF8() {
401 Expect.isTrue(f8 is F8); 380 Expect.isTrue(f8 is F8);
402 Expect.isTrue(confuse(f8) is F8); 381 Expect.isTrue(confuse(f8) is F8);
403 // In checked mode, verifies the type. 382 // In checked mode, verifies the type.
404 Function Function(int x, [List<T> x1]) Function<B extends core.int>(int x) 383 Function Function(int x, [List<T> x1]) Function<B extends core.int>(int x)
405 l8; 384 l8;
406 // The static function f8 sets `T` to `int`. 385 // The static function f8 sets `T` to `int`.
407 if (!tIsBool) { 386 if (!tIsBool) {
408 x8 = f8 as dynamic; 387 x8 = f8 as dynamic;
409 l8 = f8 as dynamic; 388 l8 = f8 as dynamic;
410 x8 = confuse(f8); 389 x8 = confuse(f8);
411 l8 = confuse(f8); 390 l8 = confuse(f8);
412 } 391 }
413 392
414 Expect.isTrue(m8 is F8); 393 Expect.isTrue(m8 is F8);
415 Expect.isTrue(m8 is Function Function(int x, 394 Expect.isTrue(m8 is Function Function(int x, [List<T> x1])
416 [List<T> x1]) Function<B extends core.int>(int x)); 395 Function<B extends core.int>(int x));
417 Expect.isTrue(confuse(m8) is F8); 396 Expect.isTrue(confuse(m8) is F8);
418 // In checked mode, verifies the type. 397 // In checked mode, verifies the type.
419 x8 = m8; 398 x8 = m8;
420 l8 = m8; 399 l8 = m8;
421 x8 = confuse(m8); 400 x8 = confuse(m8);
422 l8 = confuse(m8); 401 l8 = confuse(m8);
423 if (!tIsBool) { 402 if (!tIsBool) {
424 Expect.isTrue(f8 is F8<int>); 403 Expect.isTrue(f8 is F8<int>);
425 Expect.isFalse(f8 is F8<bool>); 404 Expect.isFalse(f8 is F8<bool>);
426 Expect.isTrue(confuse(f8) is F8<int>); 405 Expect.isTrue(confuse(f8) is F8<int>);
427 Expect.isFalse(confuse(f8) is F8<bool>); 406 Expect.isFalse(confuse(f8) is F8<bool>);
428 Expect.equals(tIsDynamic, m8 is F8<bool>); 407 Expect.equals(tIsDynamic, m8 is F8<bool>);
429 Expect.equals(tIsDynamic, confuse(m8) is F8<bool>); 408 Expect.equals(tIsDynamic, confuse(m8) is F8<bool>);
430 } else { 409 } else {
431 if (inCheckedMode) { 410 if (typeAssertionsEnabled) {
432 Expect.throws(() { 411 Expect.throws(() {
433 x8 = (f8 as dynamic); 412 x8 = (f8 as dynamic);
434 }); 413 });
435 Expect.throws(() { 414 Expect.throws(() {
436 x8 = confuse(f8); 415 x8 = confuse(f8);
437 }); 416 });
438 Function Function(int x, [List<T> x1]) Function<B extends core.int>( 417 Function Function(int x, [List<T> x1]) Function<B extends core.int>(
439 int x) l8; 418 int x) l8;
440 Expect.throws(() { 419 Expect.throws(() {
441 l8 = (f8 as dynamic); 420 l8 = (f8 as dynamic);
(...skipping 19 matching lines...) Expand all
461 int x) l9; 440 int x) l9;
462 // The static function f9 sets `T` to `int`. 441 // The static function f9 sets `T` to `int`.
463 if (!tIsBool) { 442 if (!tIsBool) {
464 x9 = f9 as dynamic; 443 x9 = f9 as dynamic;
465 l9 = f9 as dynamic; 444 l9 = f9 as dynamic;
466 x9 = confuse(f9); 445 x9 = confuse(f9);
467 l9 = confuse(f9); 446 l9 = confuse(f9);
468 } 447 }
469 448
470 Expect.isTrue(m9 is F9); 449 Expect.isTrue(m9 is F9);
471 Expect.isTrue(m9 is List<Function> Function(int x1, 450 Expect.isTrue(m9 is List<Function> Function(int x1, {Function x})
472 {Function x}) Function<B extends core.int>(int x)); 451 Function<B extends core.int>(int x));
473 Expect.isTrue(confuse(m9) is F9); 452 Expect.isTrue(confuse(m9) is F9);
474 // In checked mode, verifies the type. 453 // In checked mode, verifies the type.
475 x9 = m9; 454 x9 = m9;
476 l9 = m9; 455 l9 = m9;
477 x9 = confuse(m9); 456 x9 = confuse(m9);
478 l9 = confuse(m9); 457 l9 = confuse(m9);
479 } 458 }
480 459
481 /// List<Function> Function([List<T> x]) Function<B extends core.int>(int x) 460 /// List<Function> Function([List<T> x]) Function<B extends core.int>(int x)
482 void testF10() { 461 void testF10() {
483 Expect.isTrue(f10 is F10); 462 Expect.isTrue(f10 is F10);
484 Expect.isTrue(confuse(f10) is F10); 463 Expect.isTrue(confuse(f10) is F10);
485 // In checked mode, verifies the type. 464 // In checked mode, verifies the type.
486 List<Function> Function([List<T> x]) Function<B extends core.int>(int x) 465 List<Function> Function([List<T> x]) Function<B extends core.int>(int x)
487 l10; 466 l10;
488 // The static function f10 sets `T` to `int`. 467 // The static function f10 sets `T` to `int`.
489 if (!tIsBool) { 468 if (!tIsBool) {
490 x10 = f10 as dynamic; 469 x10 = f10 as dynamic;
491 l10 = f10 as dynamic; 470 l10 = f10 as dynamic;
492 x10 = confuse(f10); 471 x10 = confuse(f10);
493 l10 = confuse(f10); 472 l10 = confuse(f10);
494 } 473 }
495 474
496 Expect.isTrue(m10 is F10); 475 Expect.isTrue(m10 is F10);
497 Expect.isTrue(m10 is List<Function> Function( 476 Expect.isTrue(m10 is List<Function> Function([List<T> x])
498 [List<T> x]) Function<B extends core.int>(int x)); 477 Function<B extends core.int>(int x));
499 Expect.isTrue(confuse(m10) is F10); 478 Expect.isTrue(confuse(m10) is F10);
500 // In checked mode, verifies the type. 479 // In checked mode, verifies the type.
501 x10 = m10; 480 x10 = m10;
502 l10 = m10; 481 l10 = m10;
503 x10 = confuse(m10); 482 x10 = confuse(m10);
504 l10 = confuse(m10); 483 l10 = confuse(m10);
505 if (!tIsBool) { 484 if (!tIsBool) {
506 Expect.isTrue(f10 is F10<int>); 485 Expect.isTrue(f10 is F10<int>);
507 Expect.isFalse(f10 is F10<bool>); 486 Expect.isFalse(f10 is F10<bool>);
508 Expect.isTrue(confuse(f10) is F10<int>); 487 Expect.isTrue(confuse(f10) is F10<int>);
509 Expect.isFalse(confuse(f10) is F10<bool>); 488 Expect.isFalse(confuse(f10) is F10<bool>);
510 Expect.equals(tIsDynamic, m10 is F10<bool>); 489 Expect.equals(tIsDynamic, m10 is F10<bool>);
511 Expect.equals(tIsDynamic, confuse(m10) is F10<bool>); 490 Expect.equals(tIsDynamic, confuse(m10) is F10<bool>);
512 } else { 491 } else {
513 if (inCheckedMode) { 492 if (typeAssertionsEnabled) {
514 Expect.throws(() { 493 Expect.throws(() {
515 x10 = (f10 as dynamic); 494 x10 = (f10 as dynamic);
516 }); 495 });
517 Expect.throws(() { 496 Expect.throws(() {
518 x10 = confuse(f10); 497 x10 = confuse(f10);
519 }); 498 });
520 List<Function> Function([List<T> x]) Function<B extends core.int>(int x) 499 List<Function> Function([List<T> x]) Function<B extends core.int>(int x)
521 l10; 500 l10;
522 Expect.throws(() { 501 Expect.throws(() {
523 l10 = (f10 as dynamic); 502 l10 = (f10 as dynamic);
524 }); 503 });
525 Expect.throws(() { 504 Expect.throws(() {
526 l10 = confuse(f10); 505 l10 = confuse(f10);
527 }); 506 });
528 } 507 }
529 List<Function> Function([List<T> x]) Function<B extends core.int>(int x) 508 List<Function> Function([List<T> x]) Function<B extends core.int>(int x)
530 l10 = m10; 509 l10 = m10;
531 // In checked mode, verifies the type. 510 // In checked mode, verifies the type.
532 x10 = m10; 511 x10 = m10;
533 x10 = confuse(m10); 512 x10 = confuse(m10);
534 } 513 }
535 } 514 }
536 515
537 /// core.List<core.int> Function(int y, [Function x]) Function<B extends core. int>(int x) 516 /// core.List<core.int> Function(int y, [Function x]) Function<B extends core. int>(int x)
538 void testF11() { 517 void testF11() {
539 Expect.isTrue(f11 is F11); 518 Expect.isTrue(f11 is F11);
540 Expect.isTrue(confuse(f11) is F11); 519 Expect.isTrue(confuse(f11) is F11);
541 // In checked mode, verifies the type. 520 // In checked mode, verifies the type.
542 core.List<core.int> Function(int y, 521 core.List<core.int> Function(int y, [Function x])
543 [Function x]) Function<B extends core.int>(int x) l11; 522 Function<B extends core.int>(int x) l11;
544 // The static function f11 sets `T` to `int`. 523 // The static function f11 sets `T` to `int`.
545 if (!tIsBool) { 524 if (!tIsBool) {
546 x11 = f11 as dynamic; 525 x11 = f11 as dynamic;
547 l11 = f11 as dynamic; 526 l11 = f11 as dynamic;
548 x11 = confuse(f11); 527 x11 = confuse(f11);
549 l11 = confuse(f11); 528 l11 = confuse(f11);
550 } 529 }
551 530
552 Expect.isTrue(m11 is F11); 531 Expect.isTrue(m11 is F11);
553 Expect.isTrue(m11 is core.List<core.int> Function(int y, 532 Expect.isTrue(m11 is core.List<core.int> Function(int y, [Function x])
554 [Function x]) Function<B extends core.int>(int x)); 533 Function<B extends core.int>(int x));
555 Expect.isTrue(confuse(m11) is F11); 534 Expect.isTrue(confuse(m11) is F11);
556 // In checked mode, verifies the type. 535 // In checked mode, verifies the type.
557 x11 = m11; 536 x11 = m11;
558 l11 = m11; 537 l11 = m11;
559 x11 = confuse(m11); 538 x11 = confuse(m11);
560 l11 = confuse(m11); 539 l11 = confuse(m11);
561 } 540 }
562 541
563 /// core.List<core.int> Function(int x2, [core.List<core.int> x3]) Function<B extends core.int>(int x) 542 /// core.List<core.int> Function(int x2, [core.List<core.int> x3]) Function<B extends core.int>(int x)
564 void testF12() { 543 void testF12() {
565 Expect.isTrue(f12 is F12); 544 Expect.isTrue(f12 is F12);
566 Expect.isTrue(confuse(f12) is F12); 545 Expect.isTrue(confuse(f12) is F12);
567 // In checked mode, verifies the type. 546 // In checked mode, verifies the type.
568 core.List<core.int> Function(int x2, 547 core.List<core.int> Function(int x2, [core.List<core.int> x3])
569 [core.List<core.int> x3]) Function<B extends core.int>(int x) l12; 548 Function<B extends core.int>(int x) l12;
570 // The static function f12 sets `T` to `int`. 549 // The static function f12 sets `T` to `int`.
571 if (!tIsBool) { 550 if (!tIsBool) {
572 x12 = f12 as dynamic; 551 x12 = f12 as dynamic;
573 l12 = f12 as dynamic; 552 l12 = f12 as dynamic;
574 x12 = confuse(f12); 553 x12 = confuse(f12);
575 l12 = confuse(f12); 554 l12 = confuse(f12);
576 } 555 }
577 556
578 Expect.isTrue(m12 is F12); 557 Expect.isTrue(m12 is F12);
579 Expect.isTrue(m12 is core.List<core.int> Function(int x2, 558 Expect.isTrue(m12 is core.List<core.int> Function(int x2,
580 [core.List<core.int> x3]) Function<B extends core.int>(int x)); 559 [core.List<core.int> x3])
560 Function<B extends core.int>(int x));
581 Expect.isTrue(confuse(m12) is F12); 561 Expect.isTrue(confuse(m12) is F12);
582 // In checked mode, verifies the type. 562 // In checked mode, verifies the type.
583 x12 = m12; 563 x12 = m12;
584 l12 = m12; 564 l12 = m12;
585 x12 = confuse(m12); 565 x12 = confuse(m12);
586 l12 = confuse(m12); 566 l12 = confuse(m12);
587 } 567 }
588 568
589 /// List<T> Function({int x}) Function<B extends core.int>(int x) 569 /// List<T> Function({int x}) Function<B extends core.int>(int x)
590 void testF13() { 570 void testF13() {
(...skipping 19 matching lines...) Expand all
610 x13 = confuse(m13); 590 x13 = confuse(m13);
611 l13 = confuse(m13); 591 l13 = confuse(m13);
612 if (!tIsBool) { 592 if (!tIsBool) {
613 Expect.isTrue(f13 is F13<int>); 593 Expect.isTrue(f13 is F13<int>);
614 Expect.isFalse(f13 is F13<bool>); 594 Expect.isFalse(f13 is F13<bool>);
615 Expect.isTrue(confuse(f13) is F13<int>); 595 Expect.isTrue(confuse(f13) is F13<int>);
616 Expect.isFalse(confuse(f13) is F13<bool>); 596 Expect.isFalse(confuse(f13) is F13<bool>);
617 Expect.equals(tIsDynamic, m13 is F13<bool>); 597 Expect.equals(tIsDynamic, m13 is F13<bool>);
618 Expect.equals(tIsDynamic, confuse(m13) is F13<bool>); 598 Expect.equals(tIsDynamic, confuse(m13) is F13<bool>);
619 } else { 599 } else {
620 if (inCheckedMode) { 600 if (typeAssertionsEnabled) {
621 Expect.throws(() { 601 Expect.throws(() {
622 x13 = (f13 as dynamic); 602 x13 = (f13 as dynamic);
623 }); 603 });
624 Expect.throws(() { 604 Expect.throws(() {
625 x13 = confuse(f13); 605 x13 = confuse(f13);
626 }); 606 });
627 List<T> Function({int x}) Function<B extends core.int>(int x) l13; 607 List<T> Function({int x}) Function<B extends core.int>(int x) l13;
628 Expect.throws(() { 608 Expect.throws(() {
629 l13 = (f13 as dynamic); 609 l13 = (f13 as dynamic);
630 }); 610 });
(...skipping 17 matching lines...) Expand all
648 l14; 628 l14;
649 // The static function f14 sets `T` to `int`. 629 // The static function f14 sets `T` to `int`.
650 if (!tIsBool) { 630 if (!tIsBool) {
651 x14 = f14 as dynamic; 631 x14 = f14 as dynamic;
652 l14 = f14 as dynamic; 632 l14 = f14 as dynamic;
653 x14 = confuse(f14); 633 x14 = confuse(f14);
654 l14 = confuse(f14); 634 l14 = confuse(f14);
655 } 635 }
656 636
657 Expect.isTrue(m14 is F14); 637 Expect.isTrue(m14 is F14);
658 Expect.isTrue(m14 is List<T> Function( 638 Expect.isTrue(m14 is List<T> Function(core.List<core.int> x)
659 core.List<core.int> x) Function<B extends core.int>(int x)); 639 Function<B extends core.int>(int x));
660 Expect.isTrue(confuse(m14) is F14); 640 Expect.isTrue(confuse(m14) is F14);
661 // In checked mode, verifies the type. 641 // In checked mode, verifies the type.
662 x14 = m14; 642 x14 = m14;
663 l14 = m14; 643 l14 = m14;
664 x14 = confuse(m14); 644 x14 = confuse(m14);
665 l14 = confuse(m14); 645 l14 = confuse(m14);
666 if (!tIsBool) { 646 if (!tIsBool) {
667 Expect.isTrue(f14 is F14<int>); 647 Expect.isTrue(f14 is F14<int>);
668 Expect.isFalse(f14 is F14<bool>); 648 Expect.isFalse(f14 is F14<bool>);
669 Expect.isTrue(confuse(f14) is F14<int>); 649 Expect.isTrue(confuse(f14) is F14<int>);
670 Expect.isFalse(confuse(f14) is F14<bool>); 650 Expect.isFalse(confuse(f14) is F14<bool>);
671 Expect.equals(tIsDynamic, m14 is F14<bool>); 651 Expect.equals(tIsDynamic, m14 is F14<bool>);
672 Expect.equals(tIsDynamic, confuse(m14) is F14<bool>); 652 Expect.equals(tIsDynamic, confuse(m14) is F14<bool>);
673 } else { 653 } else {
674 if (inCheckedMode) { 654 if (typeAssertionsEnabled) {
675 Expect.throws(() { 655 Expect.throws(() {
676 x14 = (f14 as dynamic); 656 x14 = (f14 as dynamic);
677 }); 657 });
678 Expect.throws(() { 658 Expect.throws(() {
679 x14 = confuse(f14); 659 x14 = confuse(f14);
680 }); 660 });
681 List<T> Function(core.List<core.int> x) Function<B extends core.int>( 661 List<T> Function(core.List<core.int> x) Function<B extends core.int>(
682 int x) l14; 662 int x) l14;
683 Expect.throws(() { 663 Expect.throws(() {
684 l14 = (f14 as dynamic); 664 l14 = (f14 as dynamic);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 Function([List<Function> x1]) Function<B extends core.int>(int x) l16; 708 Function([List<Function> x1]) Function<B extends core.int>(int x) l16;
729 // The static function f16 sets `T` to `int`. 709 // The static function f16 sets `T` to `int`.
730 if (!tIsBool) { 710 if (!tIsBool) {
731 x16 = f16 as dynamic; 711 x16 = f16 as dynamic;
732 l16 = f16 as dynamic; 712 l16 = f16 as dynamic;
733 x16 = confuse(f16); 713 x16 = confuse(f16);
734 l16 = confuse(f16); 714 l16 = confuse(f16);
735 } 715 }
736 716
737 Expect.isTrue(m16 is F16); 717 Expect.isTrue(m16 is F16);
738 Expect.isTrue(m16 is Function( 718 Expect.isTrue(m16 is Function([List<Function> x1])
739 [List<Function> x1]) Function<B extends core.int>(int x)); 719 Function<B extends core.int>(int x));
740 Expect.isTrue(confuse(m16) is F16); 720 Expect.isTrue(confuse(m16) is F16);
741 // In checked mode, verifies the type. 721 // In checked mode, verifies the type.
742 x16 = m16; 722 x16 = m16;
743 l16 = m16; 723 l16 = m16;
744 x16 = confuse(m16); 724 x16 = confuse(m16);
745 l16 = confuse(m16); 725 l16 = confuse(m16);
746 } 726 }
747 727
748 /// Function({List<T> x}) Function<B extends core.int>(int x) 728 /// Function({List<T> x}) Function<B extends core.int>(int x)
749 void testF17() { 729 void testF17() {
(...skipping 19 matching lines...) Expand all
769 x17 = confuse(m17); 749 x17 = confuse(m17);
770 l17 = confuse(m17); 750 l17 = confuse(m17);
771 if (!tIsBool) { 751 if (!tIsBool) {
772 Expect.isTrue(f17 is F17<int>); 752 Expect.isTrue(f17 is F17<int>);
773 Expect.isFalse(f17 is F17<bool>); 753 Expect.isFalse(f17 is F17<bool>);
774 Expect.isTrue(confuse(f17) is F17<int>); 754 Expect.isTrue(confuse(f17) is F17<int>);
775 Expect.isFalse(confuse(f17) is F17<bool>); 755 Expect.isFalse(confuse(f17) is F17<bool>);
776 Expect.equals(tIsDynamic, m17 is F17<bool>); 756 Expect.equals(tIsDynamic, m17 is F17<bool>);
777 Expect.equals(tIsDynamic, confuse(m17) is F17<bool>); 757 Expect.equals(tIsDynamic, confuse(m17) is F17<bool>);
778 } else { 758 } else {
779 if (inCheckedMode) { 759 if (typeAssertionsEnabled) {
780 Expect.throws(() { 760 Expect.throws(() {
781 x17 = (f17 as dynamic); 761 x17 = (f17 as dynamic);
782 }); 762 });
783 Expect.throws(() { 763 Expect.throws(() {
784 x17 = confuse(f17); 764 x17 = confuse(f17);
785 }); 765 });
786 Function({List<T> x}) Function<B extends core.int>(int x) l17; 766 Function({List<T> x}) Function<B extends core.int>(int x) l17;
787 Expect.throws(() { 767 Expect.throws(() {
788 l17 = (f17 as dynamic); 768 l17 = (f17 as dynamic);
789 }); 769 });
(...skipping 16 matching lines...) Expand all
806 void Function(int y, {Function x}) Function<B extends core.int>(int x) l18; 786 void Function(int y, {Function x}) Function<B extends core.int>(int x) l18;
807 // The static function f18 sets `T` to `int`. 787 // The static function f18 sets `T` to `int`.
808 if (!tIsBool) { 788 if (!tIsBool) {
809 x18 = f18 as dynamic; 789 x18 = f18 as dynamic;
810 l18 = f18 as dynamic; 790 l18 = f18 as dynamic;
811 x18 = confuse(f18); 791 x18 = confuse(f18);
812 l18 = confuse(f18); 792 l18 = confuse(f18);
813 } 793 }
814 794
815 Expect.isTrue(m18 is F18); 795 Expect.isTrue(m18 is F18);
816 Expect.isTrue(m18 is void Function(int y, 796 Expect.isTrue(m18 is void Function(int y, {Function x})
817 {Function x}) Function<B extends core.int>(int x)); 797 Function<B extends core.int>(int x));
818 Expect.isTrue(confuse(m18) is F18); 798 Expect.isTrue(confuse(m18) is F18);
819 // In checked mode, verifies the type. 799 // In checked mode, verifies the type.
820 x18 = m18; 800 x18 = m18;
821 l18 = m18; 801 l18 = m18;
822 x18 = confuse(m18); 802 x18 = confuse(m18);
823 l18 = confuse(m18); 803 l18 = confuse(m18);
824 } 804 }
825 805
826 /// void Function(int x1, [List<T> x]) Function<B extends core.int>(int x) 806 /// void Function(int x1, [List<T> x]) Function<B extends core.int>(int x)
827 void testF19() { 807 void testF19() {
828 Expect.isTrue(f19 is F19); 808 Expect.isTrue(f19 is F19);
829 Expect.isTrue(confuse(f19) is F19); 809 Expect.isTrue(confuse(f19) is F19);
830 // In checked mode, verifies the type. 810 // In checked mode, verifies the type.
831 void Function(int x1, [List<T> x]) Function<B extends core.int>(int x) l19; 811 void Function(int x1, [List<T> x]) Function<B extends core.int>(int x) l19;
832 // The static function f19 sets `T` to `int`. 812 // The static function f19 sets `T` to `int`.
833 if (!tIsBool) { 813 if (!tIsBool) {
834 x19 = f19 as dynamic; 814 x19 = f19 as dynamic;
835 l19 = f19 as dynamic; 815 l19 = f19 as dynamic;
836 x19 = confuse(f19); 816 x19 = confuse(f19);
837 l19 = confuse(f19); 817 l19 = confuse(f19);
838 } 818 }
839 819
840 Expect.isTrue(m19 is F19); 820 Expect.isTrue(m19 is F19);
841 Expect.isTrue(m19 is void Function(int x1, 821 Expect.isTrue(m19 is void Function(int x1, [List<T> x])
842 [List<T> x]) Function<B extends core.int>(int x)); 822 Function<B extends core.int>(int x));
843 Expect.isTrue(confuse(m19) is F19); 823 Expect.isTrue(confuse(m19) is F19);
844 // In checked mode, verifies the type. 824 // In checked mode, verifies the type.
845 x19 = m19; 825 x19 = m19;
846 l19 = m19; 826 l19 = m19;
847 x19 = confuse(m19); 827 x19 = confuse(m19);
848 l19 = confuse(m19); 828 l19 = confuse(m19);
849 if (!tIsBool) { 829 if (!tIsBool) {
850 Expect.isTrue(f19 is F19<int>); 830 Expect.isTrue(f19 is F19<int>);
851 Expect.isFalse(f19 is F19<bool>); 831 Expect.isFalse(f19 is F19<bool>);
852 Expect.isTrue(confuse(f19) is F19<int>); 832 Expect.isTrue(confuse(f19) is F19<int>);
853 Expect.isFalse(confuse(f19) is F19<bool>); 833 Expect.isFalse(confuse(f19) is F19<bool>);
854 Expect.equals(tIsDynamic, m19 is F19<bool>); 834 Expect.equals(tIsDynamic, m19 is F19<bool>);
855 Expect.equals(tIsDynamic, confuse(m19) is F19<bool>); 835 Expect.equals(tIsDynamic, confuse(m19) is F19<bool>);
856 } else { 836 } else {
857 if (inCheckedMode) { 837 if (typeAssertionsEnabled) {
858 Expect.throws(() { 838 Expect.throws(() {
859 x19 = (f19 as dynamic); 839 x19 = (f19 as dynamic);
860 }); 840 });
861 Expect.throws(() { 841 Expect.throws(() {
862 x19 = confuse(f19); 842 x19 = confuse(f19);
863 }); 843 });
864 void Function(int x1, [List<T> x]) Function<B extends core.int>(int x) 844 void Function(int x1, [List<T> x]) Function<B extends core.int>(int x)
865 l19; 845 l19;
866 Expect.throws(() { 846 Expect.throws(() {
867 l19 = (f19 as dynamic); 847 l19 = (f19 as dynamic);
(...skipping 18 matching lines...) Expand all
886 Function Function<A>(List<A> x) Function<B extends core.int>(int x) l20; 866 Function Function<A>(List<A> x) Function<B extends core.int>(int x) l20;
887 // The static function f20 sets `T` to `int`. 867 // The static function f20 sets `T` to `int`.
888 if (!tIsBool) { 868 if (!tIsBool) {
889 x20 = f20 as dynamic; 869 x20 = f20 as dynamic;
890 l20 = f20 as dynamic; 870 l20 = f20 as dynamic;
891 x20 = confuse(f20); 871 x20 = confuse(f20);
892 l20 = confuse(f20); 872 l20 = confuse(f20);
893 } 873 }
894 874
895 Expect.isTrue(m20 is F20); 875 Expect.isTrue(m20 is F20);
896 Expect.isTrue(m20 is Function Function<A>( 876 Expect.isTrue(m20 is Function Function<A>(List<A> x)
897 List<A> x) Function<B extends core.int>(int x)); 877 Function<B extends core.int>(int x));
898 Expect.isTrue(confuse(m20) is F20); 878 Expect.isTrue(confuse(m20) is F20);
899 // In checked mode, verifies the type. 879 // In checked mode, verifies the type.
900 x20 = m20; 880 x20 = m20;
901 l20 = m20; 881 l20 = m20;
902 x20 = confuse(m20); 882 x20 = confuse(m20);
903 l20 = confuse(m20); 883 l20 = confuse(m20);
904 } 884 }
905 885
906 /// Function<A>(int x) Function<B extends core.int>(int x) 886 /// Function<A>(int x) Function<B extends core.int>(int x)
907 void testF21() { 887 void testF21() {
(...skipping 28 matching lines...) Expand all
936 void Function<A>(Function x) Function<B extends core.int>(int x) l22; 916 void Function<A>(Function x) Function<B extends core.int>(int x) l22;
937 // The static function f22 sets `T` to `int`. 917 // The static function f22 sets `T` to `int`.
938 if (!tIsBool) { 918 if (!tIsBool) {
939 x22 = f22 as dynamic; 919 x22 = f22 as dynamic;
940 l22 = f22 as dynamic; 920 l22 = f22 as dynamic;
941 x22 = confuse(f22); 921 x22 = confuse(f22);
942 l22 = confuse(f22); 922 l22 = confuse(f22);
943 } 923 }
944 924
945 Expect.isTrue(m22 is F22); 925 Expect.isTrue(m22 is F22);
946 Expect.isTrue(m22 is void Function<A>( 926 Expect.isTrue(m22 is void Function<A>(Function x)
947 Function x) Function<B extends core.int>(int x)); 927 Function<B extends core.int>(int x));
948 Expect.isTrue(confuse(m22) is F22); 928 Expect.isTrue(confuse(m22) is F22);
949 // In checked mode, verifies the type. 929 // In checked mode, verifies the type.
950 x22 = m22; 930 x22 = m22;
951 l22 = m22; 931 l22 = m22;
952 x22 = confuse(m22); 932 x22 = confuse(m22);
953 l22 = confuse(m22); 933 l22 = confuse(m22);
954 } 934 }
955 } 935 }
956 936
957 void main() { 937 void main() {
958 new U95().runTests(); 938 new U95().runTests();
959 new U95<int>(tIsInt: true).runTests(); 939 new U95<int>(tIsInt: true).runTests();
960 new U95<bool>(tIsBool: true).runTests(); 940 new U95<bool>(tIsBool: true).runTests();
961 } 941 }
OLDNEW
« no previous file with comments | « tests/language/function_type/function_type94_test.dart ('k') | tests/language/function_type/function_type96_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698