From 065a0026924f722e9844c8e314180bb4cebca236 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Mon, 26 Oct 2015 09:47:21 +0100 Subject: Don't count suppressed errors If an error message was supressed to count it in the total. --- src/dotty/tools/dotc/reporting/Reporter.scala | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'src/dotty/tools/dotc/reporting/Reporter.scala') 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) -- cgit v1.2.3