-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Implement recursive top-level inference #46579
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
Note: I've just made an update to dart-lang/language#1650 describing in more detail how the analyzer and CFE currently handle top level inference, and discussing options. We may want to wait until a decision has been made on that issue before proceeding with this fix. |
https://dart-review.googlesource.com/c/sdk/+/206421 passes shared tests and smoke tests in google3. |
Global presubmit looks green. |
Is this still in the works, @scheglov ? |
It is up to the language team to decide here, whether they want to go with this change to inference. We probably should keep this open. |
@leafpetersen This is the issue about type inference that I mentioned as related to macro type inference. |
@scheglov wrote:
I just added a comment to dart-lang/language#1650, noting that there might not be a need to change anything in the spec. |
Bug: #46579 Change-Id: Ib2498e17bfb14bed2beadcf2491c98bf18e9d09a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/206421 Reviewed-by: Paul Berry <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]>
The CL landed, so I guess this can be marked fixed. |
Currently in the analyzer we do inference in two phases - first we resolve the initializer presuming all not yet inferred types of fields are
dynamic
. Then we get dependencies as elements referenced by the initializer, and infer in the topological order.Type inference in the following code in the analyzer is done incorrectly.
When we resolve the initializer of
a
, we see that it referencesb
, but its type is presumed to bedynamic
, so we don't know that it also referencesc
. So, we miss the cyclea -> c -> a
.We should do something like CFE does, and perform recursive inference.
The text was updated successfully, but these errors were encountered: