summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bincompat-backward.whitelist.conf5
-rw-r--r--bincompat-forward.whitelist.conf9
-rw-r--r--src/reflect/scala/reflect/api/StandardLiftables.scala1
-rw-r--r--test/files/scalacheck/quasiquotes/ErrorProps.scala10
-rw-r--r--test/files/scalacheck/quasiquotes/LiftableProps.scala8
5 files changed, 28 insertions, 5 deletions
diff --git a/bincompat-backward.whitelist.conf b/bincompat-backward.whitelist.conf
index ae31c286f3..f9760b5c3f 100644
--- a/bincompat-backward.whitelist.conf
+++ b/bincompat-backward.whitelist.conf
@@ -102,6 +102,11 @@ filter {
matchName="scala.collection.mutable.ArrayOps#ofDouble.unzip3"
problemName=IncompatibleMethTypeProblem
},
+ // see SI-8200
+ {
+ matchName="scala.reflect.api.StandardLiftables#StandardLiftableInstances.liftTree"
+ problemName=MissingMethodProblem
+ },
// see SI-8331
{
matchName="scala.reflect.api.Internals#ReificationSupportApi#SyntacticTypeAppliedExtractor.unapply"
diff --git a/bincompat-forward.whitelist.conf b/bincompat-forward.whitelist.conf
index 3eba1effc1..873b6ec2f8 100644
--- a/bincompat-forward.whitelist.conf
+++ b/bincompat-forward.whitelist.conf
@@ -102,6 +102,15 @@ filter {
matchName="scala.collection.mutable.ArrayOps#ofDouble.unzip3"
problemName=IncompatibleMethTypeProblem
},
+ // see SI-8200
+ {
+ matchName="scala.reflect.api.Liftables#Liftable.liftTree"
+ problemName=MissingMethodProblem
+ },
+ {
+ matchName="scala.reflect.api.StandardLiftables#StandardLiftableInstances.liftTree"
+ problemName=MissingMethodProblem
+ },
// see SI-8331
{
matchName="scala.reflect.api.Internals#ReificationSupportApi.SyntacticSelectType"
diff --git a/src/reflect/scala/reflect/api/StandardLiftables.scala b/src/reflect/scala/reflect/api/StandardLiftables.scala
index af11de46ce..66ac62cc9e 100644
--- a/src/reflect/scala/reflect/api/StandardLiftables.scala
+++ b/src/reflect/scala/reflect/api/StandardLiftables.scala
@@ -27,6 +27,7 @@ trait StandardLiftables { self: Universe =>
callScala(stdnme.Symbol)(Literal(Constant(v.name)) :: Nil)
}
+ implicit def liftTree[T <: Tree]: Liftable[T] = Liftable { identity }
implicit def liftName[T <: Name]: Liftable[T] = Liftable { name => Ident(name) }
implicit def liftExpr[T <: Expr[_]]: Liftable[T] = Liftable { expr => expr.tree }
implicit def liftType[T <: Type]: Liftable[T] = Liftable { tpe => TypeTree(tpe) }
diff --git a/test/files/scalacheck/quasiquotes/ErrorProps.scala b/test/files/scalacheck/quasiquotes/ErrorProps.scala
index 3d9b27de77..b07d3d90d5 100644
--- a/test/files/scalacheck/quasiquotes/ErrorProps.scala
+++ b/test/files/scalacheck/quasiquotes/ErrorProps.scala
@@ -9,9 +9,10 @@ object ErrorProps extends QuasiquoteProperties("errors") {
""")
property("can't unquote with given rank") = fails(
- "Can't unquote List[reflect.runtime.universe.Ident], consider using ..",
+ "Can't unquote List[StringBuilder], consider using .. or providing an implicit instance of Liftable[List[StringBuilder]]",
"""
- val xs = List(q"x", q"x")
+ import java.lang.StringBuilder
+ val xs: List[StringBuilder] = Nil
q"$xs"
""")
@@ -71,9 +72,10 @@ object ErrorProps extends QuasiquoteProperties("errors") {
""")
property("use ... rank or provide liftable") = fails(
- "Can't unquote List[List[reflect.runtime.universe.Ident]], consider using ...",
+ "Can't unquote List[List[StringBuilder]], consider using ... or providing an implicit instance of Liftable[List[List[StringBuilder]]]",
"""
- val xs = List(List(q"x", q"x"))
+ import java.lang.StringBuilder
+ val xs: List[List[StringBuilder]] = Nil
q"$xs"
""")
diff --git a/test/files/scalacheck/quasiquotes/LiftableProps.scala b/test/files/scalacheck/quasiquotes/LiftableProps.scala
index 5d0eeb53c6..29fdea5c89 100644
--- a/test/files/scalacheck/quasiquotes/LiftableProps.scala
+++ b/test/files/scalacheck/quasiquotes/LiftableProps.scala
@@ -88,9 +88,10 @@ object LiftableProps extends QuasiquoteProperties("liftable") {
assert(q"$const" ≈ q"0")
}
+ val immutable = q"$scalapkg.collection.immutable"
+
property("lift list variants") = test {
val lst = List(1, 2)
- val immutable = q"$scalapkg.collection.immutable"
assert(q"$lst" ≈ q"$immutable.List(1, 2)")
assert(q"f(..$lst)" ≈ q"f(1, 2)")
val llst = List(List(1), List(2))
@@ -98,6 +99,11 @@ object LiftableProps extends QuasiquoteProperties("liftable") {
assert(q"f(...$llst)" ≈ q"f(1)(2)")
}
+ property("lift list of tree") = test {
+ val lst = List(q"a", q"b")
+ assert(q"$lst" ≈ q"$immutable.List(a, b)")
+ }
+
property("lift tuple") = test {
assert(q"${(1, 2)}" ≈ q"(1, 2)")
assert(q"${(1, 2, 3)}" ≈ q"(1, 2, 3)")