diff options
author | Denys Shabalin <denys.shabalin@typesafe.com> | 2014-03-09 14:04:05 +0200 |
---|---|---|
committer | Denys Shabalin <denys.shabalin@typesafe.com> | 2014-03-09 14:09:50 +0200 |
commit | f94959d3614d1f1702e9cd152c57f955ac58ce82 (patch) | |
tree | 96d98fb8d88ae576c30a4c2e8164d93047091deb | |
parent | 973f2255481c0ee3c9954d361ef3941186495c8f (diff) | |
download | scala-f94959d3614d1f1702e9cd152c57f955ac58ce82.tar.gz scala-f94959d3614d1f1702e9cd152c57f955ac58ce82.tar.bz2 scala-f94959d3614d1f1702e9cd152c57f955ac58ce82.zip |
SI-8385 make sure $quasiquote$tuple gets reified properly
Previously due to greediness of SyntacticApplied there was a chance that
quasiquote tuple placeholder got reified as its representation rather
than its meaning.
-rw-r--r-- | src/compiler/scala/tools/reflect/quasiquotes/Reifiers.scala | 4 | ||||
-rw-r--r-- | test/files/scalacheck/quasiquotes/TermConstructionProps.scala | 8 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/reflect/quasiquotes/Reifiers.scala b/src/compiler/scala/tools/reflect/quasiquotes/Reifiers.scala index 5eae3b6e6f..b595e3ad2c 100644 --- a/src/compiler/scala/tools/reflect/quasiquotes/Reifiers.scala +++ b/src/compiler/scala/tools/reflect/quasiquotes/Reifiers.scala @@ -181,6 +181,10 @@ trait Reifiers { self: Quasiquotes => reifyBuildCall(nme.SyntacticForYield, enums, body) case SyntacticAssign(lhs, rhs) => reifyBuildCall(nme.SyntacticAssign, lhs, rhs) + // rest will always be non-empty due to the fact that every single-parens + // application will be reified by reifyTreePlaceholder before it gets here. + case SyntacticApplied(id @ Ident(nme.QUASIQUOTE_TUPLE), first :: rest) => + mirrorBuildCall(nme.SyntacticApplied, reifyTreePlaceholder(Apply(id, first)), reify(rest)) case SyntacticApplied(fun, argss) if argss.nonEmpty => reifyBuildCall(nme.SyntacticApplied, fun, argss) case SyntacticTypeApplied(fun, targs) if targs.nonEmpty => diff --git a/test/files/scalacheck/quasiquotes/TermConstructionProps.scala b/test/files/scalacheck/quasiquotes/TermConstructionProps.scala index fd4d2e9c4b..74d0d54ea8 100644 --- a/test/files/scalacheck/quasiquotes/TermConstructionProps.scala +++ b/test/files/scalacheck/quasiquotes/TermConstructionProps.scala @@ -295,4 +295,12 @@ object TermConstructionProps extends QuasiquoteProperties("term construction") { val q"$a = $b = $c = $d = $e = $f = $g = $h = $k = $l" = q"a = b = c = d = e = f = g = h = k = l" assert(a ≈ q"a" && b ≈ q"b" && c ≈ q"c" && d ≈ q"d" && e ≈ q"e" && g ≈ q"g" && h ≈ q"h" && k ≈ q"k" && l ≈ q"l") } + + property("SI-8385 a") = test { + assertEqAst(q"(foo.x = 1)(2)", "(foo.x = 1)(2)") + } + + property("SI-8385 b") = test { + assertEqAst(q"(() => ())()", "(() => ())()") + } } |