@@ -7,7 +7,7 @@ import dotty.tools.dotc.core.CheckRealizable
7
7
import dotty .tools .dotc .core .Decorators .StringInterpolators
8
8
import dotty .tools .dotc .core .Denotations .SingleDenotation
9
9
import dotty .tools .dotc .core .Flags ._
10
- import dotty .tools .dotc .core .Names .{Name , SimpleName , TermName }
10
+ import dotty .tools .dotc .core .Names .{Name , TermName }
11
11
import dotty .tools .dotc .core .NameKinds .SimpleNameKind
12
12
import dotty .tools .dotc .core .NameOps .NameDecorator
13
13
import dotty .tools .dotc .core .Symbols .{defn , NoSymbol , Symbol }
@@ -350,26 +350,18 @@ object Completion {
350
350
* in the REPL and the IDE.
351
351
*/
352
352
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
354
354
355
355
/** Enter the symbol `sym` in this scope, recording a potential renaming. */
356
356
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 ))
358
359
newScopeEntry(name, sym)
359
360
sym
360
361
}
361
362
362
363
/** 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
373
365
}
374
366
375
367
}
0 commit comments