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

Side by Side Diff: test/checker/checker_test.dart

Issue 1248213002: allow await to be any value, fixes part of #264 (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 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
« no previous file with comments | « pubspec.yaml ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 /// General type checking tests 5 /// General type checking tests
6 library dev_compiler.test.checker_test; 6 library dev_compiler.test.checker_test;
7 7
8 import 'package:test/test.dart'; 8 import 'package:test/test.dart';
9 9
10 import '../testing.dart'; 10 import '../testing.dart';
(...skipping 2674 matching lines...) Expand 10 before | Expand all | Expand 10 after
2685 2685
2686 bar1() async { return x; } 2686 bar1() async { return x; }
2687 Future bar2() async { return x; } 2687 Future bar2() async { return x; }
2688 Future<int> bar3() async { return (/*info:DynamicCast*/x); } 2688 Future<int> bar3() async { return (/*info:DynamicCast*/x); }
2689 Future<int> bar4() async { return (/*severe:StaticTypeError*/new Future< int>(x)); } 2689 Future<int> bar4() async { return (/*severe:StaticTypeError*/new Future< int>(x)); }
2690 2690
2691 int y; 2691 int y;
2692 Future<int> z; 2692 Future<int> z;
2693 2693
2694 void baz() async { 2694 void baz() async {
2695 int a = /*info:DynamicCast*/await /*info:DynamicCast*/x; 2695 int a = /*info:DynamicCast*/await x;
2696 int b = await /*severe:StaticTypeError*/y; 2696 int b = await y;
2697 int c = await z; 2697 int c = await z;
2698 String d = /*severe:StaticTypeError*/await z; 2698 String d = /*severe:StaticTypeError*/await z;
2699 } 2699 }
2700
2701 Future<bool> get issue_264 async {
2702 await 42;
2703 return false;
2704 }
2700 ''' 2705 '''
2701 })); 2706 }));
2702 2707
2703 test('async*', () => testChecker({ 2708 test('async*', () => testChecker({
2704 '/main.dart': ''' 2709 '/main.dart': '''
2705 import 'dart:async'; 2710 import 'dart:async';
2706 2711
2707 dynamic x; 2712 dynamic x;
2708 2713
2709 bar1() async* { yield x; } 2714 bar1() async* { yield x; }
(...skipping 22 matching lines...) Expand all
2732 2737
2733 baz1() sync* { yield* (/*info:DynamicCast*/x); } 2738 baz1() sync* { yield* (/*info:DynamicCast*/x); }
2734 Iterable baz2() sync* { yield* (/*info:DynamicCast*/x); } 2739 Iterable baz2() sync* { yield* (/*info:DynamicCast*/x); }
2735 Iterable<int> baz3() sync* { yield* (/*warning:DownCastComposite*/x); } 2740 Iterable<int> baz3() sync* { yield* (/*warning:DownCastComposite*/x); }
2736 Iterable<int> baz4() sync* { yield* new Iterable<int>(); } 2741 Iterable<int> baz4() sync* { yield* new Iterable<int>(); }
2737 Iterable<int> baz5() sync* { yield* (/*info:InferredTypeAllocation*/new Iterable()); } 2742 Iterable<int> baz5() sync* { yield* (/*info:InferredTypeAllocation*/new Iterable()); }
2738 ''' 2743 '''
2739 })); 2744 }));
2740 }); 2745 });
2741 } 2746 }
OLDNEW
« no previous file with comments | « pubspec.yaml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698