diff options
Diffstat (limited to 'test/files/run/macro-parse-position-malformed')
-rw-r--r-- | test/files/run/macro-parse-position-malformed/Impls_Macros_1.scala | 18 | ||||
-rw-r--r-- | test/files/run/macro-parse-position-malformed/Test_2.scala | 3 |
2 files changed, 21 insertions, 0 deletions
diff --git a/test/files/run/macro-parse-position-malformed/Impls_Macros_1.scala b/test/files/run/macro-parse-position-malformed/Impls_Macros_1.scala new file mode 100644 index 0000000000..b623d8820a --- /dev/null +++ b/test/files/run/macro-parse-position-malformed/Impls_Macros_1.scala @@ -0,0 +1,18 @@ +import scala.language.experimental.macros +import scala.reflect.macros.blackbox.Context +import scala.reflect.macros.ParseException + +object Macros { + def impl(c: Context)() = { + import c.universe._ + val out = try { + c.parse("foo(bar") + "didn't fail" + } catch { + case e: ParseException => + s"failed with '${e.pos}' position and '${e.msg}' message" + } + c.Expr[String](Literal(Constant(out))) + } + def foo(): String = macro impl +}
\ No newline at end of file diff --git a/test/files/run/macro-parse-position-malformed/Test_2.scala b/test/files/run/macro-parse-position-malformed/Test_2.scala new file mode 100644 index 0000000000..cff569bd81 --- /dev/null +++ b/test/files/run/macro-parse-position-malformed/Test_2.scala @@ -0,0 +1,3 @@ +object Test extends App { + println(Macros.foo) +} |