-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Silent inconsistency in top level inference #32394
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
We disabled these errors in https://codereview.chromium.org/2983293002 |
I don't think so, but I don't really know that the plan here is. What I understood from talking to @devoncarew is that the interim plan was that:
I suspect that restoring those warnings is non-starter, at least as more than hints, since the migration would be prohibitive. |
Well, this is place where linker does not perform inference. But it is explicitly disabled for function types. sdk/pkg/analyzer/lib/src/summary/link.dart Lines 2015 to 2021 in 977f4c7
|
I would change 'Task model goes away' to 'Task model doesn't guarantee correctness'. @leafpetersen, should this be tracked in #32395? |
It's already there. |
There are at least two root causes of this issue:
Once https://dart-review.googlesource.com/c/sdk/+/46301 lands, Leaf's example will give an error message, but it won't be entirely correct--it will say "A value of type 'List' can't be assigned to a variable of type 'String'", whereas the correct message is "A value of type 'List<String>' can't be assigned to a variable of type 'String'". The reason for the incorrect error message is root cause 2, which causes it to infer a type of Iterable for I will start working on the second root cause now. |
…nference. When summarizing an initializer expression that contains a method call, we need to store the method arguments in case they are needed for type inference. They might be needed if the method in question is a generic method and no type arguments are provided at the call site. Since we do serialization based on an unresolved AST, we can't tell if the method in question is generic at serialization time, so we serialize the arguments of any method invocation that doesn't specify explicit type arguments. Addresses one of the root causes of #32394 Change-Id: Ibb50bdfc5ed29a518f51b13d2ffd72c484ab461d Reviewed-on: https://dart-review.googlesource.com/46301 Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Paul Berry <[email protected]>
I'm going to delay further work on this until #32525 is fixed, since fixing #32525 is likely to change the internal representation of expressions used during inference. If we're lucky, the fix for #32525 will be to share enough code with the AST-based type inference mechanism that this bug gets fixed in the process. If we aren't, I'll come back and look at this bug after #32525 is finished. |
currently blocked on #32525 |
And, possibly the fix for #32525 will help here as well. |
Fix out for review: https://dart-review.googlesource.com/c/sdk/+/48741/1..2 |
The code below should issue an error on the assignment to
p
, or should issue a warning that top level inference can not be performed. Currently it seems to work correctly on task model and CFE but not driver.Passing on:
The text was updated successfully, but these errors were encountered: