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

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

Issue 1582863003: fixes #25340, propagatedType now finds the instantiated generic method's return type (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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/test/generated/resolver_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/static_type_analyzer.dart
diff --git a/pkg/analyzer/lib/src/generated/static_type_analyzer.dart b/pkg/analyzer/lib/src/generated/static_type_analyzer.dart
index fdda79a83b6a617b25e2b48f3238eafa459ba8a8..a034cbb3007b3cf5c624ff85b2c89e6b1c1062f3 100644
--- a/pkg/analyzer/lib/src/generated/static_type_analyzer.dart
+++ b/pkg/analyzer/lib/src/generated/static_type_analyzer.dart
@@ -873,16 +873,21 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
}
if (needPropagatedType) {
Element propagatedElement = methodNameNode.propagatedElement;
+ DartType propagatedInvokeType = node.propagatedInvokeType;
// HACK: special case for object methods ([toString]) on dynamic
// expressions. More special cases in [visitPrefixedIdentfier].
if (propagatedElement == null) {
- propagatedElement =
+ MethodElement objMethod =
_typeProvider.objectType.getMethod(methodNameNode.name);
+ if (objMethod != null) {
+ propagatedElement = objMethod;
+ propagatedInvokeType = objMethod.type;
+ }
}
if (!identical(propagatedElement, staticMethodElement)) {
// Record static return type of the propagated element.
DartType propagatedStaticType =
- _computeStaticReturnType(propagatedElement);
+ _computeInvokeReturnType(propagatedInvokeType);
_resolver.recordPropagatedTypeIfBetter(
node, propagatedStaticType, true);
// Record propagated return type of the propagated element.
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/resolver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698