-
Notifications
You must be signed in to change notification settings - Fork 788
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
Hex integer literal has unexpected value #18041
Comments
I believe this is indeed more or less what happens. |
I think you're right. I remember that I had to adapt the parsing code to support 64-bit numbers when I stole it from the F# compiler for my own purposes. |
You can see here that |
I can't remember whether this widening conversion would always have compiled or was part of https://github.com/fsharp/fslang-design/blob/main/FSharp-6.0/FS-1093-additional-conversions.md. |
Worth checking if this was introduced with implicit conversions |
To add more context, as discussed before, it is likely that one scenario "goes" through literals "path", another through implicit (compile-time) conversion. |
Hex literals that would represent a negative number as a 32-bit value have an unexpected value when bound to a 64-bit value.
Repro steps
Expected behavior
Not sure. It should either:
a
should be equal tob
Actual behavior
a
has a value of -1, as if it was first parsed as a 32-bit signed integer and then converted to a 64-bit integer.Known workarounds
L
suffix to the literal0_
to force the value to be parsed as a 64-bit integer (i. e.0x0_ffff_ffff
)The text was updated successfully, but these errors were encountered: