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

Unified Diff: pkg/analyzer/lib/src/generated/resolver.dart

Issue 1513603002: fix #25182, downwards inference for calls to fields/getters/vars/params/locals (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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/test/src/task/strong/inferred_type_test.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 37eaddc0202612b8a4c5803a211c7d5e1e415deb..b221f9ffb3ab9d4004f5d0fc08f51845b8b13a4e 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -9013,9 +9013,7 @@ class ResolverVisitor extends ScopedVisitor {
typeProvider.listType.substitute4([typeProvider.dynamicType]);
targs = inferenceContext.matchTypes(listD, contextType);
}
- if (targs != null &&
- targs.length == 1 &&
- !targs[0].isDynamic) {
+ if (targs != null && targs.length == 1 && !targs[0].isDynamic) {
DartType eType = targs[0];
InterfaceType listT = typeProvider.listType.substitute4([eType]);
for (Expression child in node.elements) {
@@ -9040,9 +9038,7 @@ class ResolverVisitor extends ScopedVisitor {
.substitute4([typeProvider.dynamicType, typeProvider.dynamicType]);
targs = inferenceContext.matchTypes(mapD, contextType);
}
- if (targs != null &&
- targs.length == 2 &&
- targs.any((t) => !t.isDynamic)) {
+ if (targs != null && targs.length == 2 && targs.any((t) => !t.isDynamic)) {
DartType kType = targs[0];
DartType vType = targs[1];
InterfaceType mapT = typeProvider.mapType.substitute4([kType, vType]);
@@ -9082,8 +9078,16 @@ class ResolverVisitor extends ScopedVisitor {
node.accept(elementResolver);
_inferFunctionExpressionsParametersTypes(node.argumentList);
Element methodElement = node.methodName.staticElement;
- if (methodElement is ExecutableElement) {
- InferenceContext.setType(node.argumentList, methodElement.type);
+ DartType contextType = null;
+ if (methodElement is PropertyAccessorElement && methodElement.isGetter) {
+ contextType = methodElement.returnType;
+ } else if (methodElement is VariableElement) {
+ contextType = methodElement.type;
+ } else if (methodElement is ExecutableElement) {
+ contextType = methodElement.type;
+ }
+ if (contextType is FunctionType) {
+ InferenceContext.setType(node.argumentList, contextType);
}
safelyVisit(node.argumentList);
node.accept(typeAnalyzer);
« no previous file with comments | « no previous file | pkg/analyzer/test/src/task/strong/inferred_type_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698