-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Suppression matches inlined positions #24092
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
8cc8b05 to
5f74d71
Compare
|
It's no longer a one-liner. The motivation to refactor is in the commit to "use adjusted pos": it's hard to keep track of what position is used at any point. To summarize, there is the pos of the diagnostic (which is arbitrary), the adjusted position to render at (the most specific pos at the user call site, adjusted at EOF), and the positions in the inline stack of the diagnostic pos which are not contained by the user call site (the outermost pos) and which will be displayed in the supplemental stack trace. Some subtleties include whether the "max line" (for determining the offset of the box, to accommodate the digits) is 10 if the last line is 9 (for error at EOF, as noticed by chance by a test). There are more intermediate strings to eliminate by using the implicit |
The inlined stack includes the nonInlined pos itself, which is filtered by rendering.
5f74d71 to
e97e154
Compare
|
Removed the commit that refactors The third commit here led to that thorough refactoring. Removed |
The previous code was unclear about what pos to adjust. The diagnostic pos yields an innermost "user pos" which is adjusted at EOF. The inline stack is already filtered by position for rendering.
e97e154 to
1bfafe2
Compare
tgodzik
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!
|
I skipped on backporting this one, since there is a lot of changes in the file. If neccessary we could try backporting at some point. |
Fixes scala#24082 Makes local warning suppression aware of inlined positions. How does `@nowarn` know what to suppress? A `Suppression` is registered with the current `Run`, and when reporting, a `Suppression` `matches` a given diagnostic based on position. The diagnostic position knows its "enclosing" inlined positions, so a suppression should also match those positions.
Fixes #24082
Makes local warning suppression aware of inlined positions.
How does
@nowarnknow what to suppress? ASuppressionis registered with the currentRun, and when reporting, aSuppressionmatchesa given diagnostic based on position. The diagnostic position knows its "enclosing" inlined positions, so a suppression should also match those positions.