From e9926a5207aadcfe3831b51b1cd6164757278013 Mon Sep 17 00:00:00 2001 From: Eugene Burmako Date: Fri, 17 Feb 2012 17:10:49 +0100 Subject: Fixes miscellaneous macro bugs --- test/files/run/macro-rettype-mismatch/Macros_1.scala | 3 +++ test/files/run/macro-rettype-mismatch/Test_2.scala | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 test/files/run/macro-rettype-mismatch/Macros_1.scala create mode 100644 test/files/run/macro-rettype-mismatch/Test_2.scala (limited to 'test/files/run/macro-rettype-mismatch') diff --git a/test/files/run/macro-rettype-mismatch/Macros_1.scala b/test/files/run/macro-rettype-mismatch/Macros_1.scala new file mode 100644 index 0000000000..64e5b93468 --- /dev/null +++ b/test/files/run/macro-rettype-mismatch/Macros_1.scala @@ -0,0 +1,3 @@ +object Macros { + def macro foo(x: Int): String = x +} \ No newline at end of file diff --git a/test/files/run/macro-rettype-mismatch/Test_2.scala b/test/files/run/macro-rettype-mismatch/Test_2.scala new file mode 100644 index 0000000000..39a7c7ad1a --- /dev/null +++ b/test/files/run/macro-rettype-mismatch/Test_2.scala @@ -0,0 +1,16 @@ +import scala.tools.nsc.reporters._ +import scala.tools.nsc.Settings +import reflect.runtime.Mirror.ToolBox + +object Test extends App { + import scala.reflect.mirror._ + val tree = Apply(Select(Ident("Macros"), newTermName("foo")), List(Literal(Constant(2)))) + + val stderr = new java.io.ByteArrayOutputStream() + Console.setErr(new java.io.PrintStream(stderr)) + + val reporter = new ConsoleReporter(new Settings) + val toolbox = new ToolBox(reporter) + try { toolbox.runExpr(tree) } + catch { case ex: Throwable => println(stderr); println(ex) } +} -- cgit v1.2.3