From 722c743331dc2355f985372cd549d33b8ae0516d Mon Sep 17 00:00:00 2001 From: Den Shabalin Date: Tue, 17 Dec 2013 16:08:43 +0100 Subject: 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. --- src/compiler/scala/tools/reflect/quasiquotes/Holes.scala | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/compiler/scala/tools/reflect/quasiquotes/Holes.scala') 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 = { -- cgit v1.2.3