Skip to content

Commit

Permalink
Reify all blocks as syntactic blocks
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
densh committed Jan 24, 2014
1 parent 0a529b9 commit 3074857
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/compiler/scala/tools/reflect/quasiquotes/Reifiers.scala
Expand Up @@ -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)
Expand Down

0 comments on commit 3074857

Please sign in to comment.