Skip to content

Commit d09dd2a

Browse files
authored
Merge pull request #14503 from dotty-staging/track-nested-unreported
2 parents e492f7a + 5b9ede4 commit d09dd2a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

compiler/src/dotty/tools/dotc/reporting/Reporter.scala

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,14 +137,17 @@ abstract class Reporter extends interfaces.ReporterResult {
137137

138138
var unreportedWarnings: Map[String, Int] = Map.empty
139139

140+
def addUnreported(key: String, n: Int): Unit =
141+
val count = unreportedWarnings.getOrElse(key, 0)
142+
unreportedWarnings = unreportedWarnings.updated(key, count + n)
143+
140144
/** Issue the diagnostic, ignoring `-Wconf` and `@nowarn` configurations,
141145
* but still honouring `-nowarn`, `-Werror`, and conditional warnings. */
142146
def issueUnconfigured(dia: Diagnostic)(using Context): Unit = dia match
143147
case w: Warning if ctx.settings.silentWarnings.value =>
144148
case w: ConditionalWarning if w.isSummarizedConditional =>
145149
val key = w.enablingOption.name
146-
val count = unreportedWarnings.getOrElse(key, 0)
147-
unreportedWarnings = unreportedWarnings.updated(key, count + 1)
150+
addUnreported(key, 1)
148151
case _ =>
149152
// conditional warnings that are not enabled are not fatal
150153
val d = dia match
@@ -241,6 +244,8 @@ abstract class Reporter extends interfaces.ReporterResult {
241244
def flush()(using Context): Unit =
242245
val msgs = removeBufferedMessages
243246
if msgs.nonEmpty then msgs.foreach(ctx.reporter.report)
247+
for (key, count) <- unreportedWarnings do
248+
ctx.reporter.addUnreported(key, count)
244249

245250
/** If this reporter buffers messages, all buffered messages, otherwise Nil */
246251
def pendingMessages(using Context): List[Diagnostic] = Nil

0 commit comments

Comments
 (0)