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