@@ -118,18 +118,11 @@ extends ImplicitRunInfo, ConstraintRunInfo, cc.CaptureRunInfo {
118
118
.merge
119
119
addSuppression :
120
120
Suppression (annotPos, filters, range.start, range.end, verbose)
121
- .tap: sup =>
122
- if filters == List (MessageFilter .None ) then sup.markUsed() // invalid suppressions, don't report as unused
123
121
124
122
def addSuppression (sup : Suppression ): Unit =
125
123
val suppressions = mySuppressions.getOrElseUpdate(sup.annotPos.source, ListBuffer .empty)
126
124
if sup.start != sup.end then
127
- suppressions.find(sup.matches(_)) match
128
- case Some (other) =>
129
- if sup.annotPos != other.annotPos then
130
- report.warning(" @nowarn annotation is duplicate" , sup.annotPos)
131
- case none =>
132
- suppressions += sup
125
+ suppressions += sup
133
126
134
127
def reportSuspendedMessages (source : SourceFile )(using Context ): Unit = {
135
128
// sort suppressions. they are not added in any particular order because of lazy type completion
@@ -147,10 +140,14 @@ extends ImplicitRunInfo, ConstraintRunInfo, cc.CaptureRunInfo {
147
140
for
148
141
source <- mySuppressions.keysIterator.toList
149
142
sups <- mySuppressions.remove(source)
150
- sup <- sups.reverse
151
- if ! sup.used
152
143
do
153
- report.warning(" @nowarn annotation does not suppress any warnings" , sup.annotPos)
144
+ val suppressions = sups.reverse.toList
145
+ for sup <- suppressions do
146
+ if ! sup.used
147
+ && ! suppressions.exists(s => s.ne(sup) && s.used && s.annotPos == sup.annotPos) // duplicate
148
+ && sup.filters != List (MessageFilter .None ) // invalid suppression, don't report as unused
149
+ then
150
+ report.warning(" @nowarn annotation does not suppress any warnings" , sup.annotPos)
154
151
155
152
/** The compilation units currently being compiled, this may return different
156
153
* results over time.
0 commit comments