diff options
author | Felix Mulder <felix.mulder@gmail.com> | 2016-09-16 22:07:36 +0200 |
---|---|---|
committer | Felix Mulder <felix.mulder@gmail.com> | 2016-10-10 13:25:34 +0200 |
commit | 30b54109e3f535b417249057c2a548808082e06b (patch) | |
tree | c4c82691ca65684ea5104994c904ef2a7df73417 /src/dotty/tools/dotc/reporting/Reporter.scala | |
parent | 15dfb56d63a893c5c1e34a8566004085a617c28b (diff) | |
download | dotty-30b54109e3f535b417249057c2a548808082e06b.tar.gz dotty-30b54109e3f535b417249057c2a548808082e06b.tar.bz2 dotty-30b54109e3f535b417249057c2a548808082e06b.zip |
Factor out explanation header to Reporter
Diffstat (limited to 'src/dotty/tools/dotc/reporting/Reporter.scala')
-rw-r--r-- | src/dotty/tools/dotc/reporting/Reporter.scala | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/src/dotty/tools/dotc/reporting/Reporter.scala b/src/dotty/tools/dotc/reporting/Reporter.scala index 5c3dcccb7..fe226b284 100644 --- a/src/dotty/tools/dotc/reporting/Reporter.scala +++ b/src/dotty/tools/dotc/reporting/Reporter.scala @@ -75,11 +75,8 @@ trait Reporting { this: Context => def warning(msg: => String, pos: SourcePosition = NoSourcePosition): Unit = reporter.report(new Warning(msg, pos)) - def explainWarning(msg: => MessageCreator, pos: SourcePosition = NoSourcePosition): Unit = { + def explainWarning(msg: => MessageCreator, pos: SourcePosition = NoSourcePosition): Unit = reporter.report(msg.warning(pos)) - if (this.shouldExplain(msg)) - reporter.report(new Info(msg.explanation, NoSourcePosition)) - } def strictWarning(msg: => String, pos: SourcePosition = NoSourcePosition): Unit = if (this.settings.strict.value) error(msg, pos) @@ -90,11 +87,8 @@ trait Reporting { this: Context => reporter.report(new Error(msg, pos)) } - def explainError(msg: => MessageCreator, pos: SourcePosition = NoSourcePosition): Unit = { + def explainError(msg: => MessageCreator, pos: SourcePosition = NoSourcePosition): Unit = reporter.report(msg.error(pos)) - if (this.shouldExplain(msg)) - reporter.report(new Info(msg.explanation, NoSourcePosition)) - } def errorOrMigrationWarning(msg: => String, pos: SourcePosition = NoSourcePosition): Unit = if (ctx.scala2Mode) migrationWarning(msg, pos) else error(msg, pos) @@ -271,7 +265,7 @@ abstract class Reporter extends interfaces.ReporterResult { } /** Returns a string meaning "n elements". */ - private def countString(n: Int, elements: String): String = n match { + protected def countString(n: Int, elements: String): String = n match { case 0 => "no " + elements + "s" case 1 => "one " + elements case 2 => "two " + elements + "s" |