@@ -118,18 +118,11 @@ extends ImplicitRunInfo, ConstraintRunInfo, cc.CaptureRunInfo {
118118 .merge
119119 addSuppression :
120120 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
123121
124122 def addSuppression (sup : Suppression ): Unit =
125123 val suppressions = mySuppressions.getOrElseUpdate(sup.annotPos.source, ListBuffer .empty)
126124 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
133126
134127 def reportSuspendedMessages (source : SourceFile )(using Context ): Unit = {
135128 // sort suppressions. they are not added in any particular order because of lazy type completion
@@ -147,10 +140,14 @@ extends ImplicitRunInfo, ConstraintRunInfo, cc.CaptureRunInfo {
147140 for
148141 source <- mySuppressions.keysIterator.toList
149142 sups <- mySuppressions.remove(source)
150- sup <- sups.reverse
151- if ! sup.used
152143 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)
154151
155152 /** The compilation units currently being compiled, this may return different
156153 * results over time.
0 commit comments