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
[SR-10262] Floating Point Literal Parsing rounding issues #52662
Comments
I suspect that this is just the long-standing issue with float parsing on Windows, not Swift-specific. We would like to do our own float parsing for this and other reasons (SR-7124), but I believe that this is just an underlying platform bug (which MS may have finally fixed recently?) |
I suspect it's not even that: I think our enum uniquing is based on the literal kinds, and we don't bother to turn integer literals into floating-point values during the uniquing. |
Actually, it's not quite obvious how we would do this checking, since Double is both IntegerLiteralConvertible and FloatLiteralConvertible. Something like NSNumber would in fact treat these as distinct. |
Some other edge cases:
|
@stephentyrone, it seemed to be going through swift/lib/Sema/TypeCheckDecl.cpp Lines 96 to 123 in 13e805e
APSInt is converted to an integeral value (particularly L99 and L109). I'm confused as to how L112-L122 ever get executed though.
|
Okay, reduced this to a set of test cases which don't require swift at all. Seems like an issue in |
Additionally, it seems that the conversion error occurs in the |
Additional Detail from JIRA
md5: 225f5eb4a5a89a7d6e90b3aa974ee49d
blocks:
Issue Description:
The following sample:
fails to resolve the cases as equivalent. The integral value is processed correctly as
0x7fffffffffffffff
The floating point case is processed as0x8000000000000000
which causes the duplicate value to not be treated as a duplicate.This reproduces on the Windows host.
The text was updated successfully, but these errors were encountered: