diff options
author | Martin Odersky <odersky@gmail.com> | 2016-04-27 10:33:00 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-04-27 14:01:41 +0200 |
commit | 5e599cc14ac0dfe9f7b7605e537808c927e7a6a3 (patch) | |
tree | 76c27f128a5aed82d52dda4ca1c5d79f6aff9a19 /src/dotty/tools/dotc/transform/TreeChecker.scala | |
parent | 4d7aaf637edafa1305602fc9f63b4c2ed4288ad5 (diff) | |
download | dotty-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/transform/TreeChecker.scala')
-rw-r--r-- | src/dotty/tools/dotc/transform/TreeChecker.scala | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/dotty/tools/dotc/transform/TreeChecker.scala b/src/dotty/tools/dotc/transform/TreeChecker.scala index f11789c9a..a27c9c5f3 100644 --- a/src/dotty/tools/dotc/transform/TreeChecker.scala +++ b/src/dotty/tools/dotc/transform/TreeChecker.scala @@ -52,7 +52,7 @@ class TreeChecker extends Phase with SymTransformer { !name.exists(c => c == '.' || c == ';' || c =='[' || c == '/' || c == '<' || c == '>') def printError(str: String)(implicit ctx: Context) = { - ctx.println(Console.RED + "[error] " + Console.WHITE + str) + ctx.echo(Console.RED + "[error] " + Console.WHITE + str) } val NoSuperClass = Trait | Package @@ -118,17 +118,17 @@ class TreeChecker extends Phase with SymTransformer { def check(phasesToRun: Seq[Phase], ctx: Context) = { val prevPhase = ctx.phase.prev // can be a mini-phase val squahsedPhase = ctx.squashed(prevPhase) - ctx.println(s"checking ${ctx.compilationUnit} after phase ${squahsedPhase}") + ctx.echo(s"checking ${ctx.compilationUnit} after phase ${squahsedPhase}") val checkingCtx = ctx.fresh.setReporter(new ThrowingReporter(ctx.reporter)) val checker = new Checker(previousPhases(phasesToRun.toList)(ctx)) try checker.typedExpr(ctx.compilationUnit.tpdTree)(checkingCtx) catch { case NonFatal(ex) => //TODO CHECK. Check that we are bootstrapped implicit val ctx: Context = checkingCtx - ctx.println(i"*** error while checking ${ctx.compilationUnit} after phase ${checkingCtx.phase.prev} ***") - ctx.println(ex.toString) - ctx.println(ex.getStackTrace.take(30).deep.mkString("\n")) - ctx.println("<<<") + ctx.echo(i"*** error while checking ${ctx.compilationUnit} after phase ${checkingCtx.phase.prev} ***") + ctx.echo(ex.toString) + ctx.echo(ex.getStackTrace.take(30).deep.mkString("\n")) + ctx.echo("<<<") throw ex } } @@ -163,10 +163,10 @@ class TreeChecker extends Phase with SymTransformer { } nowDefinedSyms += tree.symbol - //ctx.println(i"defined: ${tree.symbol}") + //ctx.echo(i"defined: ${tree.symbol}") val res = op nowDefinedSyms -= tree.symbol - //ctx.println(i"undefined: ${tree.symbol}") + //ctx.echo(i"undefined: ${tree.symbol}") res case _ => op } |