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

Unified Diff: pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart

Issue 2923733004: Properly flatten FutureOr types when inferring the type of an async method. (Closed)
Patch Set: Created 3 years, 6 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 | « no previous file | pkg/front_end/test/fasta/strong.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
diff --git a/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart b/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
index 09cc16385b2ca1ce0666d6b15011ef484cf10dcc..4a814353195cbb36994b1512ca9d8fc3835c607b 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
@@ -60,9 +60,8 @@ class ClosureContext {
returnContext, inferrer.coreTypes.iterableClass);
}
} else if (isAsync) {
- returnContext = inferrer.wrapType(
- inferrer.typeSchemaEnvironment.flattenFutures(returnContext),
- inferrer.coreTypes.futureOrClass);
+ returnContext = inferrer.wrapFutureOrType(
+ inferrer.typeSchemaEnvironment.flattenFutures(returnContext));
}
return new ClosureContext._(isAsync, isGenerator, returnContext);
}
@@ -532,7 +531,8 @@ abstract class TypeInferrerImpl extends TypeInferrer {
}
// TODO(paulberry): If [type] is a subtype of `Future`, should we just
// return it unmodified?
- return new InterfaceType(coreTypes.futureOrClass, <DartType>[type]);
+ return new InterfaceType(
+ coreTypes.futureOrClass, <DartType>[type ?? const DynamicType()]);
}
DartType wrapFutureType(DartType type) {
« no previous file with comments | « no previous file | pkg/front_end/test/fasta/strong.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698