OLD | NEW |
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 import 'dart:async'; | 8 import 'dart:async'; |
9 | 9 |
10 Future<int> make(int x) => | 10 Future<int> make(int x) => (new /*@typeArgs=int*/ Future( |
11 (new /*@typeArgs=int*/ Future(/*@returnType=int*/ () => x)); | 11 /*@returnType=int*/ () => /*@promotedType=none*/ x)); |
12 | 12 |
13 main() { | 13 main() { |
14 Iterable<Future<int>> list = <int>[1, 2, 3].map(make); | 14 Iterable<Future<int>> list = <int>[1, 2, 3].map(make); |
15 Future<List<int>> results = Future.wait(/*@promotedType=none*/ list); | 15 Future<List<int>> results = Future.wait(/*@promotedType=none*/ list); |
16 Future<String> results2 = /*@promotedType=none*/ results.then( | 16 Future<String> results2 = /*@promotedType=none*/ results.then( |
17 /*@returnType=FutureOr<String>*/ (List<int> list) => list.fold( | 17 /*@returnType=FutureOr<String>*/ (List<int> list) => /*@promotedType=none*
/ list |
18 '', | 18 .fold( |
19 /*@returnType=FutureOr<String>*/ (/*@type=FutureOr<String>*/ x, | 19 '', |
20 /*@type=int*/ y) => /*info:DYNAMIC_CAST,info:DYNAMIC_INVOKE*/
x /*error:UNDEFINED_OPERATOR*/ + | 20 /*@returnType=FutureOr<String>*/ (/*@type=FutureOr<String>*/ x, |
21 y.toString())); | 21 /*@type=int*/ y) => /*info:DYNAMIC_CAST,info:DYNAMIC_INVOK
E*/ /*@promotedType=none*/ x /*error:UNDEFINED_OPERATOR*/ + |
| 22 /*@promotedType=none*/ y.toString())); |
22 | 23 |
23 Future<String> results3 = /*@promotedType=none*/ results.then( | 24 Future<String> results3 = /*@promotedType=none*/ results.then( |
24 /*@returnType=FutureOr<String>*/ (List<int> list) => list.fold( | 25 /*@returnType=FutureOr<String>*/ (List<int> list) => /*@promotedType=none*
/ list |
25 '', | 26 .fold( |
26 /*info:INFERRED_TYPE_CLOSURE,error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ /*@r
eturnType=String*/ (String | 27 '', |
27 x, | 28 /*info:INFERRED_TYPE_CLOSURE,error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/
/*@returnType=String*/ (String |
28 /*@type=int*/ y) => | 29 x, |
29 x + y.toString())); | 30 /*@type=int*/ y) => |
| 31 /*@promotedType=none*/ x + /*@promotedType=none*/ y |
| 32 .toString())); |
30 | 33 |
31 Future<String> results4 = /*@promotedType=none*/ results.then( | 34 Future<String> results4 = /*@promotedType=none*/ results.then( |
32 /*@returnType=String*/ (List<int> list) => list.fold<String>( | 35 /*@returnType=String*/ (List<int> list) => /*@promotedType=none*/ list |
33 '', | 36 .fold<String>( |
34 /*@returnType=String*/ (/*@type=String*/ x, /*@type=int*/ y) => | 37 '', |
35 x + y.toString())); | 38 /*@returnType=String*/ (/*@type=String*/ x, /*@type=int*/ y) => |
| 39 /*@promotedType=none*/ x + /*@promotedType=none*/ y |
| 40 .toString())); |
36 } | 41 } |
OLD | NEW |