diff options
author | Denys Shabalin <denys.shabalin@typesafe.com> | 2014-01-24 11:53:12 +0100 |
---|---|---|
committer | Denys Shabalin <denys.shabalin@typesafe.com> | 2014-01-24 11:53:12 +0100 |
commit | 30748571d44f604917eeef834a4aa4f7c2c1425e (patch) | |
tree | fb3d75c642ad4c3124c7902acf290b44d627a942 /src/compiler/scala/tools/reflect | |
parent | 0a529b903c77e5ce2dc81214964ff6781ff9e339 (diff) | |
download | scala-30748571d44f604917eeef834a4aa4f7c2c1425e.tar.gz scala-30748571d44f604917eeef834a4aa4f7c2c1425e.tar.bz2 scala-30748571d44f604917eeef834a4aa4f7c2c1425e.zip |
Reify all blocks as syntactic blocks
Previous version of the pattern wasn't precise enough due to the
fact that synthetic units are now erased by syntactic block and
this could cause incorrect reification for cases like:
val x = { val y = 1 }
Here syntactic block would extract one element but we still need to
reify it through syntactic block endpoint. So we can't filter based
on the number of elements extracted but rather filter on type of a
tree.
Diffstat (limited to 'src/compiler/scala/tools/reflect')
-rw-r--r-- | src/compiler/scala/tools/reflect/quasiquotes/Reifiers.scala | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/reflect/quasiquotes/Reifiers.scala b/src/compiler/scala/tools/reflect/quasiquotes/Reifiers.scala index e18bf7d5ee..5246592647 100644 --- a/src/compiler/scala/tools/reflect/quasiquotes/Reifiers.scala +++ b/src/compiler/scala/tools/reflect/quasiquotes/Reifiers.scala @@ -189,7 +189,9 @@ trait Reifiers { self: Quasiquotes => mirrorBuildCall(nme.SyntacticBlock, tree) case Block(Nil, other) => reifyTree(other) - case SyntacticBlock(stats @ (_ :: _ :: _)) => + // Syntactic block always matches so we have to be careful + // not to cause infinite recursion. + case block @ SyntacticBlock(stats) if block.isInstanceOf[Block] => reifyBuildCall(nme.SyntacticBlock, stats) case Try(block, catches, finalizer) => reifyBuildCall(nme.SyntacticTry, block, catches, finalizer) |