diff options
author | Denys Shabalin <denys.shabalin@typesafe.com> | 2014-03-25 14:53:40 +0100 |
---|---|---|
committer | Denys Shabalin <denys.shabalin@typesafe.com> | 2014-03-25 15:43:41 +0100 |
commit | 2fea9502242265e365be987b45e130ac9669d692 (patch) | |
tree | 2cd73dbbf7d66160da96b46fc5fcf39ceed07514 /test/files | |
parent | 4aa58d48d27bb722290c12335da82f32021b8ede (diff) | |
download | scala-2fea9502242265e365be987b45e130ac9669d692.tar.gz scala-2fea9502242265e365be987b45e130ac9669d692.tar.bz2 scala-2fea9502242265e365be987b45e130ac9669d692.zip |
SI-8350 treat single parens equivalently to no-parens in new
q"new C" and q"new C()" have identical trees after parsing. This
commit adds knowledge of this invariant to SyntacticNew.
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala b/test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala index 9e60729c09..83f7e21035 100644 --- a/test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala +++ b/test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala @@ -222,4 +222,21 @@ object TermDeconstructionProps extends QuasiquoteProperties("term deconstruction val q"{ case ..$cases }" = q"{ case a => b case c => d }" val List(cq"a => b", cq"c => d") = cases } + + property("SI-8350 `new C` and `new C()` are equivalent") = test { + val q"new C" = q"new C()" + val q"new C()" = q"new C" + } + + property("SI-8350 new applications extracted only for non-empty ctor calls") = test{ + val q"new $c1" = q"new C()" + assert(c1 ≈ tq"C") + val q"new $c2" = q"new C(x)" + assert(c2 ≈ q"${tq"C"}(x)") + } + + property("SI-8350 original test case") = test { + val q"new ..$parents" = q"new Foo with Bar" + assert(parents ≈ List(tq"Foo", tq"Bar")) + } } |