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

Side by Side Diff: tests/language/function_type/function_type59_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 y, [int x]);
23 bool result = false; 23 typedef F1<T> = List<Function> Function(int y, [List<T> x]);
24 assert(result = true); 24 typedef F2<T> = List<T> Function(int x0, [core.List<core.int> x]);
25 return result; 25 typedef F3<T> = void Function([List<Function> x]);
26 })(); 26 typedef F4<T> = void Function<A>(core.List<core.int> x);
27 27 typedef F5<T> = int Function([List<Function> x]) Function<B extends core.int>(
28 typedef F0<T> 28 int x);
29 = Function Function(int y, [int x]); 29 typedef F6<T> = int Function(List<T> x1) Function<B extends core.int>(int x);
30 typedef F1<T> 30 typedef F7<T> = Function Function(int x2, [Function x3])
31 = List<Function> Function(int y, [List<T> x]); 31 Function<B extends core.int>(int x);
32 typedef F2<T> 32 typedef F8<T> = Function Function(int x1, {core.List<core.int> x})
33 = List<T> Function(int x0, [core.List<core.int> x]); 33 Function<B extends core.int>(int x);
34 typedef F3<T> 34 typedef F9<T> = List<Function> Function(Function x)
35 = void Function([List<Function> x]); 35 Function<B extends core.int>(int x);
36 typedef F4<T> 36 typedef F10<T> = List<Function> Function(int y, [core.List<core.int> x])
37 = void Function<A>(core.List<core.int> x); 37 Function<B extends core.int>(int x);
38 typedef F5<T> 38 typedef F11<T> = core.List<core.int> Function([int x1])
39 = int Function([List<Function> x]) Function<B extends core.int>(int x); 39 Function<B extends core.int>(int x);
40 typedef F6<T> 40 typedef F12<T> = core.List<core.int> Function({List<Function> x})
41 = int Function(List<T> x1) Function<B extends core.int>(int x); 41 Function<B extends core.int>(int x);
42 typedef F7<T> 42 typedef F13<T> = core.List<core.int> Function() Function<B extends core.int>(
43 = Function Function(int x2, [Function x3]) Function<B extends core.int>( 43 int x);
44 int x); 44 typedef F14<T> = List<T> Function(int x1, [List<Function> x])
45 typedef F8<T> 45 Function<B extends core.int>(int x);
46 = Function Function(int x1, 46 typedef F15<T> = List<T> Function([List<T> x1]) Function<B extends core.int>(
47 {core.List<core.int> x}) Function<B extends core.int>(int x); 47 int x);
48 typedef F9<T> 48 typedef F16<T> = Function(int x, [Function x1]) Function<B extends core.int>(
49 = List<Function> Function(Function x) Function<B extends core.int>(int x); 49 int x);
50 typedef F10<T> 50 typedef F17<T> = Function(int y, {core.List<core.int> x})
51 = List<Function> Function(int y, 51 Function<B extends core.int>(int x);
52 [core.List<core.int> x]) Function<B extends core.int>(int x); 52 typedef F18<T> = void Function([Function x]) Function<B extends core.int>(
53 typedef F11<T> 53 int x);
54 = core.List<core.int> Function([int x1]) Function<B extends core.int>( 54 typedef F19<T> = void Function(core.List<core.int> x1)
55 int x); 55 Function<B extends core.int>(int x);
56 typedef F12<T> 56 typedef F20<T> = int Function<A>(A x) Function<B extends core.int>(int x);
57 = core.List<core.int> Function( 57 typedef F21<T> = core.List<core.int> Function<A>(List<A> x)
58 {List<Function> x}) Function<B extends core.int>(int x); 58 Function<B extends core.int>(int x);
59 typedef F13<T> 59 typedef F22<T> = List<A> Function<A>(int x) Function<B extends core.int>(int x);
60 = core.List<core.int> Function() Function<B extends core.int>(int x);
61 typedef F14<T>
62 = List<T> Function(int x1, [List<Function> x]) Function<B extends core.int>(
63 int x);
64 typedef F15<T>
65 = List<T> Function([List<T> x1]) Function<B extends core.int>(int x);
66 typedef F16<T>
67 = Function(int x, [Function x1]) Function<B extends core.int>(int x);
68 typedef F17<T>
69 = Function(int y, {core.List<core.int> x}) Function<B extends core.int>(
70 int x);
71 typedef F18<T>
72 = void Function([Function x]) Function<B extends core.int>(int x);
73 typedef F19<T>
74 = void Function(core.List<core.int> x1) Function<B extends core.int>(int x);
75 typedef F20<T>
76 = int Function<A>(A x) Function<B extends core.int>(int x);
77 typedef F21<T>
78 = core.List<core.int> Function<A>(List<A> x) Function<B extends core.int>(
79 int x);
80 typedef F22<T>
81 = List<A> Function<A>(int x) Function<B extends core.int>(int x);
82 60
83 Function f0(int y, [int x]) => null; 61 Function f0(int y, [int x]) => null;
84 List<Function> f1(int y, [List<int> x]) => null; 62 List<Function> f1(int y, [List<int> x]) => null;
85 List<int> f2(int x0, [core.List<core.int> x]) => null; 63 List<int> f2(int x0, [core.List<core.int> x]) => null;
86 void f3([List<Function> x]) => null; 64 void f3([List<Function> x]) => null;
87 void f4<A>(core.List<core.int> x) => null; 65 void f4<A>(core.List<core.int> x) => null;
88 int Function([List<Function> x]) f5<B extends core.int>(int x) => null; 66 int Function([List<Function> x]) f5<B extends core.int>(int x) => null;
89 int Function(List<int> x0) f6<B extends core.int>(int x) => null; 67 int Function(List<int> x0) f6<B extends core.int>(int x) => null;
90 Function Function(int x0, [Function x1]) f7<B extends core.int>(int x) => null; 68 Function Function(int x0, [Function x1]) f7<B extends core.int>(int x) => null;
91 Function Function(int x0, {core.List<core.int> x}) f8<B extends core.int>( 69 Function Function(int x0, {core.List<core.int> x}) f8<B extends core.int>(
(...skipping 27 matching lines...) Expand all
119 97
120 Function Function(int y, [int x]) x0; 98 Function Function(int y, [int x]) x0;
121 List<Function> Function(int y, [List<T> x]) x1; 99 List<Function> Function(int y, [List<T> x]) x1;
122 List<T> Function(int x0, [core.List<core.int> x]) x2; 100 List<T> Function(int x0, [core.List<core.int> x]) x2;
123 void Function([List<Function> x]) x3; 101 void Function([List<Function> x]) x3;
124 void Function<A>(core.List<core.int> x) x4; 102 void Function<A>(core.List<core.int> x) x4;
125 int Function([List<Function> x]) Function<B extends core.int>(int x) x5; 103 int Function([List<Function> x]) Function<B extends core.int>(int x) x5;
126 int Function(List<T> x1) Function<B extends core.int>(int x) x6; 104 int Function(List<T> x1) Function<B extends core.int>(int x) x6;
127 Function Function(int x2, [Function x3]) Function<B extends core.int>(int x) 105 Function Function(int x2, [Function x3]) Function<B extends core.int>(int x)
128 x7; 106 x7;
129 Function Function(int x1, 107 Function Function(int x1, {core.List<core.int> x})
130 {core.List<core.int> x}) Function<B extends core.int>(int x) x8; 108 Function<B extends core.int>(int x) x8;
131 List<Function> Function(Function x) Function<B extends core.int>(int x) x9; 109 List<Function> Function(Function x) Function<B extends core.int>(int x) x9;
132 List<Function> Function(int y, 110 List<Function> Function(int y, [core.List<core.int> x])
133 [core.List<core.int> x]) Function<B extends core.int>(int x) x10; 111 Function<B extends core.int>(int x) x10;
134 core.List<core.int> Function([int x1]) Function<B extends core.int>(int x) 112 core.List<core.int> Function([int x1]) Function<B extends core.int>(int x)
135 x11; 113 x11;
136 core.List<core.int> Function({List<Function> x}) Function<B extends core.int>( 114 core.List<core.int> Function({List<Function> x}) Function<B extends core.int>(
137 int x) x12; 115 int x) x12;
138 core.List<core.int> Function() Function<B extends core.int>(int x) x13; 116 core.List<core.int> Function() Function<B extends core.int>(int x) x13;
139 List<T> Function(int x1, [List<Function> x]) Function<B extends core.int>( 117 List<T> Function(int x1, [List<Function> x]) Function<B extends core.int>(
140 int x) x14; 118 int x) x14;
141 List<T> Function([List<T> x1]) Function<B extends core.int>(int x) x15; 119 List<T> Function([List<T> x1]) Function<B extends core.int>(int x) x15;
142 Function(int x, [Function x1]) Function<B extends core.int>(int x) x16; 120 Function(int x, [Function x1]) Function<B extends core.int>(int x) x16;
143 Function(int y, {core.List<core.int> x}) Function<B extends core.int>(int x) 121 Function(int y, {core.List<core.int> x}) Function<B extends core.int>(int x)
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 x1 = confuse(m1); 236 x1 = confuse(m1);
259 l1 = confuse(m1); 237 l1 = confuse(m1);
260 if (!tIsBool) { 238 if (!tIsBool) {
261 Expect.isTrue(f1 is F1<int>); 239 Expect.isTrue(f1 is F1<int>);
262 Expect.isFalse(f1 is F1<bool>); 240 Expect.isFalse(f1 is F1<bool>);
263 Expect.isTrue(confuse(f1) is F1<int>); 241 Expect.isTrue(confuse(f1) is F1<int>);
264 Expect.isFalse(confuse(f1) is F1<bool>); 242 Expect.isFalse(confuse(f1) is F1<bool>);
265 Expect.equals(tIsDynamic, m1 is F1<bool>); 243 Expect.equals(tIsDynamic, m1 is F1<bool>);
266 Expect.equals(tIsDynamic, confuse(m1) is F1<bool>); 244 Expect.equals(tIsDynamic, confuse(m1) is F1<bool>);
267 } else { 245 } else {
268 if (inCheckedMode) { 246 if (typeAssertionsEnabled) {
269 Expect.throws(() { 247 Expect.throws(() {
270 x1 = (f1 as dynamic); 248 x1 = (f1 as dynamic);
271 }); 249 });
272 Expect.throws(() { 250 Expect.throws(() {
273 x1 = confuse(f1); 251 x1 = confuse(f1);
274 }); 252 });
275 List<Function> Function(int y, [List<T> x]) l1; 253 List<Function> Function(int y, [List<T> x]) l1;
276 Expect.throws(() { 254 Expect.throws(() {
277 l1 = (f1 as dynamic); 255 l1 = (f1 as dynamic);
278 }); 256 });
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 x2 = confuse(m2); 288 x2 = confuse(m2);
311 l2 = confuse(m2); 289 l2 = confuse(m2);
312 if (!tIsBool) { 290 if (!tIsBool) {
313 Expect.isTrue(f2 is F2<int>); 291 Expect.isTrue(f2 is F2<int>);
314 Expect.isFalse(f2 is F2<bool>); 292 Expect.isFalse(f2 is F2<bool>);
315 Expect.isTrue(confuse(f2) is F2<int>); 293 Expect.isTrue(confuse(f2) is F2<int>);
316 Expect.isFalse(confuse(f2) is F2<bool>); 294 Expect.isFalse(confuse(f2) is F2<bool>);
317 Expect.equals(tIsDynamic, m2 is F2<bool>); 295 Expect.equals(tIsDynamic, m2 is F2<bool>);
318 Expect.equals(tIsDynamic, confuse(m2) is F2<bool>); 296 Expect.equals(tIsDynamic, confuse(m2) is F2<bool>);
319 } else { 297 } else {
320 if (inCheckedMode) { 298 if (typeAssertionsEnabled) {
321 Expect.throws(() { 299 Expect.throws(() {
322 x2 = (f2 as dynamic); 300 x2 = (f2 as dynamic);
323 }); 301 });
324 Expect.throws(() { 302 Expect.throws(() {
325 x2 = confuse(f2); 303 x2 = confuse(f2);
326 }); 304 });
327 List<T> Function(int x0, [core.List<core.int> x]) l2; 305 List<T> Function(int x0, [core.List<core.int> x]) l2;
328 Expect.throws(() { 306 Expect.throws(() {
329 l2 = (f2 as dynamic); 307 l2 = (f2 as dynamic);
330 }); 308 });
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 int Function([List<Function> x]) Function<B extends core.int>(int x) l5; 373 int Function([List<Function> x]) Function<B extends core.int>(int x) l5;
396 // The static function f5 sets `T` to `int`. 374 // The static function f5 sets `T` to `int`.
397 if (!tIsBool) { 375 if (!tIsBool) {
398 x5 = f5 as dynamic; 376 x5 = f5 as dynamic;
399 l5 = f5 as dynamic; 377 l5 = f5 as dynamic;
400 x5 = confuse(f5); 378 x5 = confuse(f5);
401 l5 = confuse(f5); 379 l5 = confuse(f5);
402 } 380 }
403 381
404 Expect.isTrue(m5 is F5); 382 Expect.isTrue(m5 is F5);
405 Expect.isTrue(m5 is int Function( 383 Expect.isTrue(m5 is int Function([List<Function> x])
406 [List<Function> x]) Function<B extends core.int>(int x)); 384 Function<B extends core.int>(int x));
407 Expect.isTrue(confuse(m5) is F5); 385 Expect.isTrue(confuse(m5) is F5);
408 // In checked mode, verifies the type. 386 // In checked mode, verifies the type.
409 x5 = m5; 387 x5 = m5;
410 l5 = m5; 388 l5 = m5;
411 x5 = confuse(m5); 389 x5 = confuse(m5);
412 l5 = confuse(m5); 390 l5 = confuse(m5);
413 } 391 }
414 392
415 /// int Function(List<T> x1) Function<B extends core.int>(int x) 393 /// int Function(List<T> x1) Function<B extends core.int>(int x)
416 void testF6() { 394 void testF6() {
(...skipping 19 matching lines...) Expand all
436 x6 = confuse(m6); 414 x6 = confuse(m6);
437 l6 = confuse(m6); 415 l6 = confuse(m6);
438 if (!tIsBool) { 416 if (!tIsBool) {
439 Expect.isTrue(f6 is F6<int>); 417 Expect.isTrue(f6 is F6<int>);
440 Expect.isFalse(f6 is F6<bool>); 418 Expect.isFalse(f6 is F6<bool>);
441 Expect.isTrue(confuse(f6) is F6<int>); 419 Expect.isTrue(confuse(f6) is F6<int>);
442 Expect.isFalse(confuse(f6) is F6<bool>); 420 Expect.isFalse(confuse(f6) is F6<bool>);
443 Expect.equals(tIsDynamic, m6 is F6<bool>); 421 Expect.equals(tIsDynamic, m6 is F6<bool>);
444 Expect.equals(tIsDynamic, confuse(m6) is F6<bool>); 422 Expect.equals(tIsDynamic, confuse(m6) is F6<bool>);
445 } else { 423 } else {
446 if (inCheckedMode) { 424 if (typeAssertionsEnabled) {
447 Expect.throws(() { 425 Expect.throws(() {
448 x6 = (f6 as dynamic); 426 x6 = (f6 as dynamic);
449 }); 427 });
450 Expect.throws(() { 428 Expect.throws(() {
451 x6 = confuse(f6); 429 x6 = confuse(f6);
452 }); 430 });
453 int Function(List<T> x1) Function<B extends core.int>(int x) l6; 431 int Function(List<T> x1) Function<B extends core.int>(int x) l6;
454 Expect.throws(() { 432 Expect.throws(() {
455 l6 = (f6 as dynamic); 433 l6 = (f6 as dynamic);
456 }); 434 });
(...skipping 17 matching lines...) Expand all
474 l7; 452 l7;
475 // The static function f7 sets `T` to `int`. 453 // The static function f7 sets `T` to `int`.
476 if (!tIsBool) { 454 if (!tIsBool) {
477 x7 = f7 as dynamic; 455 x7 = f7 as dynamic;
478 l7 = f7 as dynamic; 456 l7 = f7 as dynamic;
479 x7 = confuse(f7); 457 x7 = confuse(f7);
480 l7 = confuse(f7); 458 l7 = confuse(f7);
481 } 459 }
482 460
483 Expect.isTrue(m7 is F7); 461 Expect.isTrue(m7 is F7);
484 Expect.isTrue(m7 is Function Function(int x2, 462 Expect.isTrue(m7 is Function Function(int x2, [Function x3])
485 [Function x3]) Function<B extends core.int>(int x)); 463 Function<B extends core.int>(int x));
486 Expect.isTrue(confuse(m7) is F7); 464 Expect.isTrue(confuse(m7) is F7);
487 // In checked mode, verifies the type. 465 // In checked mode, verifies the type.
488 x7 = m7; 466 x7 = m7;
489 l7 = m7; 467 l7 = m7;
490 x7 = confuse(m7); 468 x7 = confuse(m7);
491 l7 = confuse(m7); 469 l7 = confuse(m7);
492 } 470 }
493 471
494 /// Function Function(int x1, {core.List<core.int> x}) Function<B extends core .int>(int x) 472 /// Function Function(int x1, {core.List<core.int> x}) Function<B extends core .int>(int x)
495 void testF8() { 473 void testF8() {
496 Expect.isTrue(f8 is F8); 474 Expect.isTrue(f8 is F8);
497 Expect.isTrue(confuse(f8) is F8); 475 Expect.isTrue(confuse(f8) is F8);
498 // In checked mode, verifies the type. 476 // In checked mode, verifies the type.
499 Function Function(int x1, 477 Function Function(int x1, {core.List<core.int> x})
500 {core.List<core.int> x}) Function<B extends core.int>(int x) l8; 478 Function<B extends core.int>(int x) l8;
501 // The static function f8 sets `T` to `int`. 479 // The static function f8 sets `T` to `int`.
502 if (!tIsBool) { 480 if (!tIsBool) {
503 x8 = f8 as dynamic; 481 x8 = f8 as dynamic;
504 l8 = f8 as dynamic; 482 l8 = f8 as dynamic;
505 x8 = confuse(f8); 483 x8 = confuse(f8);
506 l8 = confuse(f8); 484 l8 = confuse(f8);
507 } 485 }
508 486
509 Expect.isTrue(m8 is F8); 487 Expect.isTrue(m8 is F8);
510 Expect.isTrue(m8 is Function Function(int x1, 488 Expect.isTrue(m8 is Function Function(int x1, {core.List<core.int> x})
511 {core.List<core.int> x}) Function<B extends core.int>(int x)); 489 Function<B extends core.int>(int x));
512 Expect.isTrue(confuse(m8) is F8); 490 Expect.isTrue(confuse(m8) is F8);
513 // In checked mode, verifies the type. 491 // In checked mode, verifies the type.
514 x8 = m8; 492 x8 = m8;
515 l8 = m8; 493 l8 = m8;
516 x8 = confuse(m8); 494 x8 = confuse(m8);
517 l8 = confuse(m8); 495 l8 = confuse(m8);
518 } 496 }
519 497
520 /// List<Function> Function(Function x) Function<B extends core.int>(int x) 498 /// List<Function> Function(Function x) Function<B extends core.int>(int x)
521 void testF9() { 499 void testF9() {
522 Expect.isTrue(f9 is F9); 500 Expect.isTrue(f9 is F9);
523 Expect.isTrue(confuse(f9) is F9); 501 Expect.isTrue(confuse(f9) is F9);
524 // In checked mode, verifies the type. 502 // In checked mode, verifies the type.
525 List<Function> Function(Function x) Function<B extends core.int>(int x) l9; 503 List<Function> Function(Function x) Function<B extends core.int>(int x) l9;
526 // The static function f9 sets `T` to `int`. 504 // The static function f9 sets `T` to `int`.
527 if (!tIsBool) { 505 if (!tIsBool) {
528 x9 = f9 as dynamic; 506 x9 = f9 as dynamic;
529 l9 = f9 as dynamic; 507 l9 = f9 as dynamic;
530 x9 = confuse(f9); 508 x9 = confuse(f9);
531 l9 = confuse(f9); 509 l9 = confuse(f9);
532 } 510 }
533 511
534 Expect.isTrue(m9 is F9); 512 Expect.isTrue(m9 is F9);
535 Expect.isTrue(m9 is List<Function> Function( 513 Expect.isTrue(m9 is List<Function> Function(Function x)
536 Function x) Function<B extends core.int>(int x)); 514 Function<B extends core.int>(int x));
537 Expect.isTrue(confuse(m9) is F9); 515 Expect.isTrue(confuse(m9) is F9);
538 // In checked mode, verifies the type. 516 // In checked mode, verifies the type.
539 x9 = m9; 517 x9 = m9;
540 l9 = m9; 518 l9 = m9;
541 x9 = confuse(m9); 519 x9 = confuse(m9);
542 l9 = confuse(m9); 520 l9 = confuse(m9);
543 } 521 }
544 522
545 /// List<Function> Function(int y, [core.List<core.int> x]) Function<B extends core.int>(int x) 523 /// List<Function> Function(int y, [core.List<core.int> x]) Function<B extends core.int>(int x)
546 void testF10() { 524 void testF10() {
547 Expect.isTrue(f10 is F10); 525 Expect.isTrue(f10 is F10);
548 Expect.isTrue(confuse(f10) is F10); 526 Expect.isTrue(confuse(f10) is F10);
549 // In checked mode, verifies the type. 527 // In checked mode, verifies the type.
550 List<Function> Function(int y, 528 List<Function> Function(int y, [core.List<core.int> x])
551 [core.List<core.int> x]) Function<B extends core.int>(int x) l10; 529 Function<B extends core.int>(int x) l10;
552 // The static function f10 sets `T` to `int`. 530 // The static function f10 sets `T` to `int`.
553 if (!tIsBool) { 531 if (!tIsBool) {
554 x10 = f10 as dynamic; 532 x10 = f10 as dynamic;
555 l10 = f10 as dynamic; 533 l10 = f10 as dynamic;
556 x10 = confuse(f10); 534 x10 = confuse(f10);
557 l10 = confuse(f10); 535 l10 = confuse(f10);
558 } 536 }
559 537
560 Expect.isTrue(m10 is F10); 538 Expect.isTrue(m10 is F10);
561 Expect.isTrue(m10 is List<Function> Function(int y, 539 Expect.isTrue(m10 is List<Function> Function(int y, [core.List<core.int> x])
562 [core.List<core.int> x]) Function<B extends core.int>(int x)); 540 Function<B extends core.int>(int x));
563 Expect.isTrue(confuse(m10) is F10); 541 Expect.isTrue(confuse(m10) is F10);
564 // In checked mode, verifies the type. 542 // In checked mode, verifies the type.
565 x10 = m10; 543 x10 = m10;
566 l10 = m10; 544 l10 = m10;
567 x10 = confuse(m10); 545 x10 = confuse(m10);
568 l10 = confuse(m10); 546 l10 = confuse(m10);
569 } 547 }
570 548
571 /// core.List<core.int> Function([int x1]) Function<B extends core.int>(int x) 549 /// core.List<core.int> Function([int x1]) Function<B extends core.int>(int x)
572 void testF11() { 550 void testF11() {
573 Expect.isTrue(f11 is F11); 551 Expect.isTrue(f11 is F11);
574 Expect.isTrue(confuse(f11) is F11); 552 Expect.isTrue(confuse(f11) is F11);
575 // In checked mode, verifies the type. 553 // In checked mode, verifies the type.
576 core.List<core.int> Function([int x1]) Function<B extends core.int>(int x) 554 core.List<core.int> Function([int x1]) Function<B extends core.int>(int x)
577 l11; 555 l11;
578 // The static function f11 sets `T` to `int`. 556 // The static function f11 sets `T` to `int`.
579 if (!tIsBool) { 557 if (!tIsBool) {
580 x11 = f11 as dynamic; 558 x11 = f11 as dynamic;
581 l11 = f11 as dynamic; 559 l11 = f11 as dynamic;
582 x11 = confuse(f11); 560 x11 = confuse(f11);
583 l11 = confuse(f11); 561 l11 = confuse(f11);
584 } 562 }
585 563
586 Expect.isTrue(m11 is F11); 564 Expect.isTrue(m11 is F11);
587 Expect.isTrue(m11 is core.List<core.int> Function( 565 Expect.isTrue(m11 is core.List<core.int> Function([int x1])
588 [int x1]) Function<B extends core.int>(int x)); 566 Function<B extends core.int>(int x));
589 Expect.isTrue(confuse(m11) is F11); 567 Expect.isTrue(confuse(m11) is F11);
590 // In checked mode, verifies the type. 568 // In checked mode, verifies the type.
591 x11 = m11; 569 x11 = m11;
592 l11 = m11; 570 l11 = m11;
593 x11 = confuse(m11); 571 x11 = confuse(m11);
594 l11 = confuse(m11); 572 l11 = confuse(m11);
595 } 573 }
596 574
597 /// core.List<core.int> Function({List<Function> x}) Function<B extends core.i nt>(int x) 575 /// core.List<core.int> Function({List<Function> x}) Function<B extends core.i nt>(int x)
598 void testF12() { 576 void testF12() {
599 Expect.isTrue(f12 is F12); 577 Expect.isTrue(f12 is F12);
600 Expect.isTrue(confuse(f12) is F12); 578 Expect.isTrue(confuse(f12) is F12);
601 // In checked mode, verifies the type. 579 // In checked mode, verifies the type.
602 core.List<core.int> Function( 580 core.List<core.int> Function({List<Function> x})
603 {List<Function> x}) Function<B extends core.int>(int x) l12; 581 Function<B extends core.int>(int x) l12;
604 // The static function f12 sets `T` to `int`. 582 // The static function f12 sets `T` to `int`.
605 if (!tIsBool) { 583 if (!tIsBool) {
606 x12 = f12 as dynamic; 584 x12 = f12 as dynamic;
607 l12 = f12 as dynamic; 585 l12 = f12 as dynamic;
608 x12 = confuse(f12); 586 x12 = confuse(f12);
609 l12 = confuse(f12); 587 l12 = confuse(f12);
610 } 588 }
611 589
612 Expect.isTrue(m12 is F12); 590 Expect.isTrue(m12 is F12);
613 Expect.isTrue(m12 is core.List<core.int> Function( 591 Expect.isTrue(m12 is core.List<core.int> Function({List<Function> x})
614 {List<Function> x}) Function<B extends core.int>(int x)); 592 Function<B extends core.int>(int x));
615 Expect.isTrue(confuse(m12) is F12); 593 Expect.isTrue(confuse(m12) is F12);
616 // In checked mode, verifies the type. 594 // In checked mode, verifies the type.
617 x12 = m12; 595 x12 = m12;
618 l12 = m12; 596 l12 = m12;
619 x12 = confuse(m12); 597 x12 = confuse(m12);
620 l12 = confuse(m12); 598 l12 = confuse(m12);
621 } 599 }
622 600
623 /// core.List<core.int> Function() Function<B extends core.int>(int x) 601 /// core.List<core.int> Function() Function<B extends core.int>(int x)
624 void testF13() { 602 void testF13() {
625 Expect.isTrue(f13 is F13); 603 Expect.isTrue(f13 is F13);
626 Expect.isTrue(confuse(f13) is F13); 604 Expect.isTrue(confuse(f13) is F13);
627 // In checked mode, verifies the type. 605 // In checked mode, verifies the type.
628 core.List<core.int> Function() Function<B extends core.int>(int x) l13; 606 core.List<core.int> Function() Function<B extends core.int>(int x) l13;
629 // The static function f13 sets `T` to `int`. 607 // The static function f13 sets `T` to `int`.
630 if (!tIsBool) { 608 if (!tIsBool) {
631 x13 = f13 as dynamic; 609 x13 = f13 as dynamic;
632 l13 = f13 as dynamic; 610 l13 = f13 as dynamic;
633 x13 = confuse(f13); 611 x13 = confuse(f13);
634 l13 = confuse(f13); 612 l13 = confuse(f13);
635 } 613 }
636 614
637 Expect.isTrue(m13 is F13); 615 Expect.isTrue(m13 is F13);
638 Expect.isTrue(m13 616 Expect.isTrue(m13 is core.List<core.int> Function()
639 is core.List<core.int> Function() Function<B extends core.int>(int x)); 617 Function<B extends core.int>(int x));
640 Expect.isTrue(confuse(m13) is F13); 618 Expect.isTrue(confuse(m13) is F13);
641 // In checked mode, verifies the type. 619 // In checked mode, verifies the type.
642 x13 = m13; 620 x13 = m13;
643 l13 = m13; 621 l13 = m13;
644 x13 = confuse(m13); 622 x13 = confuse(m13);
645 l13 = confuse(m13); 623 l13 = confuse(m13);
646 } 624 }
647 625
648 /// List<T> Function(int x1, [List<Function> x]) Function<B extends core.int>( int x) 626 /// List<T> Function(int x1, [List<Function> x]) Function<B extends core.int>( int x)
649 void testF14() { 627 void testF14() {
650 Expect.isTrue(f14 is F14); 628 Expect.isTrue(f14 is F14);
651 Expect.isTrue(confuse(f14) is F14); 629 Expect.isTrue(confuse(f14) is F14);
652 // In checked mode, verifies the type. 630 // In checked mode, verifies the type.
653 List<T> Function(int x1, [List<Function> x]) Function<B extends core.int>( 631 List<T> Function(int x1, [List<Function> x]) Function<B extends core.int>(
654 int x) l14; 632 int x) l14;
655 // The static function f14 sets `T` to `int`. 633 // The static function f14 sets `T` to `int`.
656 if (!tIsBool) { 634 if (!tIsBool) {
657 x14 = f14 as dynamic; 635 x14 = f14 as dynamic;
658 l14 = f14 as dynamic; 636 l14 = f14 as dynamic;
659 x14 = confuse(f14); 637 x14 = confuse(f14);
660 l14 = confuse(f14); 638 l14 = confuse(f14);
661 } 639 }
662 640
663 Expect.isTrue(m14 is F14); 641 Expect.isTrue(m14 is F14);
664 Expect.isTrue(m14 is List<T> Function(int x1, 642 Expect.isTrue(m14 is List<T> Function(int x1, [List<Function> x])
665 [List<Function> x]) Function<B extends core.int>(int x)); 643 Function<B extends core.int>(int x));
666 Expect.isTrue(confuse(m14) is F14); 644 Expect.isTrue(confuse(m14) is F14);
667 // In checked mode, verifies the type. 645 // In checked mode, verifies the type.
668 x14 = m14; 646 x14 = m14;
669 l14 = m14; 647 l14 = m14;
670 x14 = confuse(m14); 648 x14 = confuse(m14);
671 l14 = confuse(m14); 649 l14 = confuse(m14);
672 if (!tIsBool) { 650 if (!tIsBool) {
673 Expect.isTrue(f14 is F14<int>); 651 Expect.isTrue(f14 is F14<int>);
674 Expect.isFalse(f14 is F14<bool>); 652 Expect.isFalse(f14 is F14<bool>);
675 Expect.isTrue(confuse(f14) is F14<int>); 653 Expect.isTrue(confuse(f14) is F14<int>);
676 Expect.isFalse(confuse(f14) is F14<bool>); 654 Expect.isFalse(confuse(f14) is F14<bool>);
677 Expect.equals(tIsDynamic, m14 is F14<bool>); 655 Expect.equals(tIsDynamic, m14 is F14<bool>);
678 Expect.equals(tIsDynamic, confuse(m14) is F14<bool>); 656 Expect.equals(tIsDynamic, confuse(m14) is F14<bool>);
679 } else { 657 } else {
680 if (inCheckedMode) { 658 if (typeAssertionsEnabled) {
681 Expect.throws(() { 659 Expect.throws(() {
682 x14 = (f14 as dynamic); 660 x14 = (f14 as dynamic);
683 }); 661 });
684 Expect.throws(() { 662 Expect.throws(() {
685 x14 = confuse(f14); 663 x14 = confuse(f14);
686 }); 664 });
687 List<T> Function(int x1, 665 List<T> Function(int x1, [List<Function> x])
688 [List<Function> x]) Function<B extends core.int>(int x) l14; 666 Function<B extends core.int>(int x) l14;
689 Expect.throws(() { 667 Expect.throws(() {
690 l14 = (f14 as dynamic); 668 l14 = (f14 as dynamic);
691 }); 669 });
692 Expect.throws(() { 670 Expect.throws(() {
693 l14 = confuse(f14); 671 l14 = confuse(f14);
694 }); 672 });
695 } 673 }
696 List<T> Function(int x1, [List<Function> x]) Function<B extends core.int>( 674 List<T> Function(int x1, [List<Function> x]) Function<B extends core.int>(
697 int x) l14 = m14; 675 int x) l14 = m14;
698 // In checked mode, verifies the type. 676 // In checked mode, verifies the type.
(...skipping 10 matching lines...) Expand all
709 List<T> Function([List<T> x1]) Function<B extends core.int>(int x) l15; 687 List<T> Function([List<T> x1]) Function<B extends core.int>(int x) l15;
710 // The static function f15 sets `T` to `int`. 688 // The static function f15 sets `T` to `int`.
711 if (!tIsBool) { 689 if (!tIsBool) {
712 x15 = f15 as dynamic; 690 x15 = f15 as dynamic;
713 l15 = f15 as dynamic; 691 l15 = f15 as dynamic;
714 x15 = confuse(f15); 692 x15 = confuse(f15);
715 l15 = confuse(f15); 693 l15 = confuse(f15);
716 } 694 }
717 695
718 Expect.isTrue(m15 is F15); 696 Expect.isTrue(m15 is F15);
719 Expect.isTrue(m15 is List<T> Function( 697 Expect.isTrue(m15 is List<T> Function([List<T> x1])
720 [List<T> x1]) Function<B extends core.int>(int x)); 698 Function<B extends core.int>(int x));
721 Expect.isTrue(confuse(m15) is F15); 699 Expect.isTrue(confuse(m15) is F15);
722 // In checked mode, verifies the type. 700 // In checked mode, verifies the type.
723 x15 = m15; 701 x15 = m15;
724 l15 = m15; 702 l15 = m15;
725 x15 = confuse(m15); 703 x15 = confuse(m15);
726 l15 = confuse(m15); 704 l15 = confuse(m15);
727 if (!tIsBool) { 705 if (!tIsBool) {
728 Expect.isTrue(f15 is F15<int>); 706 Expect.isTrue(f15 is F15<int>);
729 Expect.isFalse(f15 is F15<bool>); 707 Expect.isFalse(f15 is F15<bool>);
730 Expect.isTrue(confuse(f15) is F15<int>); 708 Expect.isTrue(confuse(f15) is F15<int>);
731 Expect.isFalse(confuse(f15) is F15<bool>); 709 Expect.isFalse(confuse(f15) is F15<bool>);
732 Expect.equals(tIsDynamic, m15 is F15<bool>); 710 Expect.equals(tIsDynamic, m15 is F15<bool>);
733 Expect.equals(tIsDynamic, confuse(m15) is F15<bool>); 711 Expect.equals(tIsDynamic, confuse(m15) is F15<bool>);
734 } else { 712 } else {
735 if (inCheckedMode) { 713 if (typeAssertionsEnabled) {
736 Expect.throws(() { 714 Expect.throws(() {
737 x15 = (f15 as dynamic); 715 x15 = (f15 as dynamic);
738 }); 716 });
739 Expect.throws(() { 717 Expect.throws(() {
740 x15 = confuse(f15); 718 x15 = confuse(f15);
741 }); 719 });
742 List<T> Function([List<T> x1]) Function<B extends core.int>(int x) l15; 720 List<T> Function([List<T> x1]) Function<B extends core.int>(int x) l15;
743 Expect.throws(() { 721 Expect.throws(() {
744 l15 = (f15 as dynamic); 722 l15 = (f15 as dynamic);
745 }); 723 });
(...skipping 17 matching lines...) Expand all
763 Function(int x, [Function x1]) Function<B extends core.int>(int x) l16; 741 Function(int x, [Function x1]) Function<B extends core.int>(int x) l16;
764 // The static function f16 sets `T` to `int`. 742 // The static function f16 sets `T` to `int`.
765 if (!tIsBool) { 743 if (!tIsBool) {
766 x16 = f16 as dynamic; 744 x16 = f16 as dynamic;
767 l16 = f16 as dynamic; 745 l16 = f16 as dynamic;
768 x16 = confuse(f16); 746 x16 = confuse(f16);
769 l16 = confuse(f16); 747 l16 = confuse(f16);
770 } 748 }
771 749
772 Expect.isTrue(m16 is F16); 750 Expect.isTrue(m16 is F16);
773 Expect.isTrue(m16 is Function(int x, 751 Expect.isTrue(m16 is Function(int x, [Function x1])
774 [Function x1]) Function<B extends core.int>(int x)); 752 Function<B extends core.int>(int x));
775 Expect.isTrue(confuse(m16) is F16); 753 Expect.isTrue(confuse(m16) is F16);
776 // In checked mode, verifies the type. 754 // In checked mode, verifies the type.
777 x16 = m16; 755 x16 = m16;
778 l16 = m16; 756 l16 = m16;
779 x16 = confuse(m16); 757 x16 = confuse(m16);
780 l16 = confuse(m16); 758 l16 = confuse(m16);
781 } 759 }
782 760
783 /// Function(int y, {core.List<core.int> x}) Function<B extends core.int>(int x) 761 /// Function(int y, {core.List<core.int> x}) Function<B extends core.int>(int x)
784 void testF17() { 762 void testF17() {
785 Expect.isTrue(f17 is F17); 763 Expect.isTrue(f17 is F17);
786 Expect.isTrue(confuse(f17) is F17); 764 Expect.isTrue(confuse(f17) is F17);
787 // In checked mode, verifies the type. 765 // In checked mode, verifies the type.
788 Function(int y, {core.List<core.int> x}) Function<B extends core.int>(int x) 766 Function(int y, {core.List<core.int> x}) Function<B extends core.int>(int x)
789 l17; 767 l17;
790 // The static function f17 sets `T` to `int`. 768 // The static function f17 sets `T` to `int`.
791 if (!tIsBool) { 769 if (!tIsBool) {
792 x17 = f17 as dynamic; 770 x17 = f17 as dynamic;
793 l17 = f17 as dynamic; 771 l17 = f17 as dynamic;
794 x17 = confuse(f17); 772 x17 = confuse(f17);
795 l17 = confuse(f17); 773 l17 = confuse(f17);
796 } 774 }
797 775
798 Expect.isTrue(m17 is F17); 776 Expect.isTrue(m17 is F17);
799 Expect.isTrue(m17 is Function(int y, 777 Expect.isTrue(m17 is Function(int y, {core.List<core.int> x})
800 {core.List<core.int> x}) Function<B extends core.int>(int x)); 778 Function<B extends core.int>(int x));
801 Expect.isTrue(confuse(m17) is F17); 779 Expect.isTrue(confuse(m17) is F17);
802 // In checked mode, verifies the type. 780 // In checked mode, verifies the type.
803 x17 = m17; 781 x17 = m17;
804 l17 = m17; 782 l17 = m17;
805 x17 = confuse(m17); 783 x17 = confuse(m17);
806 l17 = confuse(m17); 784 l17 = confuse(m17);
807 } 785 }
808 786
809 /// void Function([Function x]) Function<B extends core.int>(int x) 787 /// void Function([Function x]) Function<B extends core.int>(int x)
810 void testF18() { 788 void testF18() {
(...skipping 29 matching lines...) Expand all
840 l19; 818 l19;
841 // The static function f19 sets `T` to `int`. 819 // The static function f19 sets `T` to `int`.
842 if (!tIsBool) { 820 if (!tIsBool) {
843 x19 = f19 as dynamic; 821 x19 = f19 as dynamic;
844 l19 = f19 as dynamic; 822 l19 = f19 as dynamic;
845 x19 = confuse(f19); 823 x19 = confuse(f19);
846 l19 = confuse(f19); 824 l19 = confuse(f19);
847 } 825 }
848 826
849 Expect.isTrue(m19 is F19); 827 Expect.isTrue(m19 is F19);
850 Expect.isTrue(m19 is void Function( 828 Expect.isTrue(m19 is void Function(core.List<core.int> x1)
851 core.List<core.int> x1) Function<B extends core.int>(int x)); 829 Function<B extends core.int>(int x));
852 Expect.isTrue(confuse(m19) is F19); 830 Expect.isTrue(confuse(m19) is F19);
853 // In checked mode, verifies the type. 831 // In checked mode, verifies the type.
854 x19 = m19; 832 x19 = m19;
855 l19 = m19; 833 l19 = m19;
856 x19 = confuse(m19); 834 x19 = confuse(m19);
857 l19 = confuse(m19); 835 l19 = confuse(m19);
858 } 836 }
859 837
860 /// int Function<A>(A x) Function<B extends core.int>(int x) 838 /// int Function<A>(A x) Function<B extends core.int>(int x)
861 void testF20() { 839 void testF20() {
(...skipping 29 matching lines...) Expand all
891 int x) l21; 869 int x) l21;
892 // The static function f21 sets `T` to `int`. 870 // The static function f21 sets `T` to `int`.
893 if (!tIsBool) { 871 if (!tIsBool) {
894 x21 = f21 as dynamic; 872 x21 = f21 as dynamic;
895 l21 = f21 as dynamic; 873 l21 = f21 as dynamic;
896 x21 = confuse(f21); 874 x21 = confuse(f21);
897 l21 = confuse(f21); 875 l21 = confuse(f21);
898 } 876 }
899 877
900 Expect.isTrue(m21 is F21); 878 Expect.isTrue(m21 is F21);
901 Expect.isTrue(m21 is core.List<core.int> Function<A>( 879 Expect.isTrue(m21 is core.List<core.int> Function<A>(List<A> x)
902 List<A> x) Function<B extends core.int>(int x)); 880 Function<B extends core.int>(int x));
903 Expect.isTrue(confuse(m21) is F21); 881 Expect.isTrue(confuse(m21) is F21);
904 // In checked mode, verifies the type. 882 // In checked mode, verifies the type.
905 x21 = m21; 883 x21 = m21;
906 l21 = m21; 884 l21 = m21;
907 x21 = confuse(m21); 885 x21 = confuse(m21);
908 l21 = confuse(m21); 886 l21 = confuse(m21);
909 } 887 }
910 888
911 /// List<A> Function<A>(int x) Function<B extends core.int>(int x) 889 /// List<A> Function<A>(int x) Function<B extends core.int>(int x)
912 void testF22() { 890 void testF22() {
(...skipping 19 matching lines...) Expand all
932 x22 = confuse(m22); 910 x22 = confuse(m22);
933 l22 = confuse(m22); 911 l22 = confuse(m22);
934 } 912 }
935 } 913 }
936 914
937 void main() { 915 void main() {
938 new U59().runTests(); 916 new U59().runTests();
939 new U59<int>(tIsInt: true).runTests(); 917 new U59<int>(tIsInt: true).runTests();
940 new U59<bool>(tIsBool: true).runTests(); 918 new U59<bool>(tIsBool: true).runTests();
941 } 919 }
OLDNEW
« no previous file with comments | « tests/language/function_type/function_type58_test.dart ('k') | tests/language/function_type/function_type5_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698