@@ -21,11 +21,7 @@ object Reporter {
2121 /** Convert a SimpleReporter into a real Reporter */
2222 def fromSimpleReporter (simple : interfaces.SimpleReporter ): Reporter =
2323 new Reporter with UniqueMessagePositions with HideNonSensicalMessages {
24- override def doReport (dia : Diagnostic )(using Context ): Unit = dia match {
25- case dia : ConditionalWarning if ! dia.enablingOption.value =>
26- case _ =>
27- simple.report(dia)
28- }
24+ override def doReport (dia : Diagnostic )(using Context ): Unit = simple.report(dia)
2925 }
3026
3127 /** A reporter that ignores reports, and doesn't record errors */
@@ -143,47 +139,48 @@ abstract class Reporter extends interfaces.ReporterResult {
143139 def issueIfNotSuppressed (dia : Diagnostic )(using Context ): Unit =
144140 def go () =
145141 import Action ._
146- val toReport = dia match {
147- case w : Warning => WConf .parsed.action(dia) match {
148- case Silent => None
149- case Info => Some (w.toInfo)
150- case Warning => Some (w)
151- case Error => Some (w.toError)
152- }
142+
143+ val toReport = dia match
144+ case w : Warning =>
145+ if ctx.settings.silentWarnings.value then None
146+ else if ctx.settings.XfatalWarnings .value && ! w.isSummarizedConditional then Some (w.toError)
147+ else WConf .parsed.action(dia) match
148+ case Silent => None
149+ case Info => Some (w.toInfo)
150+ case Warning => Some (w)
151+ case Error => Some (w.toError)
153152 case _ => Some (dia)
153+
154+ toReport foreach {
155+ case cw : ConditionalWarning if cw.isSummarizedConditional =>
156+ val key = cw.enablingOption.name
157+ unreportedWarnings =
158+ unreportedWarnings.updated(key, unreportedWarnings.getOrElse(key, 0 ) + 1 )
159+ case d if ! isHidden(d) =>
160+ withMode(Mode .Printing )(doReport(d))
161+ d match {
162+ case _ : Warning => _warningCount += 1
163+ case e : Error =>
164+ errors = e :: errors
165+ _errorCount += 1
166+ case _ : Info => // nothing to do here
167+ // match error if d is something else
168+ }
169+ case _ => // hidden
154170 }
155- for (d <- toReport) {
156- withMode(Mode .Printing )(doReport(d))
157- d match
158- case cw : ConditionalWarning if ! cw.enablingOption.value =>
159- val key = cw.enablingOption.name
160- unreportedWarnings =
161- unreportedWarnings.updated(key, unreportedWarnings.getOrElse(key, 0 ) + 1 )
162- case _ : Warning => _warningCount += 1
163- case e : Error =>
164- errors = e :: errors
165- _errorCount += 1
166- case _ : Info => // nothing to do here
167- // match error if d is something else
168- }
171+ end go
169172
170- dia match {
173+ dia match
171174 case w : Warning if ctx.run != null =>
172175 val sup = ctx.run.suppressions
173176 if sup.suppressionsComplete(w.pos.source) then
174177 if ! sup.isSuppressed(w) then go()
175178 else
176179 sup.addSuspendedMessage(w)
177180 case _ => go()
178- }
181+ end issueIfNotSuppressed
179182
180- def report (dia : Diagnostic )(using Context ): Unit =
181- val isSummarized = dia match
182- case cw : ConditionalWarning => ! cw.enablingOption.value
183- case _ => false
184- // avoid isHidden test for summarized warnings so that message is not forced
185- if isSummarized || ! isHidden(dia) then
186- issueIfNotSuppressed(dia)
183+ def report (dia : Diagnostic )(using Context ): Unit = issueIfNotSuppressed(dia)
187184
188185 def incomplete (dia : Diagnostic )(using Context ): Unit =
189186 incompleteHandler(dia, ctx)
0 commit comments