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

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

Issue 2230513002: fix #26155 - optional param passed to positional was not inferred (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: add comment 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/static_type_analyzer.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 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);
}
}
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/static_type_analyzer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698