diff options
author | Denys Shabalin <denys.shabalin@typesafe.com> | 2014-02-24 16:03:20 +0100 |
---|---|---|
committer | Denys Shabalin <denys.shabalin@typesafe.com> | 2014-03-02 20:11:46 +0200 |
commit | 04c55c8d467097d69f3b2d7995e6f1d767b7e7ed (patch) | |
tree | 35e169bd7fd608c1ee7c8c4c624b5964f97f6b04 /test/files/scalacheck | |
parent | da124b33956f83be8b2ebbb77208c4aecde1c6dc (diff) | |
download | scala-04c55c8d467097d69f3b2d7995e6f1d767b7e7ed.tar.gz scala-04c55c8d467097d69f3b2d7995e6f1d767b7e7ed.tar.bz2 scala-04c55c8d467097d69f3b2d7995e6f1d767b7e7ed.zip |
SI-8332 implicit class param unquoting in quasiquotes
A new api that simplifies handling of implicit parameters has been
mistakingly supporting just methods parameters. This commit adds
support for class parameters too.
Diffstat (limited to 'test/files/scalacheck')
-rw-r--r-- | test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala | 5 | ||||
-rw-r--r-- | test/files/scalacheck/quasiquotes/DefinitionDeconstructionProps.scala | 14 |
2 files changed, 17 insertions, 2 deletions
diff --git a/test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala b/test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala index c6ad453c45..69aef12668 100644 --- a/test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala +++ b/test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala @@ -85,6 +85,11 @@ trait ClassConstruction { self: QuasiquoteProperties => property("SI-8333") = test { assertEqAst(q"{ $NoMods class C }", "{ class C }") } + + property("SI-8332") = test { + val args = q"val a: Int; val b: Int" + assertEqAst(q"class C(implicit ..$args)", "class C(implicit val a: Int, val b: Int)") + } } trait TraitConstruction { self: QuasiquoteProperties => diff --git a/test/files/scalacheck/quasiquotes/DefinitionDeconstructionProps.scala b/test/files/scalacheck/quasiquotes/DefinitionDeconstructionProps.scala index 996ac65b36..af7f2164a0 100644 --- a/test/files/scalacheck/quasiquotes/DefinitionDeconstructionProps.scala +++ b/test/files/scalacheck/quasiquotes/DefinitionDeconstructionProps.scala @@ -73,8 +73,11 @@ trait ClassDeconstruction { self: QuasiquoteProperties => property("exhaustive class matcher") = test { def matches(line: String) { - val q"""$classMods class $name[..$targs] $ctorMods(...$argss) - extends { ..$early } with ..$parents { $self => ..$body }""" = parse(line) + val tree = parse(line) + val q"""$classMods0 class $name0[..$targs0] $ctorMods0(...$argss0) + extends { ..$early0 } with ..$parents0 { $self0 => ..$body0 }""" = tree + val q"""$classMods1 class $name1[..$targs1] $ctorMods1(...$argss1)(implicit ..$impl) + extends { ..$early1 } with ..$parents1 { $self1 => ..$body1 }""" = tree } matches("class Foo") matches("class Foo[T]") @@ -106,6 +109,13 @@ trait ClassDeconstruction { self: QuasiquoteProperties => Ident(TypeName("Int")), EmptyTree))), TypeTree(), Block(List(pendingSuperCall), Literal(Constant(()))))))) } } + + property("SI-8332") = test { + val q"class C(implicit ..$args)" = q"class C(implicit i: I, j: J)" + val q"$imods val i: I" :: q"$jmods val j: J" :: Nil = args + assert(imods.hasFlag(IMPLICIT)) + assert(jmods.hasFlag(IMPLICIT)) + } } trait ModsDeconstruction { self: QuasiquoteProperties => |