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) => (new /*@typeArgs=int*/ Future( | 10 Future<int> make(int x) => (new /*@typeArgs=int*/ Future( |
11 /*@returnType=int*/ () => /*@promotedType=none*/ 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 = |
15 Future<List<int>> results = Future.wait(/*@promotedType=none*/ list); | 15 <int>[1, 2, 3]. /*@typeArgs=Future<int>*/ map(make); |
16 Future<String> results2 = /*@promotedType=none*/ results.then( | 16 Future<List<int>> results = |
17 /*@returnType=FutureOr<String>*/ (List<int> list) => /*@promotedType=none*
/ list | 17 Future. /*@typeArgs=int*/ wait(/*@promotedType=none*/ list); |
18 .fold( | 18 Future<String> results2 = /*@promotedType=none*/ results |
19 '', | 19 . /*@typeArgs=String*/ then( |
20 /*@returnType=FutureOr<String>*/ (/*@type=FutureOr<String>*/ x, | 20 /*@returnType=FutureOr<String>*/ (List<int> list) => /*@promotedType=n
one*/ list |
21 /*@type=int*/ y) => /*info:DYNAMIC_CAST,info:DYNAMIC_INVOK
E*/ /*@promotedType=none*/ x /*error:UNDEFINED_OPERATOR*/ + | 21 . /*@typeArgs=FutureOr<String>*/ fold( |
22 /*@promotedType=none*/ y.toString())); | 22 '', |
| 23 /*@returnType=FutureOr<String>*/ (/*@type=FutureOr<String>*/ x
, |
| 24 /*@type=int*/ y) => /*info:DYNAMIC_CAST,info:DYNAMIC_I
NVOKE*/ /*@promotedType=none*/ x /*error:UNDEFINED_OPERATOR*/ + |
| 25 /*@promotedType=none*/ y.toString())); |
23 | 26 |
24 Future<String> results3 = /*@promotedType=none*/ results.then( | 27 Future<String> results3 = /*@promotedType=none*/ results |
25 /*@returnType=FutureOr<String>*/ (List<int> list) => /*@promotedType=none*
/ list | 28 . /*@typeArgs=String*/ then( |
26 .fold( | 29 /*@returnType=FutureOr<String>*/ (List<int> list) => /*@promotedType=n
one*/ list |
27 '', | 30 . /*@typeArgs=FutureOr<String>*/ fold( |
28 /*info:INFERRED_TYPE_CLOSURE,error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/
/*@returnType=String*/ (String | 31 '', |
29 x, | 32 /*info:INFERRED_TYPE_CLOSURE,error:ARGUMENT_TYPE_NOT_ASSIGNABL
E*/ /*@returnType=String*/ (String |
30 /*@type=int*/ y) => | 33 x, |
31 /*@promotedType=none*/ x + /*@promotedType=none*/ y | 34 /*@type=int*/ y) => |
32 .toString())); | 35 /*@promotedType=none*/ x + /*@promotedType=none*/ y |
| 36 .toString())); |
33 | 37 |
34 Future<String> results4 = /*@promotedType=none*/ results.then( | 38 Future<String> results4 = /*@promotedType=none*/ results |
35 /*@returnType=String*/ (List<int> list) => /*@promotedType=none*/ list | 39 . /*@typeArgs=String*/ then( |
36 .fold<String>( | 40 /*@returnType=String*/ (List<int> list) => /*@promotedType=none*/ list |
37 '', | 41 . /*@typeArgs=String*/ fold<String>( |
38 /*@returnType=String*/ (/*@type=String*/ x, /*@type=int*/ y) => | 42 '', |
39 /*@promotedType=none*/ x + /*@promotedType=none*/ y | 43 /*@returnType=String*/ (/*@type=String*/ x, |
40 .toString())); | 44 /*@type=int*/ y) => |
| 45 /*@promotedType=none*/ x + /*@promotedType=none*/ y |
| 46 .toString())); |
41 } | 47 } |
OLD | NEW |