| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library analyzer.test.src.task.strong.checker_test; | 5 library analyzer.test.src.task.strong.checker_test; |
| 6 | 6 |
| 7 import '../../../reflective_tests.dart'; | 7 import '../../../reflective_tests.dart'; |
| 8 import 'strong_test_helper.dart'; | 8 import 'strong_test_helper.dart'; |
| 9 | 9 |
| 10 void main() { | 10 void main() { |
| (...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 | 683 |
| 684 void test_functionModifiers_async() { | 684 void test_functionModifiers_async() { |
| 685 checkFile(''' | 685 checkFile(''' |
| 686 import 'dart:async'; | 686 import 'dart:async'; |
| 687 import 'dart:math' show Random; | 687 import 'dart:math' show Random; |
| 688 | 688 |
| 689 dynamic x; | 689 dynamic x; |
| 690 | 690 |
| 691 foo1() async => x; | 691 foo1() async => x; |
| 692 Future foo2() async => x; | 692 Future foo2() async => x; |
| 693 Future<int> foo3() async => /*info:DYNAMIC_CAST*/x; | 693 Future<int> foo3() async => x; |
| 694 Future<int> foo4() async => new Future<int>.value(/*info:DYNAMIC_CAST*/x); | 694 Future<int> foo4() async => new Future<int>.value(/*info:DYNAMIC_CAST*/x); |
| 695 Future<int> foo5() async => | 695 Future<int> foo5() async => |
| 696 /*error:RETURN_OF_INVALID_TYPE*/new Future<String>.value(/*info:DYNAMIC_CAST
*/x); | 696 /*error:RETURN_OF_INVALID_TYPE*/new Future<String>.value(/*info:DYNAMIC_CAST
*/x); |
| 697 | 697 |
| 698 bar1() async { return x; } | 698 bar1() async { return x; } |
| 699 Future bar2() async { return x; } | 699 Future bar2() async { return x; } |
| 700 Future<int> bar3() async { return /*info:DYNAMIC_CAST*/x; } | 700 Future<int> bar3() async { return x; } |
| 701 Future<int> bar4() async { return new Future<int>.value(/*info:DYNAMIC_CAST*/x);
} | 701 Future<int> bar4() async { return new Future<int>.value(/*info:DYNAMIC_CAST*/x);
} |
| 702 Future<int> bar5() async { | 702 Future<int> bar5() async { |
| 703 return /*error:RETURN_OF_INVALID_TYPE*/new Future<String>.value(/*info:DYNAMIC
_CAST*/x); | 703 return /*error:RETURN_OF_INVALID_TYPE*/new Future<String>.value(/*info:DYNAMIC
_CAST*/x); |
| 704 } | 704 } |
| 705 | 705 |
| 706 int y; | 706 int y; |
| 707 Future<int> z; | 707 Future<int> z; |
| 708 | 708 |
| 709 baz() async { | 709 baz() async { |
| 710 int a = /*info:DYNAMIC_CAST*/await x; | 710 int a = /*info:DYNAMIC_CAST*/await x; |
| 711 int b = await y; | 711 int b = await y; |
| 712 int c = await z; | 712 int c = await z; |
| 713 String d = /*error:INVALID_ASSIGNMENT*/await z; | 713 String d = /*error:INVALID_ASSIGNMENT*/await z; |
| 714 } | 714 } |
| 715 | 715 |
| 716 Future<bool> get issue_264 async { | 716 Future<bool> get issue_ddc_264 async { |
| 717 await 42; | 717 await 42; |
| 718 if (new Random().nextBool()) { | 718 if (new Random().nextBool()) { |
| 719 return true; | 719 return true; |
| 720 } else { | 720 } else { |
| 721 return new Future<bool>.value(false); | 721 return new Future<bool>.value(false); |
| 722 } | 722 } |
| 723 } | 723 } |
| 724 |
| 725 |
| 726 Future<String> issue_sdk_26404() async { |
| 727 return (1 > 0) ? new Future<String>.value('hello') : "world"; |
| 728 } |
| 724 '''); | 729 '''); |
| 725 } | 730 } |
| 726 | 731 |
| 727 void test_functionModifiers_asyncStar() { | 732 void test_functionModifiers_asyncStar() { |
| 728 checkFile(''' | 733 checkFile(''' |
| 729 import 'dart:async'; | 734 import 'dart:async'; |
| 730 | 735 |
| 731 dynamic x; | 736 dynamic x; |
| 732 | 737 |
| 733 bar1() async* { yield x; } | 738 bar1() async* { yield x; } |
| (...skipping 2806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3540 // Regression test for https://github.com/dart-lang/sdk/issues/25069 | 3545 // Regression test for https://github.com/dart-lang/sdk/issues/25069 |
| 3541 checkFile(''' | 3546 checkFile(''' |
| 3542 typedef int Foo(); | 3547 typedef int Foo(); |
| 3543 void foo() {} | 3548 void foo() {} |
| 3544 void main () { | 3549 void main () { |
| 3545 Foo x = /*error:INVALID_ASSIGNMENT,info:USE_OF_VOID_RESULT*/foo(); | 3550 Foo x = /*error:INVALID_ASSIGNMENT,info:USE_OF_VOID_RESULT*/foo(); |
| 3546 } | 3551 } |
| 3547 '''); | 3552 '''); |
| 3548 } | 3553 } |
| 3549 } | 3554 } |
| OLD | NEW |