Browse files

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.
  • Loading branch information...
1 parent 681308a commit 722c743331dc2355f985372cd549d33b8ae0516d @densh densh committed with Denys Shabalin Dec 17, 2013
Showing with 1 addition and 2 deletions.
  1. +1 −2 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 = {

0 comments on commit 722c743

Please sign in to comment.