diff options
author | Den Shabalin <den.shabalin@gmail.com> | 2013-12-17 16:08:43 +0100 |
---|---|---|
committer | Denys Shabalin <denys.shabalin@typesafe.com> | 2014-01-16 11:18:42 +0100 |
commit | 722c743331dc2355f985372cd549d33b8ae0516d (patch) | |
tree | bfdf3acca91419a8a3151bc2a4798f1a3ca78cdf | |
parent | 681308a3aa737be1dae0f702fddadce88c70f90e (diff) | |
download | scala-722c743331dc2355f985372cd549d33b8ae0516d.tar.gz scala-722c743331dc2355f985372cd549d33b8ae0516d.tar.bz2 scala-722c743331dc2355f985372cd549d33b8ae0516d.zip |
Remove redundant asInstanceOf for liftable
Previous encoding of Liftables which had universe passed in
as a parameter required a cast to solve path-dependant
madness problems:
trait OldLiftable[T] { def apply(u: Universe, v: T): u.Tree }
In this case compiler wasn't smart enough to find out that
liftFoo(universe, foo)
returns the same type of tree we were working with (universe.Tree)
and we had to cast to make it work:
liftFoo(universe, foo).asInstanceOf[universe.Tree]
Now this cast is redundant as universe is not a parameter of
Liftable's apply.
-rw-r--r-- | src/compiler/scala/tools/reflect/quasiquotes/Holes.scala | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/reflect/quasiquotes/Holes.scala b/src/compiler/scala/tools/reflect/quasiquotes/Holes.scala index f5bcaf68e0..6427427828 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 = { |