-
Notifications
You must be signed in to change notification settings - Fork 10.5k
FloatLiteralExpr now is lowered directly into SIL. #23010
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
Conversation
Thank you so much for doing this! |
For context, String, Nil, Bool, and Int already behave this way. Note: Swift can compile against 80 or 64 bit floats as the builtin literal type. Thus, it was necessary to capture this bit somehow in the FloatLiteralExpr. This was done as another Type field capturing this info.
_blackHole(UInt8(-1E309)) // expected-error {{negative literal '-1E309' cannot be converted to 'UInt8'}} | ||
_blackHole(Int64(1E309)) // expected-error {{invalid conversion: '1E309' overflows 'Int64'}} | ||
_blackHole(UInt64(-1E309)) // expected-error {{negative literal '-1E309' cannot be converted to 'UInt64'}} | ||
_blackHole(Int8(1E308)) // expected-error {{invalid conversion: '1E308' overflows 'Int8'}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great to see these fixed too!
@swift-ci Please test |
@swift-ci Please test source compatibility |
Build failed |
Build failed |
@pschuh I just noticed this. It is nice that false negatives in floating point overflow/underflow detection are fixed by this. |
For context, String, Nil, Bool, and Int already behave this way.
Note: Swift can compile against 80 or 64 bit floats as the builtin
literal type. Thus, it was necessary to capture this bit somehow in the
FloatLiteralExpr. This was done as another Type field capturing this
info.