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
Warn constant promotions #8730
Warn constant promotions #8730
Conversation
6b33f77
to
bf7c907
Compare
Warn if widening of literal Int or Long is not safe, which is defined as the conversion roundtrips, the test used for harmonization. The test means that if I want to convert precisely back to my original value, I can do so. It does not mean the converted value maintains accuracy or number of significant digits. An attachment is used to defer the warning, since typechecking may consider expressions which are discarded, such as conversions during implicit search.
943e8d9
to
a188207
Compare
After comparing this PR with #8757, I have a tendency for the simpler solution over there. This PR introduces a warning when calling Whether to do the roundtrip or based on the number of bits, I'm fine with both. The commit message mentions to avoid warnings during implicit search, can you give an example? I wonder if this affects the other PR. |
@lrytz the issue on the original PR #7405 (comment) was whether the warning could be an ordinary deprecation, but |
OK thanks, I remember the deprecation issue now. Maybe extending I integrated the changes from this PR into #8757. |
Warn if widening of literal Int or Long is not safe,
which is defined as the conversion roundtrips, the
test used for harmonization.
Fixes scala/bug#10773