diff options
author | Martin Odersky <odersky@gmail.com> | 2014-12-17 15:04:05 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-12-17 15:04:05 +0100 |
commit | 329b639970194128136cb54f2a8aa9c0e35fc2bc (patch) | |
tree | 482da6d44e8a864c5120fced42f6c3be14d612dd /src | |
parent | 215be8b1c8c790cbab9260b2d4bb1f6873cbf7d0 (diff) | |
download | dotty-329b639970194128136cb54f2a8aa9c0e35fc2bc.tar.gz dotty-329b639970194128136cb54f2a8aa9c0e35fc2bc.tar.bz2 dotty-329b639970194128136cb54f2a8aa9c0e35fc2bc.zip |
Move isSuppressed check from Reporter to ConsoleReporter.
isSuppressed forces computation of the error message; should be
called only when emitting the error.
TODO: Generalize so that other emitting reporters inherit the behavior.
Diffstat (limited to 'src')
-rw-r--r-- | src/dotty/tools/dotc/reporting/ConsoleReporter.scala | 21 | ||||
-rw-r--r-- | src/dotty/tools/dotc/reporting/Reporter.scala | 2 |
2 files changed, 12 insertions, 11 deletions
diff --git a/src/dotty/tools/dotc/reporting/ConsoleReporter.scala b/src/dotty/tools/dotc/reporting/ConsoleReporter.scala index 6991cdbb6..a7f7f70bb 100644 --- a/src/dotty/tools/dotc/reporting/ConsoleReporter.scala +++ b/src/dotty/tools/dotc/reporting/ConsoleReporter.scala @@ -40,16 +40,17 @@ class ConsoleReporter( } } - override def doReport(d: Diagnostic)(implicit ctx: Context): Unit = d match { - case d: Error => - printMessageAndPos(s"error: ${d.msg}", d.pos) - if (ctx.settings.prompt.value) displayPrompt() - case d: ConditionalWarning if !d.enablingOption.value => - case d: Warning => - printMessageAndPos(s"warning: ${d.msg}", d.pos) - case _ => - printMessageAndPos(d.msg, d.pos) - } + override def doReport(d: Diagnostic)(implicit ctx: Context): Unit = + if (!d.isSuppressed) d match { + case d: Error => + printMessageAndPos(s"error: ${d.msg}", d.pos) + if (ctx.settings.prompt.value) displayPrompt() + case d: ConditionalWarning if !d.enablingOption.value => + case d: Warning => + printMessageAndPos(s"warning: ${d.msg}", d.pos) + case _ => + printMessageAndPos(d.msg, d.pos) + } def displayPrompt(): Unit = { writer.print("\na)bort, s)tack, r)esume: ") diff --git a/src/dotty/tools/dotc/reporting/Reporter.scala b/src/dotty/tools/dotc/reporting/Reporter.scala index 5fa34bfce..dc6d8c6ab 100644 --- a/src/dotty/tools/dotc/reporting/Reporter.scala +++ b/src/dotty/tools/dotc/reporting/Reporter.scala @@ -216,7 +216,7 @@ abstract class Reporter { def report(d: Diagnostic)(implicit ctx: Context): Unit = if (!isHidden(d)) { doReport(d) - if (!d.isSuppressed) d match { + d match { case d: ConditionalWarning if !d.enablingOption.value => unreportedWarnings(d.enablingOption.name) += 1 case d: Warning => warningCount += 1 case d: Error => errorCount += 1 |