@@ -343,8 +343,11 @@ object Interactive {
343
343
syms.foreach { case (sym, name, rename) =>
344
344
val tree = tpd.Select (imp.expr, sym.name).withPos(name.pos)
345
345
val renameTree = rename.map { r =>
346
+ // Get the type of the symbol that is actually selected, and construct a select
347
+ // node with the new name and the type of the real symbol.
346
348
val name = if (sym.name.isTypeName) r.name.toTypeName else r.name
347
- RenameTree (name, tpd.Select (imp.expr, sym.name)).withPos(r.pos)
349
+ val actual = tpd.Select (imp.expr, sym.name)
350
+ tpd.Select (imp.expr, name).withPos(r.pos).withType(actual.tpe)
348
351
}
349
352
renameTree.foreach(traverse)
350
353
traverse(tree)
@@ -607,16 +610,6 @@ object Interactive {
607
610
lookup(name.sourceModuleName))
608
611
}
609
612
610
- /**
611
- * Used to represent a renaming import `{foo => bar}`.
612
- * We need this because the name of the tree must be the new name, but the
613
- * denotation must be that of the importee.
614
- */
615
- private case class RenameTree (name : Name , underlying : Tree ) extends NameTree {
616
- override def denot (implicit ctx : Context ) = underlying.denot
617
- myTpe = NoType
618
- }
619
-
620
613
/**
621
614
* Is this tree using a renaming introduced by an import statement?
622
615
*
0 commit comments