-
Notifications
You must be signed in to change notification settings - Fork 1.7k
analyzer: int2double doesn't work in const contexts #35441
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
Partially fixed by https://dart-review.googlesource.com/c/sdk/+/87607, but still failing some cases. |
I just ran into something really weird This now passes:
where it didn't before. But this still fails:
|
The information needed by the first example is completely local. The information for the second isn't, and hence depends (IIRC) on having built a dependency graph so that |
In either case |
@lrhn there are other ways to reproduce the problem:
However, these are just symptoms of the real problem, which is that x was given the wrong type. Not only does it make it easier and more reliable to test this by turning on the const updates, it also makes it more important to have fixed before the new const behavior is released. So its all related. |
Change-Id: I9505598e904e4ee39b00cbae87082f5f332f3505 Reviewed-on: https://dart-review.googlesource.com/c/87612 Commit-Queue: Mike Fairhurst <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]>
@MichaelRFairhurst can we mark this as fixed now? |
Yes, thanks for the reminder! |
This was thought to be #33441, but it turns out its its own issue:
The cause for this is actually very simple. The visitor that evaluates an AST node for const evaluation, does not look at the node's
staticType
at all, and simply creates an integer. This made sense when integer expressions were always integers.It's not a bigger issue, like inference not having been run, as we thought behind #33441. It's really easy.
We have
@failingTest
s for this in analyzer already.The text was updated successfully, but these errors were encountered: