Skip to content

-Wunused:nowarn falsely reports that an annotation does not suppress any warnings #18341

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
mrdziuban opened this issue Aug 4, 2023 · 0 comments · Fixed by #22383
Closed
Assignees
Labels
area:linting Linting warnings enabled with -W or -Xlint itype:bug
Milestone

Comments

@mrdziuban
Copy link

Compiler version

3.3.0, also happens in latest 3.3.1-RC4

Minimized code

https://scastie.scala-lang.org/mrdziuban/r3gWMzhnQzWsGcUEtiNtbw/1

class Foo(@annotation.nowarn("msg=unused") x: Int)

Output

@nowarn annotation does not suppress any warnings

but removing the annotation results in a warning

unused explicit parameter

Expectation

There should be no warning on the nowarn annotation as it does suppress the unused explicit parameter warning.

@mrdziuban mrdziuban added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Aug 4, 2023
@dwijnand dwijnand added area:linting Linting warnings enabled with -W or -Xlint and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Aug 7, 2023
@KacperFKorban KacperFKorban assigned som-snytt and unassigned szymon-rd Jan 20, 2025
KacperFKorban pushed a commit that referenced this issue Jan 20, 2025
Guard against multiple registrations of nowarn on related elements.

Fixes #18341
@WojciechMazur WojciechMazur added this to the 3.7.0 milestone Mar 11, 2025
tgodzik pushed a commit to scala/scala3-lts that referenced this issue Apr 1, 2025
Guard against multiple registrations of nowarn on related elements.

Fixes scala#18341
tgodzik added a commit to scala/scala3-lts that referenced this issue Apr 1, 2025
Guard against multiple registrations of nowarn on related elements.

Fixes scala#18341
[Cherry-picked a377c8a][modified]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:linting Linting warnings enabled with -W or -Xlint itype:bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants