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 4a70c667c78425be69ed028fa4618aa25b3be919..09c5be41927555a03fda8c9686b34065c7f6c38b 100644 |
--- a/pkg/analyzer/lib/src/generated/resolver.dart |
+++ b/pkg/analyzer/lib/src/generated/resolver.dart |
@@ -7183,6 +7183,20 @@ class ResolverVisitor extends ScopedVisitor { |
if (typeAnalyzer.inferFormalParameterList(node, type)) { |
// TODO(leafp): This gets dropped on the floor if we're in the field |
// inference task. We should probably keep these infos. |
+ // |
+ // TODO(jmesserly): this is reporting the context type, and therefore not |
+ // necessarily the correct inferred type for the lambda. |
+ // |
+ // For example, `([x]) {}` could be passed to `int -> void` but its type |
+ // will really be `([int]) -> void`. Similar issue for named arguments. |
+ // It can also happen if the return type is inferred later on to be |
+ // more precise. |
+ // |
+ // This reporting bug defeats the deduplication of error messages and |
+ // results in the same inference message being reported twice. |
+ // |
+ // To get this right, we'd have to delay reporting until we have the |
+ // complete type including return type. |
inferenceContext.recordInference(node.parent, type); |
} |
} |