Skip to content

Commit

Permalink
Merge pull request #14503 from dotty-staging/track-nested-unreported
Browse files Browse the repository at this point in the history
  • Loading branch information
dwijnand authored Feb 17, 2022
2 parents e492f7a + 5b9ede4 commit d09dd2a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions compiler/src/dotty/tools/dotc/reporting/Reporter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,17 @@ abstract class Reporter extends interfaces.ReporterResult {

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

def addUnreported(key: String, n: Int): Unit =
val count = unreportedWarnings.getOrElse(key, 0)
unreportedWarnings = unreportedWarnings.updated(key, count + n)

/** Issue the diagnostic, ignoring `-Wconf` and `@nowarn` configurations,
* but still honouring `-nowarn`, `-Werror`, and conditional warnings. */
def issueUnconfigured(dia: Diagnostic)(using Context): Unit = dia match
case w: Warning if ctx.settings.silentWarnings.value =>
case w: ConditionalWarning if w.isSummarizedConditional =>
val key = w.enablingOption.name
val count = unreportedWarnings.getOrElse(key, 0)
unreportedWarnings = unreportedWarnings.updated(key, count + 1)
addUnreported(key, 1)
case _ =>
// conditional warnings that are not enabled are not fatal
val d = dia match
Expand Down Expand Up @@ -241,6 +244,8 @@ abstract class Reporter extends interfaces.ReporterResult {
def flush()(using Context): Unit =
val msgs = removeBufferedMessages
if msgs.nonEmpty then msgs.foreach(ctx.reporter.report)
for (key, count) <- unreportedWarnings do
ctx.reporter.addUnreported(key, count)

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

0 comments on commit d09dd2a

Please sign in to comment.