Skip to content
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

VM const evaluation fails to recognize 2 == 2.0. #42946

Closed
lrhn opened this issue Aug 5, 2020 · 2 comments
Closed

VM const evaluation fails to recognize 2 == 2.0. #42946

lrhn opened this issue Aug 5, 2020 · 2 comments
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@lrhn
Copy link
Member

lrhn commented Aug 5, 2020

See: https://stackoverflow.com/questions/63261894/int-and-double-equality-with-const-in-dart

Example:

main() {
  const x = (2 == 2.0);
  print(x); // prints `false`
}

This should print true, and it does so for dart2js (according to dartpad), so it seems to be a VM issue.

Tested with the following VMs:

  • 2.10.0-3.0.dev
  • 2.9.0-21.4-beta

on Windows (Chocolatey installs).

@lrhn lrhn added area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels Aug 5, 2020
@mraleph
Copy link
Member

mraleph commented Aug 5, 2020

Constant evaluation is done in the front-end, so it's a front-end issue.

@mraleph mraleph added area-front-end Use area-front-end for front end / CFE / kernel format related issues. and removed area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. labels Aug 5, 2020
dart-bot pushed a commit that referenced this issue Aug 7, 2020
fix bug in constant eval.
#42946

``` dart
main() {
  const x = (2 == 2.0);
  print(x); // prints `true`
}
```

@mraleph

Closes #42949
#42949

GitOrigin-RevId: 79feed7
Change-Id: I0af49901af7fdbc42a0f84d8ef49c3cbd1e32911
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157341
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
@lfkdsk
Copy link
Contributor

lfkdsk commented Aug 7, 2020

fix it #42949

@mraleph mraleph closed this as completed Aug 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

3 participants