Skip to content

Commit 87889b6

Browse files
committed
Invalide fullName cache when name changes
Also: use "_$" instead of "~" as filler when taking the full name of a term member. If the term member is symbolic (e.g. +) the filler name would be misinterpreted as a symbolic name "~+", so would be mangled as "$tilde$plus$ instead of "~$plus".
1 parent fb5aea1 commit 87889b6

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ object SymDenotations {
135135
def name = myName
136136

137137
/** Update the name; only called when unpickling top-level classes */
138-
def name_=(n: Name) = myName = n
138+
private[core] def name_=(n: Name) = myName = n
139139

140140
/** The owner of the symbol; overridden in NoDenotation */
141141
def owner: Symbol = ownerIfExists
@@ -403,7 +403,7 @@ object SymDenotations {
403403
var encl = owner
404404
while (!encl.isClass && !encl.isPackageObject) {
405405
encl = encl.owner
406-
filler += "~"
406+
filler += "_$"
407407
}
408408
var prefix = encl.fullNameSeparated(kind)
409409
if (kind.separator == "$")
@@ -505,7 +505,7 @@ object SymDenotations {
505505
* step for creating Refinement types.
506506
*/
507507
final def isRefinementClass(implicit ctx: Context): Boolean =
508-
name.decode == tpnme.REFINE_CLASS
508+
name == tpnme.REFINE_CLASS
509509

510510
/** Is this symbol a package object or its module class? */
511511
def isPackageObject(implicit ctx: Context): Boolean = {
@@ -1260,6 +1260,11 @@ object SymDenotations {
12601260
myTypeParams
12611261
}
12621262

1263+
override private[core] def name_=(n: Name) = {
1264+
fullNameCache = SimpleMap.Empty
1265+
super.name_=(n)
1266+
}
1267+
12631268
override protected[dotc] final def info_=(tp: Type) = {
12641269
super.info_=(tp)
12651270
myTypeParams = null // changing the info might change decls, and with it typeParams

0 commit comments

Comments
 (0)