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 171c3d8278cf09a4fb68699b5be61a59b404b82e..3140de771faa09907c788e27c5b211699dca252e 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 |
@@ -107,6 +107,14 @@ class ClosureContext { |
// TODO(paulberry): this is inherited from analyzer; it's not part of |
// the spec. See also dartbug.com/29606. |
inferredReturnType = greatestClosure(inferrer.coreTypes, returnContext); |
+ } else if (isExpressionFunction && |
+ returnContext != null && |
+ inferredReturnType is DynamicType) { |
+ // For expression-bodied functions, if the inferred return type is |
+ // `dynamic`, we use the context. |
+ // TODO(paulberry): this is inherited from analyzer; it's not part of the |
+ // spec. |
+ inferredReturnType = greatestClosure(inferrer.coreTypes, returnContext); |
} |
if (isGenerator) { |