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

Side by Side Diff: pkg/front_end/testcases/inference/infer_local_function_return_type.dart

Issue 2950213002: Infer the return types of local functions where appropriate. (Closed)
Patch Set: Created 3 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
OLDNEW
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 /*@testedFeatures=inference*/ 5 /*@testedFeatures=inference*/
6 library test; 6 library test;
7 7
8 test() { 8 test() {
9 f0() => 42; 9 /*@returnType=int*/ f0() => 42;
10 f1() async => 42; 10 /*@returnType=Future<int>*/ f1() async => 42;
11 11
12 f2() { 12 /*@returnType=int*/ f2() {
13 return 42; 13 return 42;
14 } 14 }
15 15
16 f3() async { 16 /*@returnType=Future<int>*/ f3() async {
17 return 42; 17 return 42;
18 } 18 }
19 19
20 f4() sync* { 20 /*@returnType=Iterable<int>*/ f4() sync* {
21 yield 42; 21 yield 42;
22 } 22 }
23 23
24 f5() async* { 24 /*@returnType=Stream<int>*/ f5() async* {
25 yield 42; 25 yield 42;
26 } 26 }
27 27
28 num f6() => 42; 28 num f6() => 42;
29 29
30 f7() => f7(); 30 /*@returnType=dynamic*/ f7() => f7();
31 f8() => /*error:REFERENCED_BEFORE_DECLARATION*/ f9(); 31 /*@returnType=Stream<int>*/ f8() => f5();
32 f9() => f5();
33 32
34 var /*@type=() -> int*/ v0 = f0; 33 var /*@type=() -> int*/ v0 = f0;
35 var /*@type=() -> Future<int>*/ v1 = f1; 34 var /*@type=() -> Future<int>*/ v1 = f1;
36 var /*@type=() -> int*/ v2 = f2; 35 var /*@type=() -> int*/ v2 = f2;
37 var /*@type=() -> Future<int>*/ v3 = f3; 36 var /*@type=() -> Future<int>*/ v3 = f3;
38 var /*@type=() -> Iterable<int>*/ v4 = f4; 37 var /*@type=() -> Iterable<int>*/ v4 = f4;
39 var /*@type=() -> Stream<int>*/ v5 = f5; 38 var /*@type=() -> Stream<int>*/ v5 = f5;
40 var /*@type=() -> num*/ v6 = f6; 39 var /*@type=() -> num*/ v6 = f6;
41 var /*@type=() -> dynamic*/ v7 = f7; 40 var /*@type=() -> dynamic*/ v7 = f7;
42 var /*@type=() -> dynamic*/ v8 = f8; 41 var /*@type=() -> Stream<int>*/ v8 = f8;
43 var /*@type=() -> Stream<int>*/ v9 = f9;
44 } 42 }
45 43
46 main() {} 44 main() {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698