@@ -21,11 +21,7 @@ object Reporter {
21
21
/** Convert a SimpleReporter into a real Reporter */
22
22
def fromSimpleReporter (simple : interfaces.SimpleReporter ): Reporter =
23
23
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)
29
25
}
30
26
31
27
/** A reporter that ignores reports, and doesn't record errors */
@@ -143,47 +139,48 @@ abstract class Reporter extends interfaces.ReporterResult {
143
139
def issueIfNotSuppressed (dia : Diagnostic )(using Context ): Unit =
144
140
def go () =
145
141
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)
153
152
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
154
170
}
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
169
172
170
- dia match {
173
+ dia match
171
174
case w : Warning if ctx.run != null =>
172
175
val sup = ctx.run.suppressions
173
176
if sup.suppressionsComplete(w.pos.source) then
174
177
if ! sup.isSuppressed(w) then go()
175
178
else
176
179
sup.addSuspendedMessage(w)
177
180
case _ => go()
178
- }
181
+ end issueIfNotSuppressed
179
182
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)
187
184
188
185
def incomplete (dia : Diagnostic )(using Context ): Unit =
189
186
incompleteHandler(dia, ctx)
0 commit comments