aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/reporting/Reporter.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-04-27 10:33:00 +0200
committerMartin Odersky <odersky@gmail.com>2016-04-27 14:01:41 +0200
commit5e599cc14ac0dfe9f7b7605e537808c927e7a6a3 (patch)
tree76c27f128a5aed82d52dda4ca1c5d79f6aff9a19 /src/dotty/tools/dotc/reporting/Reporter.scala
parent4d7aaf637edafa1305602fc9f63b4c2ed4288ad5 (diff)
downloaddotty-5e599cc14ac0dfe9f7b7605e537808c927e7a6a3.tar.gz
dotty-5e599cc14ac0dfe9f7b7605e537808c927e7a6a3.tar.bz2
dotty-5e599cc14ac0dfe9f7b7605e537808c927e7a6a3.zip
Rename Reporting#println -> Reporting#echo
There's a trap otherwise that, when in a class inheriting from Context (and with it Reporting) a call to println will go to this.println and therefore might not print at all, if the current context buffers messages. I lost a lot of time on this on several occasions when I scratched my head why a simple debug println would not show. Better avoid this in the future for myself and others.
Diffstat (limited to 'src/dotty/tools/dotc/reporting/Reporter.scala')
-rw-r--r--src/dotty/tools/dotc/reporting/Reporter.scala9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/dotty/tools/dotc/reporting/Reporter.scala b/src/dotty/tools/dotc/reporting/Reporter.scala
index 44defa6b1..e4169b1fd 100644
--- a/src/dotty/tools/dotc/reporting/Reporter.scala
+++ b/src/dotty/tools/dotc/reporting/Reporter.scala
@@ -51,9 +51,9 @@ trait Reporting { this: Context =>
/** For sending messages that are printed only if -verbose is set */
def inform(msg: => String, pos: SourcePosition = NoSourcePosition): Unit =
- if (this.settings.verbose.value) this.println(msg, pos)
+ if (this.settings.verbose.value) this.echo(msg, pos)
- def println(msg: => String, pos: SourcePosition = NoSourcePosition): Unit =
+ def echo(msg: => String, pos: SourcePosition = NoSourcePosition): Unit =
reporter.report(new Info(msg, pos))
def deprecationWarning(msg: => String, pos: SourcePosition = NoSourcePosition): Unit =
@@ -95,7 +95,7 @@ trait Reporting { this: Context =>
*/
def log(msg: => String, pos: SourcePosition = NoSourcePosition): Unit =
if (this.settings.log.value.containsPhase(phase))
- this.println(s"[log ${ctx.phasesStack.reverse.mkString(" -> ")}] $msg", pos)
+ echo(s"[log ${ctx.phasesStack.reverse.mkString(" -> ")}] $msg", pos)
def debuglog(msg: => String): Unit =
if (ctx.debug) log(msg)
@@ -243,8 +243,7 @@ abstract class Reporter extends interfaces.ReporterResult {
/** Print the summary of warnings and errors */
def printSummary(implicit ctx: Context): Unit = {
val s = summary
- if (s != "")
- ctx.println(s)
+ if (s != "") ctx.echo(s)
}
/** Returns a string meaning "n elements". */