Skip to content

Commit b44e3b2

Browse files
committed
Get rid of RenameTree
1 parent c1c5f90 commit b44e3b2

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)
@@ -556,16 +559,6 @@ object Interactive {
556559
lookup(name.sourceModuleName))
557560
}
558561

559-
/**
560-
* Used to represent a renaming import `{foo => bar}`.
561-
* We need this because the name of the tree must be the new name, but the
562-
* denotation must be that of the importee.
563-
*/
564-
private case class RenameTree(name: Name, underlying: Tree) extends NameTree {
565-
override def denot(implicit ctx: Context) = underlying.denot
566-
myTpe = NoType
567-
}
568-
569562
/**
570563
* Is this tree using a renaming introduced by an import statement?
571564
*

0 commit comments

Comments
 (0)