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

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

Issue 1209413002: Fixes #246 (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 6 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 | « lib/src/checker/checker.dart ('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 'package:dev_compiler/src/testing.dart'; 10 import 'package:dev_compiler/src/testing.dart';
(...skipping 2668 matching lines...) Expand 10 before | Expand all | Expand 10 after
2679 2679
2680 foo1() async => x; 2680 foo1() async => x;
2681 Future foo2() async => x; 2681 Future foo2() async => x;
2682 Future<int> foo3() async => (/*info:DynamicCast*/x); 2682 Future<int> foo3() async => (/*info:DynamicCast*/x);
2683 Future<int> foo4() async => (/*severe:StaticTypeError*/new Future<int>(x )); 2683 Future<int> foo4() async => (/*severe:StaticTypeError*/new Future<int>(x ));
2684 2684
2685 bar1() async { return x; } 2685 bar1() async { return x; }
2686 Future bar2() async { return x; } 2686 Future bar2() async { return x; }
2687 Future<int> bar3() async { return (/*info:DynamicCast*/x); } 2687 Future<int> bar3() async { return (/*info:DynamicCast*/x); }
2688 Future<int> bar4() async { return (/*severe:StaticTypeError*/new Future< int>(x)); } 2688 Future<int> bar4() async { return (/*severe:StaticTypeError*/new Future< int>(x)); }
2689
2690 int y;
2691 Future<int> z;
2692
2693 void baz() async {
2694 int a = /*info:DynamicCast*/await /*info:DynamicCast*/x;
2695 int b = await /*severe:StaticTypeError*/y;
2696 int c = await z;
2697 String d = /*severe:StaticTypeError*/await z;
2698 }
2689 ''' 2699 '''
2690 })); 2700 }));
2691 2701
2692 test('async*', () => testChecker({ 2702 test('async*', () => testChecker({
2693 '/main.dart': ''' 2703 '/main.dart': '''
2694 import 'dart:async'; 2704 import 'dart:async';
2695 2705
2696 dynamic x; 2706 dynamic x;
2697 2707
2698 bar1() async* { yield x; } 2708 bar1() async* { yield x; }
(...skipping 22 matching lines...) Expand all
2721 2731
2722 baz1() sync* { yield* (/*info:DynamicCast*/x); } 2732 baz1() sync* { yield* (/*info:DynamicCast*/x); }
2723 Iterable baz2() sync* { yield* (/*info:DynamicCast*/x); } 2733 Iterable baz2() sync* { yield* (/*info:DynamicCast*/x); }
2724 Iterable<int> baz3() sync* { yield* (/*warning:DownCastComposite*/x); } 2734 Iterable<int> baz3() sync* { yield* (/*warning:DownCastComposite*/x); }
2725 Iterable<int> baz4() sync* { yield* new Iterable<int>(); } 2735 Iterable<int> baz4() sync* { yield* new Iterable<int>(); }
2726 Iterable<int> baz5() sync* { yield* (/*info:InferredTypeAllocation*/new Iterable()); } 2736 Iterable<int> baz5() sync* { yield* (/*info:InferredTypeAllocation*/new Iterable()); }
2727 ''' 2737 '''
2728 })); 2738 }));
2729 }); 2739 });
2730 } 2740 }
OLDNEW
« no previous file with comments | « lib/src/checker/checker.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698