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

Unified Diff: pkg/analyzer/lib/src/generated/resolver.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 | « no previous file | pkg/analyzer/lib/src/generated/type_system.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/resolver.dart
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index 9d04dff3d942338de40855dede9712fbb063f200..e53f1fc0a57d9dddb69faf4c76533bce76f2adc0 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -4963,7 +4963,11 @@ class InferenceContext {
* inference.
*/
static void setType(AstNode node, DartType type) {
- node?.setProperty(_typeProperty, type);
+ if (type == null || type.isDynamic) {
+ clearType(node);
+ } else {
+ node?.setProperty(_typeProperty, type);
+ }
}
/**
@@ -6625,8 +6629,10 @@ class ResolverVisitor extends ScopedVisitor {
//
// We can't represent this in Dart so we populate it here during
// inference.
- returnType = FutureUnionType.from(
- futureThenType.returnType, typeProvider, typeSystem);
+ var typeParamS =
+ futureThenType.returnType.flattenFutures(typeSystem);
+ returnType =
+ FutureUnionType.from(typeParamS, typeProvider, typeSystem);
} else {
returnType = _computeReturnOrYieldType(functionType.returnType);
}
@@ -7185,7 +7191,8 @@ class ResolverVisitor extends ScopedVisitor {
return (typeArgs?.length == 1) ? typeArgs[0] : null;
}
// async functions expect `Future<T> | T`
- return new FutureUnionType(declaredType, typeProvider, typeSystem);
+ var futureTypeParam = declaredType.flattenFutures(typeSystem);
+ return FutureUnionType.from(futureTypeParam, typeProvider, typeSystem);
}
return declaredType;
}
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/type_system.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698