@@ -624,7 +624,7 @@ object Interactive {
624624
625625 /** Are the two names the same? */
626626 def sameName (n0 : Name , n1 : Name ): Boolean = {
627- n0.stripModuleClassSuffix.toString == n1.stripModuleClassSuffix.toString
627+ n0.stripModuleClassSuffix.toTermName eq n1.stripModuleClassSuffix.toTermName
628628 }
629629
630630 /**
@@ -640,13 +640,11 @@ object Interactive {
640640 tree match {
641641 case Import (_, selectors) =>
642642 selectors.exists {
643- case Thicket (_ :: Ident (rename) :: Nil ) =>
644- rename.stripModuleClassSuffix.toString == toName.stripModuleClassSuffix.toString
645- case _ =>
646- false
643+ case Thicket (_ :: Ident (rename) :: Nil ) => sameName(rename, toName)
644+ case _ => false
647645 }
648- case _ =>
649- false
646+ case _ =>
647+ false
650648 }
651649 }
652650
@@ -696,7 +694,7 @@ object Interactive {
696694 case pkg : PackageDef if immediatelyEnclosesRenaming(toName, pkg) =>
697695 EmptyTree
698696 case template : Template if immediatelyEnclosesRenaming(toName, template) =>
699- cpy.Template (template)(constr = DefDef (template.constr.symbol.asTerm), self = template.self, body = Nil )
697+ cpy.Template (template)(constr = DefDef (template.constr.symbol.asTerm), body = Nil )
700698 case block @ Block (stats, expr) if immediatelyEnclosesRenaming(toName, block) =>
701699 EmptyTree
702700 case other =>
@@ -706,7 +704,7 @@ object Interactive {
706704 }
707705
708706 val trees = {
709- val trees = enclosing match {
707+ val enclosedTrees = enclosing match {
710708 case Some (pkg : PackageDef ) =>
711709 pkg.stats
712710 case Some (template : Template ) =>
@@ -720,7 +718,7 @@ object Interactive {
720718
721719 // These trees may contain a new renaming of the same symbol to the same name, so we may
722720 // have to cut some branches
723- val trimmedTrees = trees .map(removeBlockWithRenaming(toName, _))
721+ val trimmedTrees = enclosedTrees .map(removeBlockWithRenaming(toName, _))
724722
725723 // Some of these trees may not be `NameTrees`. Those that are not are wrapped in a
726724 // synthetic val def, so that everything can go inside `SourceNamedTree`s.
0 commit comments