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

Side by Side Diff: tests/language/function_type/function_type66_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> = int Function(int x) Function<B extends core.int>();
27 27 typedef F5<T> = int Function(int y, [List<Function> x])
28 typedef F0<T> 28 Function<B extends core.int>();
29 = Function Function(int y, {int x}); 29 typedef F6<T> = int Function(int x2, [List<T> x3])
30 typedef F1<T> 30 Function<B extends core.int>();
31 = List<Function> Function(int y, {List<T> x}); 31 typedef F7<T> = Function Function({Function x}) Function<B extends core.int>();
32 typedef F2<T> 32 typedef F8<T> = Function Function(List<T> x) Function<B extends core.int>();
33 = List<T> Function(int x0, {core.List<core.int> x}); 33 typedef F9<T> = List<Function> Function(int x1, [Function x])
34 typedef F3<T> 34 Function<B extends core.int>();
35 = void Function({List<Function> x}); 35 typedef F10<T> = List<Function> Function([core.List<core.int> x1])
36 typedef F4<T> 36 Function<B extends core.int>();
37 = int Function(int x) Function<B extends core.int>(); 37 typedef F11<T> = core.List<core.int> Function(int x, [int x1])
38 typedef F5<T> 38 Function<B extends core.int>();
39 = int Function(int y, [List<Function> x]) Function<B extends core.int>(); 39 typedef F12<T> = core.List<core.int> Function(int y, {List<Function> x})
40 typedef F6<T> 40 Function<B extends core.int>();
41 = int Function(int x2, [List<T> x3]) Function<B extends core.int>(); 41 typedef F13<T> = List<T> Function([int x]) Function<B extends core.int>();
42 typedef F7<T> 42 typedef F14<T> = List<T> Function(List<Function> x1)
43 = Function Function({Function x}) Function<B extends core.int>(); 43 Function<B extends core.int>();
44 typedef F8<T> 44 typedef F15<T> = List<T> Function(int x, [List<T> x1])
45 = Function Function(List<T> x) Function<B extends core.int>(); 45 Function<B extends core.int>();
46 typedef F9<T> 46 typedef F16<T> = Function(int x1, {Function x}) Function<B extends core.int>();
47 = List<Function> Function(int x1, 47 typedef F17<T> = Function([List<T> x]) Function<B extends core.int>();
48 [Function x]) Function<B extends core.int>(); 48 typedef F18<T> = void Function(int y, [Function x])
49 typedef F10<T> 49 Function<B extends core.int>();
50 = List<Function> Function( 50 typedef F19<T> = void Function(int x2, [core.List<core.int> x3])
51 [core.List<core.int> x1]) Function<B extends core.int>(); 51 Function<B extends core.int>();
52 typedef F11<T> 52 typedef F20<T> = Function Function<A>(int x) Function<B extends core.int>();
53 = core.List<core.int> Function(int x, 53 typedef F21<T> = List<T> Function<A>(Function x) Function<B extends core.int>();
54 [int x1]) Function<B extends core.int>(); 54 typedef F22<T> = List<A> Function<A>(List<Function> x)
55 typedef F12<T> 55 Function<B extends core.int>();
56 = core.List<core.int> Function(int y,
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(List<Function> x1) Function<B extends core.int>();
62 typedef F15<T>
63 = List<T> Function(int x, [List<T> x1]) Function<B extends core.int>();
64 typedef F16<T>
65 = Function(int x1, {Function x}) Function<B extends core.int>();
66 typedef F17<T>
67 = Function([List<T> x]) Function<B extends core.int>();
68 typedef F18<T>
69 = void Function(int y, [Function x]) Function<B extends core.int>();
70 typedef F19<T>
71 = void Function(int x2,
72 [core.List<core.int> x3]) Function<B extends core.int>();
73 typedef F20<T>
74 = Function Function<A>(int x) Function<B extends core.int>();
75 typedef F21<T>
76 = List<T> Function<A>(Function x) Function<B extends core.int>();
77 typedef F22<T>
78 = List<A> Function<A>(List<Function> x) Function<B extends core.int>();
79 56
80 Function f0(int y, {int x}) => null; 57 Function f0(int y, {int x}) => null;
81 List<Function> f1(int y, {List<int> x}) => null; 58 List<Function> f1(int y, {List<int> x}) => null;
82 List<int> f2(int x0, {core.List<core.int> x}) => null; 59 List<int> f2(int x0, {core.List<core.int> x}) => null;
83 void f3({List<Function> x}) => null; 60 void f3({List<Function> x}) => null;
84 int Function(int x) f4<B extends core.int>() => null; 61 int Function(int x) f4<B extends core.int>() => null;
85 int Function(int y, [List<Function> x]) f5<B extends core.int>() => null; 62 int Function(int y, [List<Function> x]) f5<B extends core.int>() => null;
86 int Function(int x0, [List<int> x1]) f6<B extends core.int>() => null; 63 int Function(int x0, [List<int> x1]) f6<B extends core.int>() => null;
87 Function Function({Function x}) f7<B extends core.int>() => null; 64 Function Function({Function x}) f7<B extends core.int>() => null;
88 Function Function(List<int> x) f8<B extends core.int>() => null; 65 Function Function(List<int> x) f8<B extends core.int>() => null;
(...skipping 24 matching lines...) Expand all
113 List<Function> Function(int y, {List<T> x}) x1; 90 List<Function> Function(int y, {List<T> x}) x1;
114 List<T> Function(int x0, {core.List<core.int> x}) x2; 91 List<T> Function(int x0, {core.List<core.int> x}) x2;
115 void Function({List<Function> x}) x3; 92 void Function({List<Function> x}) x3;
116 int Function(int x) Function<B extends core.int>() x4; 93 int Function(int x) Function<B extends core.int>() x4;
117 int Function(int y, [List<Function> x]) Function<B extends core.int>() x5; 94 int Function(int y, [List<Function> x]) Function<B extends core.int>() x5;
118 int Function(int x2, [List<T> x3]) Function<B extends core.int>() x6; 95 int Function(int x2, [List<T> x3]) Function<B extends core.int>() x6;
119 Function Function({Function x}) Function<B extends core.int>() x7; 96 Function Function({Function x}) Function<B extends core.int>() x7;
120 Function Function(List<T> x) Function<B extends core.int>() x8; 97 Function Function(List<T> x) Function<B extends core.int>() x8;
121 List<Function> Function(int x1, [Function x]) Function<B extends core.int>() 98 List<Function> Function(int x1, [Function x]) Function<B extends core.int>()
122 x9; 99 x9;
123 List<Function> Function( 100 List<Function> Function([core.List<core.int> x1])
124 [core.List<core.int> x1]) Function<B extends core.int>() x10; 101 Function<B extends core.int>() x10;
125 core.List<core.int> Function(int x, [int x1]) Function<B extends core.int>() 102 core.List<core.int> Function(int x, [int x1]) Function<B extends core.int>()
126 x11; 103 x11;
127 core.List<core.int> Function(int y, 104 core.List<core.int> Function(int y, {List<Function> x})
128 {List<Function> x}) Function<B extends core.int>() x12; 105 Function<B extends core.int>() x12;
129 List<T> Function([int x]) Function<B extends core.int>() x13; 106 List<T> Function([int x]) Function<B extends core.int>() x13;
130 List<T> Function(List<Function> x1) Function<B extends core.int>() x14; 107 List<T> Function(List<Function> x1) Function<B extends core.int>() x14;
131 List<T> Function(int x, [List<T> x1]) Function<B extends core.int>() x15; 108 List<T> Function(int x, [List<T> x1]) Function<B extends core.int>() x15;
132 Function(int x1, {Function x}) Function<B extends core.int>() x16; 109 Function(int x1, {Function x}) Function<B extends core.int>() x16;
133 Function([List<T> x]) Function<B extends core.int>() x17; 110 Function([List<T> x]) Function<B extends core.int>() x17;
134 void Function(int y, [Function x]) Function<B extends core.int>() x18; 111 void Function(int y, [Function x]) Function<B extends core.int>() x18;
135 void Function(int x2, [core.List<core.int> x3]) Function<B extends core.int>() 112 void Function(int x2, [core.List<core.int> x3]) Function<B extends core.int>()
136 x19; 113 x19;
137 Function Function<A>(int x) Function<B extends core.int>() x20; 114 Function Function<A>(int x) Function<B extends core.int>() x20;
138 List<T> Function<A>(Function x) Function<B extends core.int>() x21; 115 List<T> Function<A>(Function x) Function<B extends core.int>() x21;
(...skipping 104 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 y, {List<T> x}) l1; 237 List<Function> Function(int y, {List<T> x}) 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(int x0, {core.List<core.int> x}) l2; 289 List<T> Function(int x0, {core.List<core.int> x}) 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 y, [List<Function> x]) Function<B extends core.int>() l5; 357 int Function(int y, [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 y, 367 Expect.isTrue(m5 is int Function(int y, [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(int x2, [List<T> x3]) Function<B extends core.int>() 377 /// int Function(int x2, [List<T> x3]) Function<B extends core.int>()
401 void testF6() { 378 void testF6() {
402 Expect.isTrue(f6 is F6); 379 Expect.isTrue(f6 is F6);
403 Expect.isTrue(confuse(f6) is F6); 380 Expect.isTrue(confuse(f6) is F6);
404 // In checked mode, verifies the type. 381 // In checked mode, verifies the type.
405 int Function(int x2, [List<T> x3]) Function<B extends core.int>() l6; 382 int Function(int x2, [List<T> x3]) Function<B extends core.int>() l6;
406 // The static function f6 sets `T` to `int`. 383 // The static function f6 sets `T` to `int`.
407 if (!tIsBool) { 384 if (!tIsBool) {
408 x6 = f6 as dynamic; 385 x6 = f6 as dynamic;
409 l6 = f6 as dynamic; 386 l6 = f6 as dynamic;
410 x6 = confuse(f6); 387 x6 = confuse(f6);
411 l6 = confuse(f6); 388 l6 = confuse(f6);
412 } 389 }
413 390
414 Expect.isTrue(m6 is F6); 391 Expect.isTrue(m6 is F6);
415 Expect.isTrue(m6 is int Function(int x2, 392 Expect.isTrue(m6 is int Function(int x2, [List<T> x3])
416 [List<T> x3]) Function<B extends core.int>()); 393 Function<B extends core.int>());
417 Expect.isTrue(confuse(m6) is F6); 394 Expect.isTrue(confuse(m6) is F6);
418 // In checked mode, verifies the type. 395 // In checked mode, verifies the type.
419 x6 = m6; 396 x6 = m6;
420 l6 = m6; 397 l6 = m6;
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(int x2, [List<T> x3]) Function<B extends core.int>() l6; 415 int Function(int x2, [List<T> x3]) 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 x8 = confuse(m8); 476 x8 = confuse(m8);
500 l8 = confuse(m8); 477 l8 = confuse(m8);
501 if (!tIsBool) { 478 if (!tIsBool) {
502 Expect.isTrue(f8 is F8<int>); 479 Expect.isTrue(f8 is F8<int>);
503 Expect.isFalse(f8 is F8<bool>); 480 Expect.isFalse(f8 is F8<bool>);
504 Expect.isTrue(confuse(f8) is F8<int>); 481 Expect.isTrue(confuse(f8) is F8<int>);
505 Expect.isFalse(confuse(f8) is F8<bool>); 482 Expect.isFalse(confuse(f8) is F8<bool>);
506 Expect.equals(tIsDynamic, m8 is F8<bool>); 483 Expect.equals(tIsDynamic, m8 is F8<bool>);
507 Expect.equals(tIsDynamic, confuse(m8) is F8<bool>); 484 Expect.equals(tIsDynamic, confuse(m8) is F8<bool>);
508 } else { 485 } else {
509 if (inCheckedMode) { 486 if (typeAssertionsEnabled) {
510 Expect.throws(() { 487 Expect.throws(() {
511 x8 = (f8 as dynamic); 488 x8 = (f8 as dynamic);
512 }); 489 });
513 Expect.throws(() { 490 Expect.throws(() {
514 x8 = confuse(f8); 491 x8 = confuse(f8);
515 }); 492 });
516 Function Function(List<T> x) Function<B extends core.int>() l8; 493 Function Function(List<T> x) Function<B extends core.int>() l8;
517 Expect.throws(() { 494 Expect.throws(() {
518 l8 = (f8 as dynamic); 495 l8 = (f8 as dynamic);
519 }); 496 });
(...skipping 17 matching lines...) Expand all
537 l9; 514 l9;
538 // The static function f9 sets `T` to `int`. 515 // The static function f9 sets `T` to `int`.
539 if (!tIsBool) { 516 if (!tIsBool) {
540 x9 = f9 as dynamic; 517 x9 = f9 as dynamic;
541 l9 = f9 as dynamic; 518 l9 = f9 as dynamic;
542 x9 = confuse(f9); 519 x9 = confuse(f9);
543 l9 = confuse(f9); 520 l9 = confuse(f9);
544 } 521 }
545 522
546 Expect.isTrue(m9 is F9); 523 Expect.isTrue(m9 is F9);
547 Expect.isTrue(m9 is List<Function> Function(int x1, 524 Expect.isTrue(m9 is List<Function> Function(int x1, [Function x])
548 [Function x]) Function<B extends core.int>()); 525 Function<B extends core.int>());
549 Expect.isTrue(confuse(m9) is F9); 526 Expect.isTrue(confuse(m9) is F9);
550 // In checked mode, verifies the type. 527 // In checked mode, verifies the type.
551 x9 = m9; 528 x9 = m9;
552 l9 = m9; 529 l9 = m9;
553 x9 = confuse(m9); 530 x9 = confuse(m9);
554 l9 = confuse(m9); 531 l9 = confuse(m9);
555 } 532 }
556 533
557 /// List<Function> Function([core.List<core.int> x1]) Function<B extends core. int>() 534 /// List<Function> Function([core.List<core.int> x1]) Function<B extends core. int>()
558 void testF10() { 535 void testF10() {
559 Expect.isTrue(f10 is F10); 536 Expect.isTrue(f10 is F10);
560 Expect.isTrue(confuse(f10) is F10); 537 Expect.isTrue(confuse(f10) is F10);
561 // In checked mode, verifies the type. 538 // In checked mode, verifies the type.
562 List<Function> Function( 539 List<Function> Function([core.List<core.int> x1])
563 [core.List<core.int> x1]) Function<B extends core.int>() l10; 540 Function<B extends core.int>() l10;
564 // The static function f10 sets `T` to `int`. 541 // The static function f10 sets `T` to `int`.
565 if (!tIsBool) { 542 if (!tIsBool) {
566 x10 = f10 as dynamic; 543 x10 = f10 as dynamic;
567 l10 = f10 as dynamic; 544 l10 = f10 as dynamic;
568 x10 = confuse(f10); 545 x10 = confuse(f10);
569 l10 = confuse(f10); 546 l10 = confuse(f10);
570 } 547 }
571 548
572 Expect.isTrue(m10 is F10); 549 Expect.isTrue(m10 is F10);
573 Expect.isTrue(m10 is List<Function> Function( 550 Expect.isTrue(m10 is List<Function> Function([core.List<core.int> x1])
574 [core.List<core.int> x1]) Function<B extends core.int>()); 551 Function<B extends core.int>());
575 Expect.isTrue(confuse(m10) is F10); 552 Expect.isTrue(confuse(m10) is F10);
576 // In checked mode, verifies the type. 553 // In checked mode, verifies the type.
577 x10 = m10; 554 x10 = m10;
578 l10 = m10; 555 l10 = m10;
579 x10 = confuse(m10); 556 x10 = confuse(m10);
580 l10 = confuse(m10); 557 l10 = confuse(m10);
581 } 558 }
582 559
583 /// core.List<core.int> Function(int x, [int x1]) Function<B extends core.int> () 560 /// core.List<core.int> Function(int x, [int x1]) Function<B extends core.int> ()
584 void testF11() { 561 void testF11() {
585 Expect.isTrue(f11 is F11); 562 Expect.isTrue(f11 is F11);
586 Expect.isTrue(confuse(f11) is F11); 563 Expect.isTrue(confuse(f11) is F11);
587 // In checked mode, verifies the type. 564 // In checked mode, verifies the type.
588 core.List<core.int> Function(int x, [int x1]) Function<B extends core.int>() 565 core.List<core.int> Function(int x, [int x1]) Function<B extends core.int>()
589 l11; 566 l11;
590 // The static function f11 sets `T` to `int`. 567 // The static function f11 sets `T` to `int`.
591 if (!tIsBool) { 568 if (!tIsBool) {
592 x11 = f11 as dynamic; 569 x11 = f11 as dynamic;
593 l11 = f11 as dynamic; 570 l11 = f11 as dynamic;
594 x11 = confuse(f11); 571 x11 = confuse(f11);
595 l11 = confuse(f11); 572 l11 = confuse(f11);
596 } 573 }
597 574
598 Expect.isTrue(m11 is F11); 575 Expect.isTrue(m11 is F11);
599 Expect.isTrue(m11 is core.List<core.int> Function(int x, 576 Expect.isTrue(m11 is core.List<core.int> Function(int x, [int x1])
600 [int x1]) Function<B extends core.int>()); 577 Function<B extends core.int>());
601 Expect.isTrue(confuse(m11) is F11); 578 Expect.isTrue(confuse(m11) is F11);
602 // In checked mode, verifies the type. 579 // In checked mode, verifies the type.
603 x11 = m11; 580 x11 = m11;
604 l11 = m11; 581 l11 = m11;
605 x11 = confuse(m11); 582 x11 = confuse(m11);
606 l11 = confuse(m11); 583 l11 = confuse(m11);
607 } 584 }
608 585
609 /// core.List<core.int> Function(int y, {List<Function> x}) Function<B extends core.int>() 586 /// core.List<core.int> Function(int y, {List<Function> x}) Function<B extends core.int>()
610 void testF12() { 587 void testF12() {
611 Expect.isTrue(f12 is F12); 588 Expect.isTrue(f12 is F12);
612 Expect.isTrue(confuse(f12) is F12); 589 Expect.isTrue(confuse(f12) is F12);
613 // In checked mode, verifies the type. 590 // In checked mode, verifies the type.
614 core.List<core.int> Function(int y, 591 core.List<core.int> Function(int y, {List<Function> x})
615 {List<Function> x}) Function<B extends core.int>() l12; 592 Function<B extends core.int>() l12;
616 // The static function f12 sets `T` to `int`. 593 // The static function f12 sets `T` to `int`.
617 if (!tIsBool) { 594 if (!tIsBool) {
618 x12 = f12 as dynamic; 595 x12 = f12 as dynamic;
619 l12 = f12 as dynamic; 596 l12 = f12 as dynamic;
620 x12 = confuse(f12); 597 x12 = confuse(f12);
621 l12 = confuse(f12); 598 l12 = confuse(f12);
622 } 599 }
623 600
624 Expect.isTrue(m12 is F12); 601 Expect.isTrue(m12 is F12);
625 Expect.isTrue(m12 is core.List<core.int> Function(int y, 602 Expect.isTrue(m12 is core.List<core.int> Function(int y, {List<Function> x})
626 {List<Function> x}) Function<B extends core.int>()); 603 Function<B extends core.int>());
627 Expect.isTrue(confuse(m12) is F12); 604 Expect.isTrue(confuse(m12) is F12);
628 // In checked mode, verifies the type. 605 // In checked mode, verifies the type.
629 x12 = m12; 606 x12 = m12;
630 l12 = m12; 607 l12 = m12;
631 x12 = confuse(m12); 608 x12 = confuse(m12);
632 l12 = confuse(m12); 609 l12 = confuse(m12);
633 } 610 }
634 611
635 /// List<T> Function([int x]) Function<B extends core.int>() 612 /// List<T> Function([int x]) Function<B extends core.int>()
636 void testF13() { 613 void testF13() {
(...skipping 19 matching lines...) Expand all
656 x13 = confuse(m13); 633 x13 = confuse(m13);
657 l13 = confuse(m13); 634 l13 = confuse(m13);
658 if (!tIsBool) { 635 if (!tIsBool) {
659 Expect.isTrue(f13 is F13<int>); 636 Expect.isTrue(f13 is F13<int>);
660 Expect.isFalse(f13 is F13<bool>); 637 Expect.isFalse(f13 is F13<bool>);
661 Expect.isTrue(confuse(f13) is F13<int>); 638 Expect.isTrue(confuse(f13) is F13<int>);
662 Expect.isFalse(confuse(f13) is F13<bool>); 639 Expect.isFalse(confuse(f13) is F13<bool>);
663 Expect.equals(tIsDynamic, m13 is F13<bool>); 640 Expect.equals(tIsDynamic, m13 is F13<bool>);
664 Expect.equals(tIsDynamic, confuse(m13) is F13<bool>); 641 Expect.equals(tIsDynamic, confuse(m13) is F13<bool>);
665 } else { 642 } else {
666 if (inCheckedMode) { 643 if (typeAssertionsEnabled) {
667 Expect.throws(() { 644 Expect.throws(() {
668 x13 = (f13 as dynamic); 645 x13 = (f13 as dynamic);
669 }); 646 });
670 Expect.throws(() { 647 Expect.throws(() {
671 x13 = confuse(f13); 648 x13 = confuse(f13);
672 }); 649 });
673 List<T> Function([int x]) Function<B extends core.int>() l13; 650 List<T> Function([int x]) Function<B extends core.int>() l13;
674 Expect.throws(() { 651 Expect.throws(() {
675 l13 = (f13 as dynamic); 652 l13 = (f13 as dynamic);
676 }); 653 });
(...skipping 16 matching lines...) Expand all
693 List<T> Function(List<Function> x1) Function<B extends core.int>() l14; 670 List<T> Function(List<Function> x1) Function<B extends core.int>() l14;
694 // The static function f14 sets `T` to `int`. 671 // The static function f14 sets `T` to `int`.
695 if (!tIsBool) { 672 if (!tIsBool) {
696 x14 = f14 as dynamic; 673 x14 = f14 as dynamic;
697 l14 = f14 as dynamic; 674 l14 = f14 as dynamic;
698 x14 = confuse(f14); 675 x14 = confuse(f14);
699 l14 = confuse(f14); 676 l14 = confuse(f14);
700 } 677 }
701 678
702 Expect.isTrue(m14 is F14); 679 Expect.isTrue(m14 is F14);
703 Expect.isTrue(m14 is List<T> Function( 680 Expect.isTrue(m14 is List<T> Function(List<Function> x1)
704 List<Function> x1) Function<B extends core.int>()); 681 Function<B extends core.int>());
705 Expect.isTrue(confuse(m14) is F14); 682 Expect.isTrue(confuse(m14) is F14);
706 // In checked mode, verifies the type. 683 // In checked mode, verifies the type.
707 x14 = m14; 684 x14 = m14;
708 l14 = m14; 685 l14 = m14;
709 x14 = confuse(m14); 686 x14 = confuse(m14);
710 l14 = confuse(m14); 687 l14 = confuse(m14);
711 if (!tIsBool) { 688 if (!tIsBool) {
712 Expect.isTrue(f14 is F14<int>); 689 Expect.isTrue(f14 is F14<int>);
713 Expect.isFalse(f14 is F14<bool>); 690 Expect.isFalse(f14 is F14<bool>);
714 Expect.isTrue(confuse(f14) is F14<int>); 691 Expect.isTrue(confuse(f14) is F14<int>);
715 Expect.isFalse(confuse(f14) is F14<bool>); 692 Expect.isFalse(confuse(f14) is F14<bool>);
716 Expect.equals(tIsDynamic, m14 is F14<bool>); 693 Expect.equals(tIsDynamic, m14 is F14<bool>);
717 Expect.equals(tIsDynamic, confuse(m14) is F14<bool>); 694 Expect.equals(tIsDynamic, confuse(m14) is F14<bool>);
718 } else { 695 } else {
719 if (inCheckedMode) { 696 if (typeAssertionsEnabled) {
720 Expect.throws(() { 697 Expect.throws(() {
721 x14 = (f14 as dynamic); 698 x14 = (f14 as dynamic);
722 }); 699 });
723 Expect.throws(() { 700 Expect.throws(() {
724 x14 = confuse(f14); 701 x14 = confuse(f14);
725 }); 702 });
726 List<T> Function(List<Function> x1) Function<B extends core.int>() l14; 703 List<T> Function(List<Function> x1) Function<B extends core.int>() l14;
727 Expect.throws(() { 704 Expect.throws(() {
728 l14 = (f14 as dynamic); 705 l14 = (f14 as dynamic);
729 }); 706 });
(...skipping 17 matching lines...) Expand all
747 List<T> Function(int x, [List<T> x1]) Function<B extends core.int>() l15; 724 List<T> Function(int x, [List<T> x1]) Function<B extends core.int>() l15;
748 // The static function f15 sets `T` to `int`. 725 // The static function f15 sets `T` to `int`.
749 if (!tIsBool) { 726 if (!tIsBool) {
750 x15 = f15 as dynamic; 727 x15 = f15 as dynamic;
751 l15 = f15 as dynamic; 728 l15 = f15 as dynamic;
752 x15 = confuse(f15); 729 x15 = confuse(f15);
753 l15 = confuse(f15); 730 l15 = confuse(f15);
754 } 731 }
755 732
756 Expect.isTrue(m15 is F15); 733 Expect.isTrue(m15 is F15);
757 Expect.isTrue(m15 is List<T> Function(int x, 734 Expect.isTrue(m15 is List<T> Function(int x, [List<T> x1])
758 [List<T> x1]) Function<B extends core.int>()); 735 Function<B extends core.int>());
759 Expect.isTrue(confuse(m15) is F15); 736 Expect.isTrue(confuse(m15) is F15);
760 // In checked mode, verifies the type. 737 // In checked mode, verifies the type.
761 x15 = m15; 738 x15 = m15;
762 l15 = m15; 739 l15 = m15;
763 x15 = confuse(m15); 740 x15 = confuse(m15);
764 l15 = confuse(m15); 741 l15 = confuse(m15);
765 if (!tIsBool) { 742 if (!tIsBool) {
766 Expect.isTrue(f15 is F15<int>); 743 Expect.isTrue(f15 is F15<int>);
767 Expect.isFalse(f15 is F15<bool>); 744 Expect.isFalse(f15 is F15<bool>);
768 Expect.isTrue(confuse(f15) is F15<int>); 745 Expect.isTrue(confuse(f15) is F15<int>);
769 Expect.isFalse(confuse(f15) is F15<bool>); 746 Expect.isFalse(confuse(f15) is F15<bool>);
770 Expect.equals(tIsDynamic, m15 is F15<bool>); 747 Expect.equals(tIsDynamic, m15 is F15<bool>);
771 Expect.equals(tIsDynamic, confuse(m15) is F15<bool>); 748 Expect.equals(tIsDynamic, confuse(m15) is F15<bool>);
772 } else { 749 } else {
773 if (inCheckedMode) { 750 if (typeAssertionsEnabled) {
774 Expect.throws(() { 751 Expect.throws(() {
775 x15 = (f15 as dynamic); 752 x15 = (f15 as dynamic);
776 }); 753 });
777 Expect.throws(() { 754 Expect.throws(() {
778 x15 = confuse(f15); 755 x15 = confuse(f15);
779 }); 756 });
780 List<T> Function(int x, [List<T> x1]) Function<B extends core.int>() 757 List<T> Function(int x, [List<T> x1]) Function<B extends core.int>()
781 l15; 758 l15;
782 Expect.throws(() { 759 Expect.throws(() {
783 l15 = (f15 as dynamic); 760 l15 = (f15 as dynamic);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
842 x17 = confuse(m17); 819 x17 = confuse(m17);
843 l17 = confuse(m17); 820 l17 = confuse(m17);
844 if (!tIsBool) { 821 if (!tIsBool) {
845 Expect.isTrue(f17 is F17<int>); 822 Expect.isTrue(f17 is F17<int>);
846 Expect.isFalse(f17 is F17<bool>); 823 Expect.isFalse(f17 is F17<bool>);
847 Expect.isTrue(confuse(f17) is F17<int>); 824 Expect.isTrue(confuse(f17) is F17<int>);
848 Expect.isFalse(confuse(f17) is F17<bool>); 825 Expect.isFalse(confuse(f17) is F17<bool>);
849 Expect.equals(tIsDynamic, m17 is F17<bool>); 826 Expect.equals(tIsDynamic, m17 is F17<bool>);
850 Expect.equals(tIsDynamic, confuse(m17) is F17<bool>); 827 Expect.equals(tIsDynamic, confuse(m17) is F17<bool>);
851 } else { 828 } else {
852 if (inCheckedMode) { 829 if (typeAssertionsEnabled) {
853 Expect.throws(() { 830 Expect.throws(() {
854 x17 = (f17 as dynamic); 831 x17 = (f17 as dynamic);
855 }); 832 });
856 Expect.throws(() { 833 Expect.throws(() {
857 x17 = confuse(f17); 834 x17 = confuse(f17);
858 }); 835 });
859 Function([List<T> x]) Function<B extends core.int>() l17; 836 Function([List<T> x]) Function<B extends core.int>() l17;
860 Expect.throws(() { 837 Expect.throws(() {
861 l17 = (f17 as dynamic); 838 l17 = (f17 as dynamic);
862 }); 839 });
(...skipping 16 matching lines...) Expand all
879 void Function(int y, [Function x]) Function<B extends core.int>() l18; 856 void Function(int y, [Function x]) Function<B extends core.int>() l18;
880 // The static function f18 sets `T` to `int`. 857 // The static function f18 sets `T` to `int`.
881 if (!tIsBool) { 858 if (!tIsBool) {
882 x18 = f18 as dynamic; 859 x18 = f18 as dynamic;
883 l18 = f18 as dynamic; 860 l18 = f18 as dynamic;
884 x18 = confuse(f18); 861 x18 = confuse(f18);
885 l18 = confuse(f18); 862 l18 = confuse(f18);
886 } 863 }
887 864
888 Expect.isTrue(m18 is F18); 865 Expect.isTrue(m18 is F18);
889 Expect.isTrue(m18 is void Function(int y, 866 Expect.isTrue(m18 is void Function(int y, [Function x])
890 [Function x]) Function<B extends core.int>()); 867 Function<B extends core.int>());
891 Expect.isTrue(confuse(m18) is F18); 868 Expect.isTrue(confuse(m18) is F18);
892 // In checked mode, verifies the type. 869 // In checked mode, verifies the type.
893 x18 = m18; 870 x18 = m18;
894 l18 = m18; 871 l18 = m18;
895 x18 = confuse(m18); 872 x18 = confuse(m18);
896 l18 = confuse(m18); 873 l18 = confuse(m18);
897 } 874 }
898 875
899 /// void Function(int x2, [core.List<core.int> x3]) Function<B extends core.in t>() 876 /// void Function(int x2, [core.List<core.int> x3]) Function<B extends core.in t>()
900 void testF19() { 877 void testF19() {
901 Expect.isTrue(f19 is F19); 878 Expect.isTrue(f19 is F19);
902 Expect.isTrue(confuse(f19) is F19); 879 Expect.isTrue(confuse(f19) is F19);
903 // In checked mode, verifies the type. 880 // In checked mode, verifies the type.
904 void Function(int x2, 881 void Function(int x2, [core.List<core.int> x3])
905 [core.List<core.int> x3]) Function<B extends core.int>() l19; 882 Function<B extends core.int>() l19;
906 // The static function f19 sets `T` to `int`. 883 // The static function f19 sets `T` to `int`.
907 if (!tIsBool) { 884 if (!tIsBool) {
908 x19 = f19 as dynamic; 885 x19 = f19 as dynamic;
909 l19 = f19 as dynamic; 886 l19 = f19 as dynamic;
910 x19 = confuse(f19); 887 x19 = confuse(f19);
911 l19 = confuse(f19); 888 l19 = confuse(f19);
912 } 889 }
913 890
914 Expect.isTrue(m19 is F19); 891 Expect.isTrue(m19 is F19);
915 Expect.isTrue(m19 is void Function(int x2, 892 Expect.isTrue(m19 is void Function(int x2, [core.List<core.int> x3])
916 [core.List<core.int> x3]) Function<B extends core.int>()); 893 Function<B extends core.int>());
917 Expect.isTrue(confuse(m19) is F19); 894 Expect.isTrue(confuse(m19) is F19);
918 // In checked mode, verifies the type. 895 // In checked mode, verifies the type.
919 x19 = m19; 896 x19 = m19;
920 l19 = m19; 897 l19 = m19;
921 x19 = confuse(m19); 898 x19 = confuse(m19);
922 l19 = confuse(m19); 899 l19 = confuse(m19);
923 } 900 }
924 901
925 /// Function Function<A>(int x) Function<B extends core.int>() 902 /// Function Function<A>(int x) Function<B extends core.int>()
926 void testF20() { 903 void testF20() {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
971 x21 = confuse(m21); 948 x21 = confuse(m21);
972 l21 = confuse(m21); 949 l21 = confuse(m21);
973 if (!tIsBool) { 950 if (!tIsBool) {
974 Expect.isTrue(f21 is F21<int>); 951 Expect.isTrue(f21 is F21<int>);
975 Expect.isFalse(f21 is F21<bool>); 952 Expect.isFalse(f21 is F21<bool>);
976 Expect.isTrue(confuse(f21) is F21<int>); 953 Expect.isTrue(confuse(f21) is F21<int>);
977 Expect.isFalse(confuse(f21) is F21<bool>); 954 Expect.isFalse(confuse(f21) is F21<bool>);
978 Expect.equals(tIsDynamic, m21 is F21<bool>); 955 Expect.equals(tIsDynamic, m21 is F21<bool>);
979 Expect.equals(tIsDynamic, confuse(m21) is F21<bool>); 956 Expect.equals(tIsDynamic, confuse(m21) is F21<bool>);
980 } else { 957 } else {
981 if (inCheckedMode) { 958 if (typeAssertionsEnabled) {
982 Expect.throws(() { 959 Expect.throws(() {
983 x21 = (f21 as dynamic); 960 x21 = (f21 as dynamic);
984 }); 961 });
985 Expect.throws(() { 962 Expect.throws(() {
986 x21 = confuse(f21); 963 x21 = confuse(f21);
987 }); 964 });
988 List<T> Function<A>(Function x) Function<B extends core.int>() l21; 965 List<T> Function<A>(Function x) Function<B extends core.int>() l21;
989 Expect.throws(() { 966 Expect.throws(() {
990 l21 = (f21 as dynamic); 967 l21 = (f21 as dynamic);
991 }); 968 });
(...skipping 16 matching lines...) Expand all
1008 List<A> Function<A>(List<Function> x) Function<B extends core.int>() l22; 985 List<A> Function<A>(List<Function> x) Function<B extends core.int>() l22;
1009 // The static function f22 sets `T` to `int`. 986 // The static function f22 sets `T` to `int`.
1010 if (!tIsBool) { 987 if (!tIsBool) {
1011 x22 = f22 as dynamic; 988 x22 = f22 as dynamic;
1012 l22 = f22 as dynamic; 989 l22 = f22 as dynamic;
1013 x22 = confuse(f22); 990 x22 = confuse(f22);
1014 l22 = confuse(f22); 991 l22 = confuse(f22);
1015 } 992 }
1016 993
1017 Expect.isTrue(m22 is F22); 994 Expect.isTrue(m22 is F22);
1018 Expect.isTrue(m22 is List<A> Function<A>( 995 Expect.isTrue(m22 is List<A> Function<A>(List<Function> x)
1019 List<Function> x) Function<B extends core.int>()); 996 Function<B extends core.int>());
1020 Expect.isTrue(confuse(m22) is F22); 997 Expect.isTrue(confuse(m22) is F22);
1021 // In checked mode, verifies the type. 998 // In checked mode, verifies the type.
1022 x22 = m22; 999 x22 = m22;
1023 l22 = m22; 1000 l22 = m22;
1024 x22 = confuse(m22); 1001 x22 = confuse(m22);
1025 l22 = confuse(m22); 1002 l22 = confuse(m22);
1026 } 1003 }
1027 } 1004 }
1028 1005
1029 void main() { 1006 void main() {
1030 new U66().runTests(); 1007 new U66().runTests();
1031 new U66<int>(tIsInt: true).runTests(); 1008 new U66<int>(tIsInt: true).runTests();
1032 new U66<bool>(tIsBool: true).runTests(); 1009 new U66<bool>(tIsBool: true).runTests();
1033 } 1010 }
OLDNEW
« no previous file with comments | « tests/language/function_type/function_type65_test.dart ('k') | tests/language/function_type/function_type67_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698