@@ -7,7 +7,7 @@ import dotty.tools.dotc.core.CheckRealizable
77import dotty .tools .dotc .core .Decorators .StringInterpolators
88import dotty .tools .dotc .core .Denotations .SingleDenotation
99import dotty .tools .dotc .core .Flags ._
10- import dotty .tools .dotc .core .Names .{Name , SimpleName , TermName }
10+ import dotty .tools .dotc .core .Names .{Name , TermName }
1111import dotty .tools .dotc .core .NameKinds .SimpleNameKind
1212import dotty .tools .dotc .core .NameOps .NameDecorator
1313import dotty .tools .dotc .core .Symbols .{defn , NoSymbol , Symbol }
@@ -350,26 +350,18 @@ object Completion {
350350 * in the REPL and the IDE.
351351 */
352352 private class RenameAwareScope extends Scopes .MutableScope {
353- private [this ] val nameToSymbols : mutable.Map [Name , List [Symbol ]] = mutable.Map .empty
353+ private [this ] val nameToSymbols : mutable.Map [TermName , List [Symbol ]] = mutable.Map .empty
354354
355355 /** Enter the symbol `sym` in this scope, recording a potential renaming. */
356356 def enter [T <: Symbol ](sym : T , name : Name )(implicit ctx : Context ): T = {
357- nameToSymbols += name -> (sym :: nameToSymbols.getOrElse(name, Nil ))
357+ val termName = name.stripModuleClassSuffix.toTermName
358+ nameToSymbols += termName -> (sym :: nameToSymbols.getOrElse(termName, Nil ))
358359 newScopeEntry(name, sym)
359360 sym
360361 }
361362
362363 /** Get the names that are known in this scope, along with the list of symbols they refer to. */
363- def mappings (implicit ctx : Context ): Map [SimpleName , List [Symbol ]] = {
364- val symbols =
365- for {
366- (name, syms) <- nameToSymbols.toList
367- sym <- syms
368- } yield (sym, name)
369- symbols
370- .groupBy(_._2.stripModuleClassSuffix.toSimpleName)
371- .mapValues(_.map(_._1))
372- }
364+ def mappings : Map [TermName , List [Symbol ]] = nameToSymbols.toMap
373365 }
374366
375367}
0 commit comments