diff options
author | Martin Odersky <odersky@gmail.com> | 2015-10-26 09:47:21 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2015-10-26 09:47:21 +0100 |
commit | 065a0026924f722e9844c8e314180bb4cebca236 (patch) | |
tree | 5b3beb65682e12c729c68ecd2b61b9a4d16bc2f8 /src | |
parent | d4f30d1a268a51ee74c98f6ae0f45136274536af (diff) | |
download | dotty-065a0026924f722e9844c8e314180bb4cebca236.tar.gz dotty-065a0026924f722e9844c8e314180bb4cebca236.tar.bz2 dotty-065a0026924f722e9844c8e314180bb4cebca236.zip |
Don't count suppressed errors
If an error message was supressed to count it in the total.
Diffstat (limited to 'src')
4 files changed, 21 insertions, 16 deletions
diff --git a/src/dotty/tools/dotc/reporting/ConsoleReporter.scala b/src/dotty/tools/dotc/reporting/ConsoleReporter.scala index 26e6324eb..3e2aaa880 100644 --- a/src/dotty/tools/dotc/reporting/ConsoleReporter.scala +++ b/src/dotty/tools/dotc/reporting/ConsoleReporter.scala @@ -40,8 +40,9 @@ class ConsoleReporter( } } - override def doReport(d: Diagnostic)(implicit ctx: Context): Unit = - if (!d.isSuppressed || !hasErrors) d match { + override def doReport(d: Diagnostic)(implicit ctx: Context): Boolean = { + val issue = !(d.isSuppressed && hasErrors) + if (issue) d match { case d: Error => printMessageAndPos(s"error: ${d.msg}", d.pos) if (ctx.settings.prompt.value) displayPrompt() @@ -51,6 +52,8 @@ class ConsoleReporter( case _ => printMessageAndPos(d.msg, d.pos) } + issue + } 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 7c9d1fa79..0358f71f6 100644 --- a/src/dotty/tools/dotc/reporting/Reporter.scala +++ b/src/dotty/tools/dotc/reporting/Reporter.scala @@ -181,8 +181,10 @@ trait Reporting { this: Context => */ abstract class Reporter { - /** Report a diagnostic */ - def doReport(d: Diagnostic)(implicit ctx: Context): Unit + /** Report a diagnostic, unless it is suppressed because it is nonsensical + * @return a diagnostic was reported. + */ + def doReport(d: Diagnostic)(implicit ctx: Context): Boolean /** Whether very long lines can be truncated. This exists so important * debugging information (like printing the classpath) is not rendered @@ -220,16 +222,15 @@ abstract class Reporter { override def default(key: String) = 0 } - def report(d: Diagnostic)(implicit ctx: Context): Unit = if (!isHidden(d)) { - doReport(d)(ctx.addMode(Mode.Printing)) - d match { - case d: ConditionalWarning if !d.enablingOption.value => unreportedWarnings(d.enablingOption.name) += 1 - case d: Warning => warningCount += 1 - case d: Error => errorCount += 1 - case d: Info => // nothing to do here - // match error if d is something else - } - } + def report(d: Diagnostic)(implicit ctx: Context): Unit = + if (!isHidden(d) && doReport(d)(ctx.addMode(Mode.Printing))) + d match { + case d: ConditionalWarning if !d.enablingOption.value => unreportedWarnings(d.enablingOption.name) += 1 + case d: Warning => warningCount += 1 + case d: Error => errorCount += 1 + case d: Info => // nothing to do here + // match error if d is something else + } def incomplete(d: Diagnostic)(implicit ctx: Context): Unit = incompleteHandler(d)(ctx) diff --git a/src/dotty/tools/dotc/reporting/StoreReporter.scala b/src/dotty/tools/dotc/reporting/StoreReporter.scala index 1991790b5..8209839eb 100644 --- a/src/dotty/tools/dotc/reporting/StoreReporter.scala +++ b/src/dotty/tools/dotc/reporting/StoreReporter.scala @@ -14,10 +14,11 @@ class StoreReporter(outer: Reporter) extends Reporter { private var infos: mutable.ListBuffer[Diagnostic] = null - def doReport(d: Diagnostic)(implicit ctx: Context): Unit = { + def doReport(d: Diagnostic)(implicit ctx: Context): Boolean = { typr.println(s">>>> StoredError: ${d.msg}") // !!! DEBUG if (infos == null) infos = new mutable.ListBuffer infos += d + true } override def hasPending: Boolean = infos != null && { diff --git a/src/dotty/tools/dotc/reporting/ThrowingReporter.scala b/src/dotty/tools/dotc/reporting/ThrowingReporter.scala index 026453036..7c63383e9 100644 --- a/src/dotty/tools/dotc/reporting/ThrowingReporter.scala +++ b/src/dotty/tools/dotc/reporting/ThrowingReporter.scala @@ -11,7 +11,7 @@ import Reporter._ * info to the underlying reporter. */ class ThrowingReporter(reportInfo: Reporter) extends Reporter { - def doReport(d: Diagnostic)(implicit ctx: Context): Unit = d match { + def doReport(d: Diagnostic)(implicit ctx: Context): Boolean = d match { case _: Error => throw d case _ => reportInfo.doReport(d) } |