summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/reflect
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@typesafe.com>2014-01-17 12:07:45 -0800
committerAdriaan Moors <adriaan.moors@typesafe.com>2014-01-17 12:07:45 -0800
commitdf329bde7a9a4fcb8e4d69559d83032ee4a5e8b8 (patch)
tree05c22da5a046bae68ba52788e36ce3978049d612 /src/compiler/scala/tools/reflect
parent930d895caae2dd0d098ea39679e663ce22caa9b2 (diff)
parent03e9e95f57b011336736d0e7ca64b90bb55e38a5 (diff)
downloadscala-df329bde7a9a4fcb8e4d69559d83032ee4a5e8b8.tar.gz
scala-df329bde7a9a4fcb8e4d69559d83032ee4a5e8b8.tar.bz2
scala-df329bde7a9a4fcb8e4d69559d83032ee4a5e8b8.zip
Merge pull request #3373 from densh/topic/std-liftable-refinement
A few minor changes to standard liftable instances and liftable support
Diffstat (limited to 'src/compiler/scala/tools/reflect')
-rw-r--r--src/compiler/scala/tools/reflect/quasiquotes/Holes.scala17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/compiler/scala/tools/reflect/quasiquotes/Holes.scala b/src/compiler/scala/tools/reflect/quasiquotes/Holes.scala
index f5bcaf68e0..8a54519401 100644
--- a/src/compiler/scala/tools/reflect/quasiquotes/Holes.scala
+++ b/src/compiler/scala/tools/reflect/quasiquotes/Holes.scala
@@ -115,8 +115,7 @@ trait Holes { self: Quasiquotes =>
val lifter = inferLiftable(tpe)
assert(lifter != EmptyTree, s"couldnt find a liftable for $tpe")
val lifted = Apply(lifter, List(tree))
- val targetType = Select(u, tpnme.Tree)
- atPos(tree.pos)(TypeApply(Select(lifted, nme.asInstanceOf_), List(targetType)))
+ atPos(tree.pos)(lifted)
}
protected def iterated(card: Cardinality, tpe: Type, elementTransform: Tree => Tree = identity)(tree: Tree): Tree = {
@@ -167,16 +166,15 @@ trait Holes { self: Quasiquotes =>
/** Full support for unliftable implies that it's possible to interleave
* deconstruction with higher cardinality and unlifting of the values.
* In particular extraction of List[Tree] as List[T: Unliftable] requires
- * helper extractors that would do the job: UnliftHelper1[T]. Similarly
- * List[List[Tree]] needs UnliftHelper2[T].
+ * helper extractors that would do the job: UnliftListElementwise[T]. Similarly
+ * List[List[Tree]] needs UnliftListOfListsElementwise[T].
*
* See also "unlift list" tests in UnapplyProps.scala
*/
object unlifters {
private var records = List.empty[(Type, Cardinality)]
- // Request an UnliftHelperN[T] where n == card and T == tpe.
- // If card == 0 then helper is not needed and plain instance
- // of unliftable is returned.
+ // Materialize unlift helper that does elementwise
+ // unlifting for corresponding cardinality and type.
def spawn(tpe: Type, card: Cardinality): Option[Tree] = {
val unlifter = inferUnliftable(tpe)
if (unlifter == EmptyTree) None
@@ -191,7 +189,10 @@ trait Holes { self: Quasiquotes =>
def preamble(): List[Tree] =
records.zipWithIndex.map { case ((tpe, card), idx) =>
val name = TermName(nme.QUASIQUOTE_UNLIFT_HELPER + idx)
- val helperName = card match { case DotDot => nme.UnliftHelper1 case DotDotDot => nme.UnliftHelper2 }
+ val helperName = card match {
+ case DotDot => nme.UnliftListElementwise
+ case DotDotDot => nme.UnliftListOfListsElementwise
+ }
val lifter = inferUnliftable(tpe)
assert(helperName.isTermName)
// q"val $name: $u.build.${helperName.toTypeName} = $u.build.$helperName($lifter)"