diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2013-09-30 06:39:27 -0700 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2013-09-30 06:39:27 -0700 |
commit | 2bba7797028a19b541b5bd88bd2b732e9a58681c (patch) | |
tree | cc2be1c087b4d8ef4b7196639b69f56b1a7e356a /test | |
parent | b96f6f3ca713dac0e1a59b1b0341cadf7709d623 (diff) | |
parent | 4133eb8454fe35ef11aaedc1a9008d052c913930 (diff) | |
download | scala-2bba7797028a19b541b5bd88bd2b732e9a58681c.tar.gz scala-2bba7797028a19b541b5bd88bd2b732e9a58681c.tar.bz2 scala-2bba7797028a19b541b5bd88bd2b732e9a58681c.zip |
Merge pull request #2991 from xeno-by/topic/unapply-copier
transformers no longer ignore UnApply.fun
Diffstat (limited to 'test')
-rw-r--r-- | test/files/run/t7871.check | 1 | ||||
-rw-r--r-- | test/files/run/t7871/Macros_1.scala | 27 | ||||
-rw-r--r-- | test/files/run/t7871/Test_2.scala | 6 |
3 files changed, 34 insertions, 0 deletions
diff --git a/test/files/run/t7871.check b/test/files/run/t7871.check new file mode 100644 index 0000000000..ce6efd812d --- /dev/null +++ b/test/files/run/t7871.check @@ -0,0 +1 @@ +(SomeTree,SomeTree) diff --git a/test/files/run/t7871/Macros_1.scala b/test/files/run/t7871/Macros_1.scala new file mode 100644 index 0000000000..778068deb3 --- /dev/null +++ b/test/files/run/t7871/Macros_1.scala @@ -0,0 +1,27 @@ +import scala.reflect.macros.Context +import language.experimental.macros + +trait Tree +case object SomeTree extends Tree + +object NewQuasiquotes { + implicit class QuasiquoteInterpolation(c: StringContext) { + object nq { + def unapply(t: Tree) = macro QuasiquoteMacros.unapplyImpl + } + } +} + +object QuasiquoteMacros { + def unapplyImpl(c: Context)(t: c.Tree) = { + import c.universe._ + q""" + new { + def unapply(t: Tree) = t match { + case SomeTree => Some((SomeTree, SomeTree)) + case _ => None + } + }.unapply($t) + """ + } +} diff --git a/test/files/run/t7871/Test_2.scala b/test/files/run/t7871/Test_2.scala new file mode 100644 index 0000000000..3a0b68b568 --- /dev/null +++ b/test/files/run/t7871/Test_2.scala @@ -0,0 +1,6 @@ +object Test extends App { + import NewQuasiquotes._ + SomeTree match { + case nq"$x + $y" => println((x, y)) + } +} |