From ffc3203c3688b6fc5f47f4043bf3a0090de9d985 Mon Sep 17 00:00:00 2001 From: Denys Shabalin Date: Sat, 1 Feb 2014 19:25:16 +0100 Subject: SI-8173 add support for patterns like init :+ last to quasiquotes Adds support for patterns like: val q"{ ..$init; $last }" = q"{ a; b; c }" // init == List(q"a", q"b") // last == q"c" Which under the hood get compiled as `:+` patterns: SyntacticBlock(init :+ last) --- .../DefinitionDeconstructionProps.scala | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'test/files/scalacheck/quasiquotes/DefinitionDeconstructionProps.scala') diff --git a/test/files/scalacheck/quasiquotes/DefinitionDeconstructionProps.scala b/test/files/scalacheck/quasiquotes/DefinitionDeconstructionProps.scala index 209fe9bbeb..88e00c734b 100644 --- a/test/files/scalacheck/quasiquotes/DefinitionDeconstructionProps.scala +++ b/test/files/scalacheck/quasiquotes/DefinitionDeconstructionProps.scala @@ -125,18 +125,28 @@ trait ModsDeconstruction { self: QuasiquoteProperties => } property("@..$annots def foo") = test { - val a = annot("a") - val b = annot("b") + val a = q"new a" + val b = q"new b" val q"@..$annots def foo" = q"@$a @$b def foo" annots ≈ List(a, b) } property("@$annot @..$annots def foo") = test { - val a = annot("a") - val b = annot("b") - val c = annot("c") + val a = q"new a" + val b = q"new b" + val c = q"new c" val q"@$first @..$rest def foo" = q"@$a @$b @$c def foo" - first ≈ a && rest ≈ List(b, c) + assert(first ≈ a) + assert(rest ≈ List(b, c)) + } + + property("@..$anots @$annot def foo") = test { + val a = q"new a" + val b = q"new b" + val c = q"new c" + val q"@..$init @$last def foo" = q"@$a @$b @$c def foo" + assert(init ≈ List(a, b)) + assert(last ≈ c) } } -- cgit v1.2.3