Skip to content

Commit 148d3cc

Browse files
committed
Get rid of RenameTree
1 parent d548b91 commit 148d3cc

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

compiler/src/dotty/tools/dotc/interactive/Interactive.scala

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -343,8 +343,11 @@ object Interactive {
343343
syms.foreach { case (sym, name, rename) =>
344344
val tree = tpd.Select(imp.expr, sym.name).withPos(name.pos)
345345
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.
346348
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)
348351
}
349352
renameTree.foreach(traverse)
350353
traverse(tree)
@@ -607,16 +610,6 @@ object Interactive {
607610
lookup(name.sourceModuleName))
608611
}
609612

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-
620613
/**
621614
* Is this tree using a renaming introduced by an import statement?
622615
*

0 commit comments

Comments
 (0)