diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2013-09-26 15:05:36 +0200 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2013-09-26 16:39:19 +0200 |
commit | 7122560063b4cbe1e8012decbc842bf610e55863 (patch) | |
tree | b73e4804208e752248e6d60bfcbf96ece52a3987 /test/files/run/t7871/Macros_1.scala | |
parent | bda48577d022811be58ce2b7f9e46890543ad45b (diff) | |
download | scala-7122560063b4cbe1e8012decbc842bf610e55863.tar.gz scala-7122560063b4cbe1e8012decbc842bf610e55863.tar.bz2 scala-7122560063b4cbe1e8012decbc842bf610e55863.zip |
transformers no longer ignore UnApply.fun
Second time's the charm. I remember trying to do exactly the same somewhen
around 2.10.0-M4, but then some continuations tests were failing.
Luckily, today everything went smoothly.
Please note that this fix changes the way that SI-5465 manifests itself.
Previously it produced type errors, now it simply crashes the compiler.
Therefore I had to attach the try/catch FatalError clause to invocations
of toolbox methods, so that compiler crashes get caught and translated to
ToolBoxErrors.
Also fixes SI-7871, and that clears the way for implementing quasiquotes
with conventional macros rather than relying on a special case in typer.
Diffstat (limited to 'test/files/run/t7871/Macros_1.scala')
-rw-r--r-- | test/files/run/t7871/Macros_1.scala | 27 |
1 files changed, 27 insertions, 0 deletions
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) + """ + } +} |