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 c9efc5d5735cb33a3d146d0a027f570f5745d20d..b6a959579daa8cde9549549b49bf7337665f73c5 100644 |
--- a/pkg/analyzer/lib/src/generated/static_type_analyzer.dart |
+++ b/pkg/analyzer/lib/src/generated/static_type_analyzer.dart |
@@ -1762,12 +1762,11 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> { |
* being called is one of the object methods. |
*/ |
bool _inferMethodInvocationObject(MethodInvocation node) { |
- // If we have a call like `toString()` don't infer it. |
- // |
- // Either: it's really `this.toString()` and we shouldn't need inference, |
- // or it's a call to a function that happens to be called `toString()` and |
- // we shouldn't infer. |
- if (node.target == null) { |
+ // If we have a call like `toString()` or `libraryPrefix.toString()` don't |
+ // infer it. |
+ Expression target = node.realTarget; |
+ if (target == null || |
+ target is SimpleIdentifier && target.staticElement is PrefixElement) { |
return false; |
} |