Skip to content
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

Refine ignored cases for unused params check #20973

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jan-pieter
Copy link
Contributor

@jan-pieter jan-pieter commented Jul 2, 2024

Fixes #20951

However I don't think the current implementation is perfect: unused:params does not trigger a warning when the return value of a method is a constant but then unused:all does trigger a warning: unused local definition. But maybe that should be solved in a different PR.

This will also trigger compiler warnings for the examples in #18289 but the warning is unused explicit parameter instead of unused local definition.

@@ -0,0 +1,20 @@
//> using options -Wunused:params
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's the case that this subsumes the ticket for warning in a for comprehension (e.g. the case for x <- list yield y // warn for x, #18289) then we should add a test for that syntax as well since that ticket will no longer require any changes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also would not consider it a problem that the for comprehension warning is unused parameter instead of local. The only way around that would run into the same issues as #18854 and may be subject to the for-comprehension desugaring changes.

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.

Missing unused warnings for lambdas parameters
3 participants