From a0c3bbdb3a4b1055834f3ff5f729dc3af1867696 Mon Sep 17 00:00:00 2001 From: Eugene Burmako Date: Thu, 27 Mar 2014 13:23:49 +0100 Subject: SI-8451 quasiquotes now handle quirks of secondary constructors Apparently even though the rhs of a secondary constructor looks like an expr, it always gets wrapped in a block by the parser. This works just fine with the typer, but crashes in uncurry. This commit brings quasiquotes in line with the parser. --- test/files/scalacheck/quasiquotes/ErrorProps.scala | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test/files/scalacheck/quasiquotes/ErrorProps.scala') diff --git a/test/files/scalacheck/quasiquotes/ErrorProps.scala b/test/files/scalacheck/quasiquotes/ErrorProps.scala index 9137fe17d8..2cba07abf2 100644 --- a/test/files/scalacheck/quasiquotes/ErrorProps.scala +++ b/test/files/scalacheck/quasiquotes/ErrorProps.scala @@ -195,6 +195,19 @@ object ErrorProps extends QuasiquoteProperties("errors") { q"f(..$l)" """) + property("SI-8451 construction: disallow everything except for constructor calls in secondary constructor bodies") = fails( + "'this' expected but unquotee found", + """ + val rhs1 = q"this(0)" + val ctor1 = q"def this(x: Int) = $rhs1" + """) + + property("SI-8451 deconstruction: disallow everything except for constructor calls in secondary constructor bodies") = fails( + "'this' expected but unquotee found", + """ + val q"def this(..$params) = $rhs2" = q"def this(x: Int) = this(0)" + """) + // // Make sure a nice error is reported in this case // { import Flag._; val mods = NoMods; q"lazy $mods val x: Int" } } -- cgit v1.2.3