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 1d39d0e0e14f9e9fa3092fc7b919dfc3ef829355..1512e67fe83730ef8ef8039d8eca11b4e9980805 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 |
@@ -563,7 +563,7 @@ abstract class TypeInferrerImpl<S, E, V, F> extends TypeInferrer<S, E, V, F> { |
TypePromotionFact<V> typePromotionFact, |
TypePromotionScope typePromotionScope, |
int offset, |
- DartType declaredType, |
+ DartType declaredOrInferredType, |
void setPromotedType(DartType type)) { |
DartType promotedType = typePromoter.computePromotedType( |
typePromotionFact, typePromotionScope, mutatedInClosure); |
@@ -575,9 +575,7 @@ abstract class TypeInferrerImpl<S, E, V, F> extends TypeInferrer<S, E, V, F> { |
? new InstrumentationValueForType(promotedType) |
: const InstrumentationValueLiteral('none')); |
setPromotedType(promotedType); |
- return typeNeeded |
- ? (promotedType ?? declaredType ?? const DynamicType()) |
- : null; |
+ return typeNeeded ? (promotedType ?? declaredOrInferredType) : null; |
} |
DartType inferVariableSet( |