Skip to content

[REVISIT] Warn when arms of if or match lub to Any #10479

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

Closed

Conversation

som-snytt
Copy link
Contributor

@scala-jenkins scala-jenkins added this to the 2.13.13 milestone Jul 29, 2023
@som-snytt som-snytt marked this pull request as draft July 30, 2023 10:53
@som-snytt
Copy link
Contributor Author

It should warn only when inferred type of bipedal (two-legged) if results in inferred Any of some def. In statement position, we don't care about the type, unless it implies a value was produced but unused, so that test should be applied to the legs (or arms). (-Wnonunit-statement or -if already does something like that?)

@som-snytt
Copy link
Contributor Author

This is folded into the PR to improve -Wnonunit-statement.

@som-snytt som-snytt closed this Aug 2, 2023
@SethTisue SethTisue removed this from the 2.13.13 milestone Aug 3, 2023
@som-snytt som-snytt changed the title Warn when arms of if or match lub to Any [SUPERSEDED] Warn when arms of if or match lub to Any Jan 27, 2024
@som-snytt
Copy link
Contributor Author

This was not folded.

@som-snytt som-snytt changed the title [SUPERSEDED] Warn when arms of if or match lub to Any Warn when arms of if or match lub to Any Mar 14, 2024
@som-snytt som-snytt reopened this Mar 14, 2024
@scala-jenkins scala-jenkins added this to the 2.13.15 milestone Mar 14, 2024
@som-snytt som-snytt closed this Mar 20, 2024
@SethTisue SethTisue removed this from the 2.13.15 milestone Mar 21, 2024
@som-snytt som-snytt changed the title Warn when arms of if or match lub to Any [REVISIT] Warn when arms of if or match lub to Any Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

-Xlint:infer-any should warn if Any is inferred for if-else and method result
3 participants