Commit 40843f7
authored
Add suppression if nowarn differs (#23652)
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.~1 parent 408298d commit 40843f7
File tree
7 files changed
+257
-216
lines changed- compiler/src/dotty/tools/dotc
- reporting
- tests
- neg
- warn
7 files changed
+257
-216
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
95 | | - | |
96 | | - | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
97 | 103 | | |
98 | | - | |
| 104 | + | |
99 | 105 | | |
100 | | - | |
| 106 | + | |
101 | 107 | | |
102 | | - | |
| 108 | + | |
| 109 | + | |
103 | 110 | | |
104 | 111 | | |
105 | 112 | | |
| |||
118 | 125 | | |
119 | 126 | | |
120 | 127 | | |
121 | | - | |
122 | | - | |
123 | 128 | | |
124 | 129 | | |
125 | 130 | | |
126 | | - | |
| 131 | + | |
127 | 132 | | |
128 | 133 | | |
129 | 134 | | |
| |||
134 | 139 | | |
135 | 140 | | |
136 | 141 | | |
137 | | - | |
| 142 | + | |
| 143 | + | |
138 | 144 | | |
139 | 145 | | |
140 | 146 | | |
141 | 147 | | |
142 | 148 | | |
143 | 149 | | |
144 | 150 | | |
145 | | - | |
146 | | - | |
147 | 151 | | |
148 | | - | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
149 | 161 | | |
150 | 162 | | |
151 | 163 | | |
| |||
411 | 423 | | |
412 | 424 | | |
413 | 425 | | |
414 | | - | |
| 426 | + | |
415 | 427 | | |
416 | 428 | | |
417 | 429 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
136 | 137 | | |
137 | 138 | | |
138 | 139 | | |
139 | | - | |
140 | | - | |
141 | | - | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
142 | 147 | | |
143 | | - | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
144 | 151 | | |
145 | 152 | | |
146 | 153 | | |
147 | 154 | | |
148 | 155 | | |
| 156 | + | |
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
0 commit comments