From 6d4f43503f718610182d9529695d7aed02333e37 Mon Sep 17 00:00:00 2001 From: Den Shabalin Date: Sat, 19 Oct 2013 20:10:09 +0200 Subject: SI-6840 fixes weird typing of quasiquote arguments Previously quasiquote arguments were type checked against Any which caused weird inference that made splicing of complex expressions unusable: val l1 = List(q"foo") val l2 = List(q"bar") q"f(..${l1 ++ l2})" // argument type checked as Any instead of List[Tree] This is fixed by forcing compiler to type check against type variable which itself isn't used in any other way. --- test/files/scalacheck/quasiquotes/TermConstructionProps.scala | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test/files/scalacheck/quasiquotes') diff --git a/test/files/scalacheck/quasiquotes/TermConstructionProps.scala b/test/files/scalacheck/quasiquotes/TermConstructionProps.scala index 9284903623..f68656d0f7 100644 --- a/test/files/scalacheck/quasiquotes/TermConstructionProps.scala +++ b/test/files/scalacheck/quasiquotes/TermConstructionProps.scala @@ -199,4 +199,13 @@ object TermConstructionProps extends QuasiquoteProperties("term construction") { def withEvidence = q"def foo[T: X]" assert(!(withEvidence ≈ withEvidence)) } + + property("make sure inference doesn't infer any") = test { + val l1 = List(q"foo") + val l2 = List(q"bar") + val baz = q"baz" + assert(q"f(..${l1 ++ l2})" ≈ q"f(foo, bar)") + assert(q"f(..${l1 ++ l2}, $baz)" ≈ q"f(foo, bar, baz)") + assert(q"f(${if (true) q"a" else q"b"})" ≈ q"f(a)") + } } -- cgit v1.2.3