OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013, the Dart project authors. | 2 * Copyright (c) 2013, the Dart project authors. |
3 * | 3 * |
4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except | 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except |
5 * in compliance with the License. You may obtain a copy of the License at | 5 * in compliance with the License. You may obtain a copy of the License at |
6 * | 6 * |
7 * http://www.eclipse.org/legal/epl-v10.html | 7 * http://www.eclipse.org/legal/epl-v10.html |
8 * | 8 * |
9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License | 9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License |
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express | 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 " foo.x = true;", | 292 " foo.x = true;", |
293 "}")); | 293 "}")); |
294 addNamedSource("/lib1.dart", createSource(// | 294 addNamedSource("/lib1.dart", createSource(// |
295 "library lib1;", | 295 "library lib1;", |
296 "bool x = false;")); | 296 "bool x = false;")); |
297 resolve(source); | 297 resolve(source); |
298 assertNoErrors(source); | 298 assertNoErrors(source); |
299 verify(source); | 299 verify(source); |
300 } | 300 } |
301 | 301 |
| 302 public void test_async_dynamic_with_return() throws Exception { |
| 303 Source source = addSource(createSource(// |
| 304 "dynamic f() async {", |
| 305 " return;", |
| 306 "}")); |
| 307 resolve(source); |
| 308 assertNoErrors(source); |
| 309 verify(source); |
| 310 } |
| 311 |
| 312 public void test_async_dynamic_with_return_value() throws Exception { |
| 313 Source source = addSource(createSource(// |
| 314 "dynamic f() async {", |
| 315 " return 5;", |
| 316 "}")); |
| 317 resolve(source); |
| 318 assertNoErrors(source); |
| 319 verify(source); |
| 320 } |
| 321 |
| 322 public void test_async_dynamic_without_return() throws Exception { |
| 323 Source source = addSource(createSource(// |
| 324 "dynamic f() async {}")); |
| 325 resolve(source); |
| 326 assertNoErrors(source); |
| 327 verify(source); |
| 328 } |
| 329 |
| 330 public void test_async_expression_function_type() throws Exception { |
| 331 Source source = addSource(createSource(// |
| 332 "import 'dart:async';", |
| 333 "typedef Future<int> F(int i);", |
| 334 "main() {", |
| 335 " F f = (int i) async => i;", |
| 336 "}")); |
| 337 resolve(source); |
| 338 assertNoErrors(source); |
| 339 verify(source); |
| 340 } |
| 341 |
| 342 public void test_async_flattened() throws Exception { |
| 343 Source source = addSource(createSource(// |
| 344 "import 'dart:async';", |
| 345 "typedef Future<int> CreatesFutureInt();", |
| 346 "main() {", |
| 347 " CreatesFutureInt createFutureInt = () async => f();", |
| 348 " Future<int> futureInt = createFutureInt();", |
| 349 " futureInt.then((int i) => g(i));", |
| 350 "}", |
| 351 "Future<int> f() => null;", |
| 352 "void g(x) {}")); |
| 353 resolve(source); |
| 354 assertNoErrors(source); |
| 355 verify(source); |
| 356 } |
| 357 |
| 358 public void test_async_future_dynamic_with_return() throws Exception { |
| 359 Source source = addSource(createSource(// |
| 360 "import 'dart:async';", |
| 361 "Future<dynamic> f() async {", |
| 362 " return;", |
| 363 "}")); |
| 364 resolve(source); |
| 365 assertNoErrors(source); |
| 366 verify(source); |
| 367 } |
| 368 |
| 369 public void test_async_future_dynamic_with_return_value() throws Exception { |
| 370 Source source = addSource(createSource(// |
| 371 "import 'dart:async';", |
| 372 "Future<dynamic> f() async {", |
| 373 " return 5;", |
| 374 "}")); |
| 375 resolve(source); |
| 376 assertNoErrors(source); |
| 377 verify(source); |
| 378 } |
| 379 |
| 380 public void test_async_future_dynamic_without_return() throws Exception { |
| 381 Source source = addSource(createSource(// |
| 382 "import 'dart:async';", |
| 383 "Future<dynamic> f() async {}")); |
| 384 resolve(source); |
| 385 assertNoErrors(source); |
| 386 verify(source); |
| 387 } |
| 388 |
| 389 public void test_async_future_int_with_return_future_int() throws Exception { |
| 390 Source source = addSource(createSource(// |
| 391 "import 'dart:async';", |
| 392 "Future<int> f() async {", |
| 393 " return new Future<int>.value(5);", |
| 394 "}")); |
| 395 resolve(source); |
| 396 assertNoErrors(source); |
| 397 verify(source); |
| 398 } |
| 399 |
| 400 public void test_async_future_int_with_return_value() throws Exception { |
| 401 Source source = addSource(createSource(// |
| 402 "import 'dart:async';", |
| 403 "Future<int> f() async {", |
| 404 " return 5;", |
| 405 "}")); |
| 406 resolve(source); |
| 407 assertNoErrors(source); |
| 408 verify(source); |
| 409 } |
| 410 |
| 411 public void test_async_future_null_with_return() throws Exception { |
| 412 Source source = addSource(createSource(// |
| 413 "import 'dart:async';", |
| 414 "Future<Null> f() async {", |
| 415 " return;", |
| 416 "}")); |
| 417 resolve(source); |
| 418 assertNoErrors(source); |
| 419 verify(source); |
| 420 } |
| 421 |
| 422 public void test_async_future_null_without_return() throws Exception { |
| 423 Source source = addSource(createSource(// |
| 424 "import 'dart:async';", |
| 425 "Future<Null> f() async {}")); |
| 426 resolve(source); |
| 427 assertNoErrors(source); |
| 428 verify(source); |
| 429 } |
| 430 |
| 431 public void test_async_future_object_with_return() throws Exception { |
| 432 Source source = addSource(createSource(// |
| 433 "import 'dart:async';", |
| 434 "Future<Object> f() async {", |
| 435 " return;", |
| 436 "}")); |
| 437 resolve(source); |
| 438 assertNoErrors(source); |
| 439 verify(source); |
| 440 } |
| 441 |
| 442 public void test_async_future_object_with_return_value() throws Exception { |
| 443 Source source = addSource(createSource(// |
| 444 "import 'dart:async';", |
| 445 "Future<Object> f() async {", |
| 446 " return 5;", |
| 447 "}")); |
| 448 resolve(source); |
| 449 assertNoErrors(source); |
| 450 verify(source); |
| 451 } |
| 452 |
| 453 public void test_async_future_object_without_return() throws Exception { |
| 454 Source source = addSource(createSource(// |
| 455 "import 'dart:async';", |
| 456 "Future<Object> f() async {}")); |
| 457 resolve(source); |
| 458 assertNoErrors(source); |
| 459 verify(source); |
| 460 } |
| 461 |
| 462 public void test_async_future_with_return() throws Exception { |
| 463 Source source = addSource(createSource(// |
| 464 "import 'dart:async';", |
| 465 "Future f() async {", |
| 466 " return;", |
| 467 "}")); |
| 468 resolve(source); |
| 469 assertNoErrors(source); |
| 470 verify(source); |
| 471 } |
| 472 |
| 473 public void test_async_future_with_return_value() throws Exception { |
| 474 Source source = addSource(createSource(// |
| 475 "import 'dart:async';", |
| 476 "Future f() async {", |
| 477 " return 5;", |
| 478 "}")); |
| 479 resolve(source); |
| 480 assertNoErrors(source); |
| 481 verify(source); |
| 482 } |
| 483 |
| 484 public void test_async_future_without_return() throws Exception { |
| 485 Source source = addSource(createSource(// |
| 486 "import 'dart:async';", |
| 487 "Future f() async {}")); |
| 488 resolve(source); |
| 489 assertNoErrors(source); |
| 490 verify(source); |
| 491 } |
| 492 |
| 493 public void test_async_return_flattens_futures() throws Exception { |
| 494 Source source = addSource(createSource(// |
| 495 "import 'dart:async';", |
| 496 "Future<int> f() async {", |
| 497 " return g();", |
| 498 "}", |
| 499 "Future<Future<int>> g() => null;")); |
| 500 resolve(source); |
| 501 assertNoErrors(source); |
| 502 verify(source); |
| 503 } |
| 504 |
| 505 public void test_async_with_return() throws Exception { |
| 506 Source source = addSource(createSource(// |
| 507 "f() async {", |
| 508 " return;", |
| 509 "}")); |
| 510 resolve(source); |
| 511 assertNoErrors(source); |
| 512 verify(source); |
| 513 } |
| 514 |
| 515 public void test_async_with_return_value() throws Exception { |
| 516 Source source = addSource(createSource(// |
| 517 "f() async {", |
| 518 " return 5;", |
| 519 "}")); |
| 520 resolve(source); |
| 521 assertNoErrors(source); |
| 522 verify(source); |
| 523 } |
| 524 |
| 525 public void test_async_without_return() throws Exception { |
| 526 Source source = addSource(createSource(// |
| 527 "f() async {}")); |
| 528 resolve(source); |
| 529 assertNoErrors(source); |
| 530 verify(source); |
| 531 } |
| 532 |
302 public void test_asyncForInWrongContext_async() throws Exception { | 533 public void test_asyncForInWrongContext_async() throws Exception { |
303 resetWithAsync(); | 534 resetWithAsync(); |
304 Source source = addSource(createSource(// | 535 Source source = addSource(createSource(// |
305 "f(list) async {", | 536 "f(list) async {", |
306 " await for (var e in list) {", | 537 " await for (var e in list) {", |
307 " }", | 538 " }", |
308 "}")); | 539 "}")); |
309 resolve(source); | 540 resolve(source); |
310 assertNoErrors(source); | 541 assertNoErrors(source); |
311 verify(source); | 542 verify(source); |
312 } | 543 } |
313 | 544 |
314 public void test_asyncForInWrongContext_asyncStar() throws Exception { | 545 public void test_asyncForInWrongContext_asyncStar() throws Exception { |
315 resetWithAsync(); | 546 resetWithAsync(); |
316 Source source = addSource(createSource(// | 547 Source source = addSource(createSource(// |
317 "f(list) async* {", | 548 "f(list) async* {", |
318 " await for (var e in list) {", | 549 " await for (var e in list) {", |
319 " }", | 550 " }", |
320 "}")); | 551 "}")); |
321 resolve(source); | 552 resolve(source); |
322 assertNoErrors(source); | 553 assertNoErrors(source); |
323 verify(source); | 554 verify(source); |
324 } | 555 } |
325 | 556 |
| 557 public void test_await_flattened() throws Exception { |
| 558 Source source = addSource(createSource(// |
| 559 "import 'dart:async';", |
| 560 "Future<Future<int>> ffi() => null;", |
| 561 "f() async {", |
| 562 " int b = await ffi();", |
| 563 "}")); |
| 564 resolve(source); |
| 565 assertNoErrors(source); |
| 566 verify(source); |
| 567 } |
| 568 |
| 569 public void test_await_simple() throws Exception { |
| 570 Source source = addSource(createSource(// |
| 571 "import 'dart:async';", |
| 572 "Future<int> fi() => null;", |
| 573 "f() async {", |
| 574 " int a = await fi();", |
| 575 "}")); |
| 576 resolve(source); |
| 577 assertNoErrors(source); |
| 578 verify(source); |
| 579 } |
| 580 |
326 public void test_awaitInWrongContext_async() throws Exception { | 581 public void test_awaitInWrongContext_async() throws Exception { |
327 resetWithAsync(); | 582 resetWithAsync(); |
328 Source source = addSource(createSource(// | 583 Source source = addSource(createSource(// |
329 "f(x, y) async {", | 584 "f(x, y) async {", |
330 " return await x + await y;", | 585 " return await x + await y;", |
331 "}")); | 586 "}")); |
332 resolve(source); | 587 resolve(source); |
333 assertNoErrors(source); | 588 assertNoErrors(source); |
334 verify(source); | 589 verify(source); |
335 } | 590 } |
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1019 public void test_dynamicIdentifier() throws Exception { | 1274 public void test_dynamicIdentifier() throws Exception { |
1020 Source source = addSource(createSource(// | 1275 Source source = addSource(createSource(// |
1021 "main() {", | 1276 "main() {", |
1022 " var v = dynamic;", | 1277 " var v = dynamic;", |
1023 "}")); | 1278 "}")); |
1024 resolve(source); | 1279 resolve(source); |
1025 assertNoErrors(source); | 1280 assertNoErrors(source); |
1026 verify(source); | 1281 verify(source); |
1027 } | 1282 } |
1028 | 1283 |
| 1284 public void test_empty_generator_async() throws Exception { |
| 1285 Source source = addSource(createSource(// |
| 1286 "import 'dart:async';", |
| 1287 "Stream<int> f() async* {", |
| 1288 "}")); |
| 1289 resolve(source); |
| 1290 assertNoErrors(source); |
| 1291 verify(source); |
| 1292 } |
| 1293 |
1029 public void test_expectedOneListTypeArgument() throws Exception { | 1294 public void test_expectedOneListTypeArgument() throws Exception { |
1030 Source source = addSource(createSource(// | 1295 Source source = addSource(createSource(// |
1031 "main() {", | 1296 "main() {", |
1032 " <int> [];", | 1297 " <int> [];", |
1033 "}")); | 1298 "}")); |
1034 resolve(source); | 1299 resolve(source); |
1035 assertNoErrors(source); | 1300 assertNoErrors(source); |
1036 verify(source); | 1301 verify(source); |
1037 } | 1302 } |
1038 | 1303 |
(...skipping 1424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2463 resolve(new String[] {createSource(// | 2728 resolve(new String[] {createSource(// |
2464 "library lib1;", | 2729 "library lib1;", |
2465 "foo() => 22;"), // | 2730 "foo() => 22;"), // |
2466 createSource(// | 2731 createSource(// |
2467 "import 'lib1.dart' deferred as other;", | 2732 "import 'lib1.dart' deferred as other;", |
2468 "main() {", | 2733 "main() {", |
2469 " other.loadLibrary().then((_) => other.foo());", | 2734 " other.loadLibrary().then((_) => other.foo());", |
2470 "}")}, new ErrorCode[] {}); | 2735 "}")}, new ErrorCode[] {}); |
2471 } | 2736 } |
2472 | 2737 |
| 2738 public void test_local_generator_async() throws Exception { |
| 2739 Source source = addSource(createSource(// |
| 2740 "f() {", |
| 2741 " return () async* { yield 0; };", |
| 2742 "}")); |
| 2743 resolve(source); |
| 2744 assertNoErrors(source); |
| 2745 verify(source); |
| 2746 } |
| 2747 |
| 2748 public void test_local_generator_sync() throws Exception { |
| 2749 Source source = addSource(createSource(// |
| 2750 "f() {", |
| 2751 " return () sync* { yield 0; };", |
| 2752 "}")); |
| 2753 resolve(source); |
| 2754 assertNoErrors(source); |
| 2755 verify(source); |
| 2756 } |
| 2757 |
2473 public void test_mapKeyTypeNotAssignable() throws Exception { | 2758 public void test_mapKeyTypeNotAssignable() throws Exception { |
2474 Source source = addSource(createSource(// | 2759 Source source = addSource(createSource(// |
2475 "var v = <String, int > {'a' : 1};")); | 2760 "var v = <String, int > {'a' : 1};")); |
2476 resolve(source); | 2761 resolve(source); |
2477 assertNoErrors(source); | 2762 assertNoErrors(source); |
2478 verify(source); | 2763 verify(source); |
2479 } | 2764 } |
2480 | 2765 |
2481 public void test_memberWithClassName_setter() throws Exception { | 2766 public void test_memberWithClassName_setter() throws Exception { |
2482 Source source = addSource(createSource(// | 2767 Source source = addSource(createSource(// |
(...skipping 1231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3714 "class A {", | 3999 "class A {", |
3715 " void m() {", | 4000 " void m() {", |
3716 " try {} catch (e) {rethrow;}", | 4001 " try {} catch (e) {rethrow;}", |
3717 " }", | 4002 " }", |
3718 "}")); | 4003 "}")); |
3719 resolve(source); | 4004 resolve(source); |
3720 assertNoErrors(source); | 4005 assertNoErrors(source); |
3721 verify(source); | 4006 verify(source); |
3722 } | 4007 } |
3723 | 4008 |
| 4009 public void test_return_in_generator_async() throws Exception { |
| 4010 Source source = addSource(createSource(// |
| 4011 "import 'dart:async';", |
| 4012 "Stream<int> f() async* {", |
| 4013 " return;", |
| 4014 "}")); |
| 4015 resolve(source); |
| 4016 assertNoErrors(source); |
| 4017 verify(source); |
| 4018 } |
| 4019 |
| 4020 public void test_return_in_generator_sync() throws Exception { |
| 4021 Source source = addSource(createSource(// |
| 4022 "Iterable<int> f() sync* {", |
| 4023 " return;", |
| 4024 "}")); |
| 4025 resolve(source); |
| 4026 assertNoErrors(source); |
| 4027 verify(source); |
| 4028 } |
| 4029 |
3724 public void test_returnInGenerativeConstructor() throws Exception { | 4030 public void test_returnInGenerativeConstructor() throws Exception { |
3725 Source source = addSource(createSource(// | 4031 Source source = addSource(createSource(// |
3726 "class A {", | 4032 "class A {", |
3727 " A() { return; }", | 4033 " A() { return; }", |
3728 "}")); | 4034 "}")); |
3729 resolve(source); | 4035 resolve(source); |
3730 assertNoErrors(source); | 4036 assertNoErrors(source); |
3731 verify(source); | 4037 verify(source); |
3732 } | 4038 } |
3733 | 4039 |
(...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4666 public void test_wrongNumberOfParametersForSetter() throws Exception { | 4972 public void test_wrongNumberOfParametersForSetter() throws Exception { |
4667 Source source = addSource(createSource(// | 4973 Source source = addSource(createSource(// |
4668 "class A {", | 4974 "class A {", |
4669 " set x(a) {}", | 4975 " set x(a) {}", |
4670 "}")); | 4976 "}")); |
4671 resolve(source); | 4977 resolve(source); |
4672 assertNoErrors(source); | 4978 assertNoErrors(source); |
4673 verify(source); | 4979 verify(source); |
4674 } | 4980 } |
4675 | 4981 |
4676 public void test_yieldEachInNonGenerator_asyncStar() throws Exception { | 4982 public void test_yield_async_to_dynamic_type() throws Exception { |
4677 resetWithAsync(); | 4983 Source source = addSource(createSource(// |
4678 Source source = addSource(createSource(// | 4984 "dynamic f() async* {", |
4679 "f() async* {", | 4985 " yield 3;", |
4680 " yield* 0;", | 4986 "}")); |
4681 "}")); | 4987 resolve(source); |
4682 resolve(source); | 4988 assertNoErrors(source); |
4683 assertNoErrors(source); | 4989 verify(source); |
4684 verify(source); | 4990 } |
4685 } | 4991 |
4686 | 4992 public void test_yield_async_to_generic_type() throws Exception { |
4687 public void test_yieldEachInNonGenerator_syncStar() throws Exception { | 4993 Source source = addSource(createSource(// |
4688 resetWithAsync(); | 4994 "import 'dart:async';", |
4689 Source source = addSource(createSource(// | 4995 "Stream f() async* {", |
4690 "f() sync* {", | 4996 " yield 3;", |
4691 " yield* 0;", | 4997 "}")); |
4692 "}")); | 4998 resolve(source); |
4693 resolve(source); | 4999 assertNoErrors(source); |
4694 assertNoErrors(source); | 5000 verify(source); |
| 5001 } |
| 5002 |
| 5003 public void test_yield_async_to_parameterized_type() throws Exception { |
| 5004 Source source = addSource(createSource(// |
| 5005 "import 'dart:async';", |
| 5006 "Stream<int> f() async* {", |
| 5007 " yield 3;", |
| 5008 "}")); |
| 5009 resolve(source); |
| 5010 assertNoErrors(source); |
| 5011 verify(source); |
| 5012 } |
| 5013 |
| 5014 public void test_yield_async_to_untyped() throws Exception { |
| 5015 Source source = addSource(createSource(// |
| 5016 "f() async* {", |
| 5017 " yield 3;", |
| 5018 "}")); |
| 5019 resolve(source); |
| 5020 assertNoErrors(source); |
| 5021 verify(source); |
| 5022 } |
| 5023 |
| 5024 public void test_yield_each_async_dynamic_to_dynamic() throws Exception { |
| 5025 Source source = addSource(createSource(// |
| 5026 "f() async* {", |
| 5027 " yield* g();", |
| 5028 "}", |
| 5029 "g() => null;")); |
| 5030 resolve(source); |
| 5031 assertNoErrors(source); |
| 5032 verify(source); |
| 5033 } |
| 5034 |
| 5035 public void test_yield_each_async_dynamic_to_stream() throws Exception { |
| 5036 Source source = addSource(createSource(// |
| 5037 "import 'dart:async';", |
| 5038 "Stream f() async* {", |
| 5039 " yield* g();", |
| 5040 "}", |
| 5041 "g() => null;")); |
| 5042 resolve(source); |
| 5043 assertNoErrors(source); |
| 5044 verify(source); |
| 5045 } |
| 5046 |
| 5047 public void test_yield_each_async_dynamic_to_typed_stream() throws Exception { |
| 5048 Source source = addSource(createSource(// |
| 5049 "import 'dart:async';", |
| 5050 "Stream<int> f() async* {", |
| 5051 " yield* g();", |
| 5052 "}", |
| 5053 "g() => null;")); |
| 5054 resolve(source); |
| 5055 assertNoErrors(source); |
| 5056 verify(source); |
| 5057 } |
| 5058 |
| 5059 public void test_yield_each_async_stream_to_dynamic() throws Exception { |
| 5060 Source source = addSource(createSource(// |
| 5061 "import 'dart:async';", |
| 5062 "f() async* {", |
| 5063 " yield* g();", |
| 5064 "}", |
| 5065 "Stream g() => null;")); |
| 5066 resolve(source); |
| 5067 assertNoErrors(source); |
| 5068 verify(source); |
| 5069 } |
| 5070 |
| 5071 public void test_yield_each_async_typed_stream_to_dynamic() throws Exception { |
| 5072 Source source = addSource(createSource(// |
| 5073 "import 'dart:async';", |
| 5074 "f() async* {", |
| 5075 " yield* g();", |
| 5076 "}", |
| 5077 "Stream<int> g() => null;")); |
| 5078 resolve(source); |
| 5079 assertNoErrors(source); |
| 5080 verify(source); |
| 5081 } |
| 5082 |
| 5083 public void test_yield_each_async_typed_stream_to_typed_stream() throws Except
ion { |
| 5084 Source source = addSource(createSource(// |
| 5085 "import 'dart:async';", |
| 5086 "Stream<int> f() async* {", |
| 5087 " yield* g();", |
| 5088 "}", |
| 5089 "Stream<int> g() => null;")); |
| 5090 resolve(source); |
| 5091 assertNoErrors(source); |
| 5092 verify(source); |
| 5093 } |
| 5094 |
| 5095 public void test_yield_each_sync_dynamic_to_dynamic() throws Exception { |
| 5096 Source source = addSource(createSource(// |
| 5097 "f() sync* {", |
| 5098 " yield* g();", |
| 5099 "}", |
| 5100 "g() => null;")); |
| 5101 resolve(source); |
| 5102 assertNoErrors(source); |
| 5103 verify(source); |
| 5104 } |
| 5105 |
| 5106 public void test_yield_each_sync_dynamic_to_iterable() throws Exception { |
| 5107 Source source = addSource(createSource(// |
| 5108 "Iterable f() sync* {", |
| 5109 " yield* g();", |
| 5110 "}", |
| 5111 "g() => null;")); |
| 5112 resolve(source); |
| 5113 assertNoErrors(source); |
| 5114 verify(source); |
| 5115 } |
| 5116 |
| 5117 public void test_yield_each_sync_dynamic_to_typed_iterable() throws Exception
{ |
| 5118 Source source = addSource(createSource(// |
| 5119 "Iterable<int> f() sync* {", |
| 5120 " yield* g();", |
| 5121 "}", |
| 5122 "g() => null;")); |
| 5123 resolve(source); |
| 5124 assertNoErrors(source); |
| 5125 verify(source); |
| 5126 } |
| 5127 |
| 5128 public void test_yield_each_sync_iterable_to_dynamic() throws Exception { |
| 5129 Source source = addSource(createSource(// |
| 5130 "f() sync* {", |
| 5131 " yield* g();", |
| 5132 "}", |
| 5133 "Iterable g() => null;")); |
| 5134 resolve(source); |
| 5135 assertNoErrors(source); |
| 5136 verify(source); |
| 5137 } |
| 5138 |
| 5139 public void test_yield_each_sync_typed_iterable_to_dynamic() throws Exception
{ |
| 5140 Source source = addSource(createSource(// |
| 5141 "f() sync* {", |
| 5142 " yield* g();", |
| 5143 "}", |
| 5144 "Iterable<int> g() => null;")); |
| 5145 resolve(source); |
| 5146 assertNoErrors(source); |
| 5147 verify(source); |
| 5148 } |
| 5149 |
| 5150 public void test_yield_each_sync_typed_iterable_to_typed_iterable() throws Exc
eption { |
| 5151 Source source = addSource(createSource(// |
| 5152 "Iterable<int> f() sync* {", |
| 5153 " yield* g();", |
| 5154 "}", |
| 5155 "Iterable<int> g() => null;")); |
| 5156 resolve(source); |
| 5157 assertNoErrors(source); |
| 5158 verify(source); |
| 5159 } |
| 5160 |
| 5161 public void test_yield_sync_to_dynamic_type() throws Exception { |
| 5162 Source source = addSource(createSource(// |
| 5163 "dynamic f() sync* {", |
| 5164 " yield 3;", |
| 5165 "}")); |
| 5166 resolve(source); |
| 5167 assertNoErrors(source); |
| 5168 verify(source); |
| 5169 } |
| 5170 |
| 5171 public void test_yield_sync_to_generic_type() throws Exception { |
| 5172 Source source = addSource(createSource(// |
| 5173 "Iterable f() async* {", |
| 5174 " yield 3;", |
| 5175 "}")); |
| 5176 resolve(source); |
| 5177 assertNoErrors(source); |
| 5178 verify(source); |
| 5179 } |
| 5180 |
| 5181 public void test_yield_sync_to_parameterized_type() throws Exception { |
| 5182 Source source = addSource(createSource(// |
| 5183 "Iterable<int> f() async* {", |
| 5184 " yield 3;", |
| 5185 "}")); |
| 5186 resolve(source); |
| 5187 assertNoErrors(source); |
| 5188 verify(source); |
| 5189 } |
| 5190 |
| 5191 public void test_yield_sync_to_untyped() throws Exception { |
| 5192 Source source = addSource(createSource(// |
| 5193 "f() sync* {", |
| 5194 " yield 3;", |
| 5195 "}")); |
| 5196 resolve(source); |
| 5197 assertNoErrors(source); |
4695 verify(source); | 5198 verify(source); |
4696 } | 5199 } |
4697 | 5200 |
4698 public void test_yieldInNonGenerator_asyncStar() throws Exception { | 5201 public void test_yieldInNonGenerator_asyncStar() throws Exception { |
4699 resetWithAsync(); | 5202 resetWithAsync(); |
4700 Source source = addSource(createSource(// | 5203 Source source = addSource(createSource(// |
4701 "f() async* {", | 5204 "f() async* {", |
4702 " yield 0;", | 5205 " yield 0;", |
4703 "}")); | 5206 "}")); |
4704 resolve(source); | 5207 resolve(source); |
(...skipping 21 matching lines...) Expand all Loading... |
4726 resolve(source); | 5229 resolve(source); |
4727 assertNoErrors(source); | 5230 assertNoErrors(source); |
4728 verify(source); | 5231 verify(source); |
4729 reset(); | 5232 reset(); |
4730 } | 5233 } |
4731 | 5234 |
4732 private void check_wrongNumberOfParametersForOperator1(String name) throws Exc
eption { | 5235 private void check_wrongNumberOfParametersForOperator1(String name) throws Exc
eption { |
4733 check_wrongNumberOfParametersForOperator(name, "a"); | 5236 check_wrongNumberOfParametersForOperator(name, "a"); |
4734 } | 5237 } |
4735 } | 5238 } |
OLD | NEW |