From 2b67f8b94f9e95c5fb7be0e6d6c4718a6e045ec4 Mon Sep 17 00:00:00 2001 From: Denys Shabalin Date: Mon, 10 Feb 2014 14:29:59 +0100 Subject: Make handling of tuples more consistent in quasi-quotes On one hand we know that q"($expr)" is the same as q"$expr". On the other if we wrap it into a list and splice as q"(..$expr)" we get a Tuple1 constructor call which is inconsistent. This pull request fixes this inconsistency by making q"(..$expr)" being equivalent q"(${expr.head})" for single-element list. We also add support for matching of expressions as single-element tuples (similarly to blocks) and remove liftables and unliftables for Tuple1 (which aren't clearly defined any longer due to q"(foo)" == q"foo" invariant). --- test/files/scalacheck/quasiquotes/TypeDeconstructionProps.scala | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'test/files/scalacheck/quasiquotes/TypeDeconstructionProps.scala') diff --git a/test/files/scalacheck/quasiquotes/TypeDeconstructionProps.scala b/test/files/scalacheck/quasiquotes/TypeDeconstructionProps.scala index 0fdcc19052..8ec1779353 100644 --- a/test/files/scalacheck/quasiquotes/TypeDeconstructionProps.scala +++ b/test/files/scalacheck/quasiquotes/TypeDeconstructionProps.scala @@ -35,6 +35,11 @@ object TypeDeconstructionProps extends QuasiquoteProperties("type deconstruction assert(last ≈ tq"t2") } + property("tuple type (5)") = test { + val tq"(..$ts)" = tq"T" + assert(ts ≈ List(tq"T")) + } + property("refined type") = test { val tq"T { ..$stats }" = tq"T { def foo; val x: Int; type Y = String }" assert(stats ≈ List(q"def foo", q"val x: Int", q"type Y = String")) -- cgit v1.2.3