| Index: pkg/analyzer/test/src/task/strong/inferred_type_test.dart
|
| diff --git a/pkg/analyzer/test/src/task/strong/inferred_type_test.dart b/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
|
| index 0f43c55d659bcfe262c6181ed2f07861b4ba8dd8..816d2d6ca50da6c3d97a13a34941396488790ead 100644
|
| --- a/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
|
| +++ b/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
|
| @@ -900,7 +900,7 @@ void main() {
|
| import 'dart:async';
|
| Future test() async {
|
| dynamic d;
|
| - List<int> l0 = /*warning:DOWN_CAST_COMPOSITE should be pass*/await /*pass should be info:INFERRED_TYPE_LITERAL*/[d];
|
| + List<int> l0 = await /*info:INFERRED_TYPE_LITERAL*/[/*info:DYNAMIC_CAST*/d];
|
| List<int> l1 = await /*info:INFERRED_TYPE_ALLOCATION*/new Future.value(/*info:INFERRED_TYPE_LITERAL*/[/*info:DYNAMIC_CAST*/d]);
|
| }
|
| ''');
|
| @@ -1523,7 +1523,53 @@ int get y => null;
|
| checkFile('''
|
| import 'dart:async';
|
| Future f;
|
| -Future<int> t1 = f.then((_) => new Future<int>.value(42));
|
| +Future<int> t1 = f.then((_) async => await new Future<int>.value(3));
|
| +Future<int> t2 = f.then(/*info:INFERRED_TYPE_CLOSURE*/(_) async {return await new Future<int>.value(3);});
|
| +Future<int> t3 = f.then((_) async => 3);
|
| +Future<int> t4 = f.then(/*info:INFERRED_TYPE_CLOSURE*/(_) async {return 3;});
|
| +Future<int> t5 = f.then((_) => new Future<int>.value(3));
|
| +Future<int> t6 = f.then((_) {return new Future<int>.value(3);});
|
| +Future<int> t7 = f.then((_) async => new Future<int>.value(3));
|
| +Future<int> t8 = f.then(/*info:INFERRED_TYPE_CLOSURE*/(_) async {return new Future<int>.value(3);});
|
| +''');
|
| + }
|
| +
|
| + void test_futureThen_conditional() {
|
| + checkFile('''
|
| +import 'dart:async';
|
| +Future<bool> f;
|
| +Future<int> t1 = f.then((x) async => x ? 2 : await new Future<int>.value(3));
|
| +Future<int> t2 = f.then(/*info:INFERRED_TYPE_CLOSURE*/(x) async {return await x ? 2 : new Future<int>.value(3);});
|
| +Future<int> t5 = f.then((x) => x ? 2 : new Future<int>.value(3));
|
| +Future<int> t6 = f.then((x) {return x ? 2 : new Future<int>.value(3);});
|
| +''');
|
| + }
|
| +
|
| + void test_futureUnion_asyncConditional() {
|
| + checkFile('''
|
| +import 'dart:async';
|
| +
|
| +Future<int> g1(bool x) async { return x ? 42 : /*info:INFERRED_TYPE_ALLOCATION*/new Future.value(42); }
|
| +Future<int> g2(bool x) async => x ? 42 : /*info:INFERRED_TYPE_ALLOCATION*/new Future.value(42);
|
| +
|
| +Future<int> g3(bool x) async {
|
| + var y = x ? 42 : /*info:INFERRED_TYPE_ALLOCATION*/new Future.value(42);
|
| + return y;
|
| +}
|
| + ''');
|
| + }
|
| +
|
| + void test_futureUnion_downwards() {
|
| + checkFile('''
|
| +import 'dart:async';
|
| +Future f;
|
| +// Instantiates Future<int>
|
| +Future<int> t1 = f.then((_) => /*info:INFERRED_TYPE_ALLOCATION*/new Future.value(/*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/'hi'));
|
| +
|
| +// Instantiates List<int>
|
| +Future<List<int>> t2 = f.then((_) => /*info:INFERRED_TYPE_LITERAL*/[3]);
|
| +Future<List<int>> g2() async { return /*info:INFERRED_TYPE_LITERAL*/[3]; }
|
| +Future<List<int>> g3() async { return /*info:INFERRED_TYPE_ALLOCATION*/new Future.value(/*info:INFERRED_TYPE_LITERAL*/[3]); }
|
| ''');
|
| }
|
|
|
|
|