Skip to content

Commit c5b56f1

Browse files
committed
Eagerly update names of package members when one looks for
them with a symbolic name.
1 parent 87889b6 commit c5b56f1

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

compiler/src/dotty/tools/dotc/core/SymbolLoaders.scala

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,13 @@ class SymbolLoaders {
166166
override def lookupEntry(name: Name)(implicit ctx: Context): ScopeEntry = {
167167
val mangled = name.mangled
168168
val e = super.lookupEntry(mangled)
169-
if (e != null) e
169+
if (e != null) {
170+
// Eagerly update symbol's name to undecoded name to avpid the name
171+
// spearding to types.
172+
if (name.toSimpleName != mangled && e.sym.initialDenot.name == mangled)
173+
e.sym.initialDenot.name = name
174+
e
175+
}
170176
else if (_sourceModule.initialDenot.name == nme.scala_ && _sourceModule == defn.ScalaPackageVal &&
171177
name.isTypeName && name.isSyntheticFunction)
172178
newScopeEntry(defn.newFunctionNTrait(name.asTypeName))

0 commit comments

Comments
 (0)