diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2012-09-26 07:43:48 +0200 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2012-09-27 15:49:01 +0200 |
commit | ca9d2149e964604daf3a8d88d6946217ef90c643 (patch) | |
tree | 0d285f2f1a28382be9a43cddd8d148a73b7422f5 /test/files/run/toolbox_console_reporter.scala | |
parent | 7911f9e85b3798d449d6b551d7c8be15cc63f240 (diff) | |
download | scala-ca9d2149e964604daf3a8d88d6946217ef90c643.tar.gz scala-ca9d2149e964604daf3a8d88d6946217ef90c643.tar.bz2 scala-ca9d2149e964604daf3a8d88d6946217ef90c643.zip |
removes front ends from scala-reflect.jar
It was an interesting idea to give macro developers control over front ends,
but it hasn't given any visible results.
To the contrast, front ends have proven useful for toolboxes to easily control
what errors get printed where.
Therefore I'm moving front ends to scala-compiler.jar to clean up the API.
Yay for scaladoc-driven development!
Diffstat (limited to 'test/files/run/toolbox_console_reporter.scala')
-rw-r--r-- | test/files/run/toolbox_console_reporter.scala | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/test/files/run/toolbox_console_reporter.scala b/test/files/run/toolbox_console_reporter.scala index a57dea38a8..d672ccb9cb 100644 --- a/test/files/run/toolbox_console_reporter.scala +++ b/test/files/run/toolbox_console_reporter.scala @@ -1,16 +1,29 @@ import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.{ToolBox, mkConsoleFrontEnd} object Test extends App { - // todo. cannot test this unfortunately, because ConsoleFrontEnd grabs Console.out too early - // todo. and isn't affected by Console.setOut employed by partest to intercept output + val oldErr = Console.err; + val baos = new java.io.ByteArrayOutputStream(); + Console.setErr(new java.io.PrintStream(baos)); + try { + val toolbox = cm.mkToolBox(frontEnd = mkConsoleFrontEnd(), options = "-deprecation") + toolbox.eval(reify{ + object Utils { + @deprecated("test", "2.10.0") + def foo { println("hello") } + } - //val toolbox = mkToolBox(frontEnd = mkConsoleFrontEnd(), options = "-deprecation") - //toolbox.eval(reify{ - // object Utils { - // @deprecated("test", "2.10.0") - // def foo { println("hello") } - // } - // - // Utils.foo - //}) + Utils.foo + }.tree) + println("============compiler console=============") + println(baos.toString); + println("=========================================") + println("============compiler messages============") + toolbox.frontEnd.infos.foreach(println(_)) + println("=========================================") + } finally { + Console.setErr(oldErr); + } }
\ No newline at end of file |