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

Unified Diff: pkg/analyzer/test/src/task/strong/inferred_type_test.dart

Issue 2280023004: fix #27155, do not push down dynamic as context type (Closed)
Patch Set: add test Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/generated/type_system.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 8b00a44b72d537704702e1fb310a9c377c954d5f..0087b3d35a5be8e2cf7b5343a9986cb494b457b4 100644
--- a/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
+++ b/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
@@ -1609,6 +1609,17 @@ main() {
''');
}
+ void test_futureThen_explicitFuture() {
+ checkFile(r'''
+import "dart:async";
+main() {
+ Future<int> f;
+ var x = f.then/*<Future<List<int>>>*/(/*info:INFERRED_TYPE_CLOSURE*/(x) => /*info:INFERRED_TYPE_LITERAL*/[]);
+ Future<List<int>> y = x;
+}
+ ''');
+ }
+
void test_futureThen_upwards() {
// Regression test for https://github.com/dart-lang/sdk/issues/27088.
String build({String declared, String downwards, String upwards}) => '''
@@ -1676,24 +1687,6 @@ $downwards<int> g3(bool x) async {
checkFile(build(downwards: "Future", upwards: "MyFuture"));
}
- void test_futureUnion_downwardsGenericMethods() {
- // Regression test for https://github.com/dart-lang/sdk/issues/27134
- //
- // We need to take a future union into account for both directions of
- // generic method inference.
- checkFile(r'''
-import 'dart:async';
-
-foo() async {
- Future<List<A>> f1 = null;
- Future<List<A>> f2 = null;
- List<List<A>> merged = await Future.wait(/*info:INFERRED_TYPE_LITERAL*/[f1, f2]);
-}
-
-class A {}
- ''');
- }
-
void test_futureUnion_downwards() {
String build({String declared, String downwards, String upwards}) {
// TODO(leafp): The use of matchTypes in visitInstanceCreationExpression
@@ -1736,6 +1729,24 @@ $downwards<List<int>> g3() async {
build(declared: "Future", downwards: "Future", upwards: "MyFuture"));
}
+ void test_futureUnion_downwardsGenericMethods() {
+ // Regression test for https://github.com/dart-lang/sdk/issues/27134
+ //
+ // We need to take a future union into account for both directions of
+ // generic method inference.
+ checkFile(r'''
+import 'dart:async';
+
+foo() async {
+ Future<List<A>> f1 = null;
+ Future<List<A>> f2 = null;
+ List<List<A>> merged = await Future.wait(/*info:INFERRED_TYPE_LITERAL*/[f1, f2]);
+}
+
+class A {}
+ ''');
+ }
+
void test_genericMethods_basicDownwardInference() {
checkFile(r'''
/*=T*/ f/*<S, T>*/(/*=S*/ s) => null;
« no previous file with comments | « pkg/analyzer/lib/src/generated/type_system.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698