diff options
Diffstat (limited to 'tests/untried/neg/t6931')
-rw-r--r-- | tests/untried/neg/t6931/Macros_1.scala | 15 | ||||
-rw-r--r-- | tests/untried/neg/t6931/Test_2.scala | 4 |
2 files changed, 19 insertions, 0 deletions
diff --git a/tests/untried/neg/t6931/Macros_1.scala b/tests/untried/neg/t6931/Macros_1.scala new file mode 100644 index 000000000..9e167e61d --- /dev/null +++ b/tests/untried/neg/t6931/Macros_1.scala @@ -0,0 +1,15 @@ +import scala.language.experimental.macros +import scala.reflect.macros.blackbox.Context + +object Macros { + implicit class Error(ctx: StringContext) { + def err(args: Any*): Unit = macro impl + } + + def impl(c: Context)(args: c.Tree*): c.Tree = { + import c.universe._ + val q"Macros.Error(scala.StringContext.apply($arg)).err()" = c.macroApplication + for (i <- 1 to 3) c.error(arg.pos.withPoint(arg.pos.point + i - 1), i.toString) + q"()" + } +} diff --git a/tests/untried/neg/t6931/Test_2.scala b/tests/untried/neg/t6931/Test_2.scala new file mode 100644 index 000000000..dbd7fc260 --- /dev/null +++ b/tests/untried/neg/t6931/Test_2.scala @@ -0,0 +1,4 @@ +object Test extends App { + import Macros._ + err"123" +} |