- Notifications
You must be signed in to change notification settings - Fork3.1k
Lint select fromUnit, orInt that incurs widening#10372
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
som-snytt commentedApr 10, 2023
Some current inconsistency. where With the new warning, the current warning is less correct. |
som-snytt commentedApr 10, 2023
It warns in two spots that specialize The other thought is that (as with the current warning), any promotion is dubious, it doesn't matter which member is selected. Then just need |
efd7fd9 tob84df96Comparesom-snytt commentedApr 10, 2023
The check is only at typer, which gives a pass to Not sure why it was deemed bad to allow Something became |
lrytz left a comment
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.
LGTM, and very useful.
| defcheckDubiousAdaptation(sel:Tree):Unit=if (!isPastTyper&& settings.lintNumericMethods) { | ||
| valdubious=ScalaIntegralValueClasses(qualTp.typeSymbol)&& ( | ||
| sel.symbol.owner.eq(BoxedFloatClass)|| sel.symbol.owner.eq(RichFloatClass)) |
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.
long.isNaN goes throughfloat2Float(long.toFloat), notdouble2Double, so this seems to cover it all.
b84df96 to905c92fComparesom-snytt commentedApr 11, 2023
Rebased, and enhanced It would be ideal if The option also adds In case of selection failure, |
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.
Thank you!
Unit, orInt that incurs widening
Fixesscala/bug#12728