diff options
author | VladimirNik <vladimir.nikolaev9@gmail.com> | 2014-02-07 02:41:54 +0400 |
---|---|---|
committer | VladimirNik <vladimir.nikolaev9@gmail.com> | 2014-02-20 01:23:25 +0400 |
commit | 931edcc94ebd73b420b2359d989442bf700588eb (patch) | |
tree | 40d1c09c1d6b32ad54d704550028eaea8873c477 /test/files | |
parent | 3973f29cec9f06724941b68577908f546341c45e (diff) | |
download | scala-931edcc94ebd73b420b2359d989442bf700588eb.tar.gz scala-931edcc94ebd73b420b2359d989442bf700588eb.tar.bz2 scala-931edcc94ebd73b420b2359d989442bf700588eb.zip |
Attributed val/var processing for syntactics (SI-8180)
TypedTreesPrinter added
changes based on pull request comments:
print root packages flag; tests for syntactics; SyntacticEmptyTypeTree added to Printers
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/scalacheck/quasiquotes/TypecheckedProps.scala | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/test/files/scalacheck/quasiquotes/TypecheckedProps.scala b/test/files/scalacheck/quasiquotes/TypecheckedProps.scala index 8b1cb6cc49..14669764d3 100644 --- a/test/files/scalacheck/quasiquotes/TypecheckedProps.scala +++ b/test/files/scalacheck/quasiquotes/TypecheckedProps.scala @@ -65,7 +65,7 @@ object TypecheckedProps extends QuasiquoteProperties("typechecked") { } property("extract UnApply (2)") = test { - val q"object $_ { $_; $_; $m }" = typecheck(q""" + val q"object $_ { $_; $m }" = typecheck(q""" object Test { case class Cell(val x: Int) new Cell(0) match { case Cell(v) => v } @@ -82,4 +82,31 @@ object TypecheckedProps extends QuasiquoteProperties("typechecked") { val q"val x: ${tq""} = 42" = typechecked val q"val x: ${t: Type} = 42" = typechecked } + + property("class with param (1)") = test { + val paramName = TermName("x") + val q"class $_($param)" = typecheck(q"class Test(val $paramName: Int)") + + assert(param.name == paramName) + } + + property("class with param (2)") = test { + val paramName = TermName("y") + val q"{ class $_($param); $_}" = typecheck(q"{ class Test(val $paramName: Int = 3) }") + + assert(param.name == paramName) + assert(param.rhs ≈ q"3") + } + + property("class with params") = test { + val pName1 = TermName("x1") + val pName2 = TermName("x2") + val q"{ class $_($param1)(..$params2); $_}" = typecheck(q"{ class Test(val x0: Float)(val $pName1: Int = 3, $pName2: String) }") + + val List(p1, p2, _*) = params2 + + assert(p1.name == pName1) + assert(p2.name == pName2) + assert(params2.size == 2) + } } |