-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Suppress spurious Suppression #22383
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
Conversation
By making it a case class so toString is useful, I can tell that not all the suppressions were the same. Here it's visible that
In fact the duplication is because it sticks to everything:
Does this make the annotation useless? Well, check unused does say that a param is used iff its param accessor is used. Both should warn or neither; similarly for modules in whatever you call their dual nature. Normally, the "duplicate" warning would be ignored at the same position, assuming the message text also aligns. But that is nonsense. The sensible way is to ignore duplicate nowarns with equal |
04d695e
to
1bf2dfa
Compare
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.
Looks Good! Thanks!
Guard against multiple registrations of nowarn on related elements. Fixes scala#18341
Guard against multiple registrations of nowarn on related elements. Fixes scala#18341 [Cherry-picked a377c8a][modified]
Fixes #23651 The [previous fix](#22383) for the same `@nowarn` attached to multiple elements should have compared the `annotPos` to identify duplicates (instead of the target range). This commit defers detecting "bad" or duplicate suppressions (which originate with the same annotation) to report time, after the suppression is "unused"; there are few nowarns per file and fewer that are unused. While checking for a suppression, mark matching unused suppressions as "superseded", so that if they remain unused, the warning can add an "audit" that the nowarn matched a diagnostic (but was superseded by some other nowarn). ~This commit goes further and checks for duplicates (including whether the filters look the same).~ ~If it finds a duplicate where the `annotPos` differs, warn about the user-written annotation.~ ~Filters match each other if they are the same type and, if they have a pattern, the string representations of the patterns are equal.~
Fixes scala#23651 The [previous fix](scala#22383) for the same `@nowarn` attached to multiple elements should have compared the `annotPos` to identify duplicates (instead of the target range). This commit defers detecting "bad" or duplicate suppressions (which originate with the same annotation) to report time, after the suppression is "unused"; there are few nowarns per file and fewer that are unused. While checking for a suppression, mark matching unused suppressions as "superseded", so that if they remain unused, the warning can add an "audit" that the nowarn matched a diagnostic (but was superseded by some other nowarn). ~This commit goes further and checks for duplicates (including whether the filters look the same).~ ~If it finds a duplicate where the `annotPos` differs, warn about the user-written annotation.~ ~Filters match each other if they are the same type and, if they have a pattern, the string representations of the patterns are equal.~
Fixes scala#23651 The [previous fix](scala#22383) for the same `@nowarn` attached to multiple elements should have compared the `annotPos` to identify duplicates (instead of the target range). This commit defers detecting "bad" or duplicate suppressions (which originate with the same annotation) to report time, after the suppression is "unused"; there are few nowarns per file and fewer that are unused. While checking for a suppression, mark matching unused suppressions as "superseded", so that if they remain unused, the warning can add an "audit" that the nowarn matched a diagnostic (but was superseded by some other nowarn). ~This commit goes further and checks for duplicates (including whether the filters look the same).~ ~If it finds a duplicate where the `annotPos` differs, warn about the user-written annotation.~ ~Filters match each other if they are the same type and, if they have a pattern, the string representations of the patterns are equal.~ [Cherry-picked 40843f7][modified]
Fixes #23651 The [previous fix](#22383) for the same `@nowarn` attached to multiple elements should have compared the `annotPos` to identify duplicates (instead of the target range). This commit defers detecting "bad" or duplicate suppressions (which originate with the same annotation) to report time, after the suppression is "unused"; there are few nowarns per file and fewer that are unused. While checking for a suppression, mark matching unused suppressions as "superseded", so that if they remain unused, the warning can add an "audit" that the nowarn matched a diagnostic (but was superseded by some other nowarn). ~This commit goes further and checks for duplicates (including whether the filters look the same).~ ~If it finds a duplicate where the `annotPos` differs, warn about the user-written annotation.~ ~Filters match each other if they are the same type and, if they have a pattern, the string representations of the patterns are equal.~ [Cherry-picked 40843f7]
Guard against multiple registrations of nowarn on related elements.
Fixes #18341