diff options
Diffstat (limited to 'test/files/run/t5903b/Macros_1.scala')
-rw-r--r-- | test/files/run/t5903b/Macros_1.scala | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/files/run/t5903b/Macros_1.scala b/test/files/run/t5903b/Macros_1.scala new file mode 100644 index 0000000000..c0124850b8 --- /dev/null +++ b/test/files/run/t5903b/Macros_1.scala @@ -0,0 +1,25 @@ +import scala.reflect.macros.Context +import language.experimental.macros + +object Interpolation { + implicit class TestInterpolation(c: StringContext) { + object t { + def unapply[T](x: T) = macro Macros.unapplyImpl[T] + } + } +} + +object Macros { + def unapplyImpl[T: c.WeakTypeTag](c: Context)(x: c.Tree) = { + import c.universe._ + q""" + new { + def isEmpty = false + def get = this + def _1 = 2 + def unapply(x: Int) = this + override def toString = "oops" + }.unapply($x) + """ + } +} |