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

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

Powered by Google App Engine
This is Rietveld 408576698