@@ -391,18 +391,23 @@ object SymDenotations {
391391 * Drops package objects. Represents each term in the owner chain by a simple `_$`.
392392 */
393393 def fullNameSeparated (kind : QualifiedNameKind )(implicit ctx : Context ): Name =
394- if (symbol == NoSymbol ||
395- owner == NoSymbol ||
396- owner.isEffectiveRoot ||
397- kind == FlatName && owner.is(PackageClass )) name
394+ maybeOwner.fullNameSeparated(kind, kind, name)
395+
396+ /** The encoded full path name of this denotation (separated by `prefixKind`),
397+ * followed by the separator implied by `kind` and the given `name`.
398+ * Drops package objects. Represents each term in the owner chain by a simple `_$`.
399+ */
400+ def fullNameSeparated (prefixKind : QualifiedNameKind , kind : QualifiedNameKind , name : Name )(implicit ctx : Context ): Name =
401+ if (symbol == NoSymbol || isEffectiveRoot || kind == FlatName && is(PackageClass ))
402+ name
398403 else {
399404 var filler = " "
400- var encl = owner
405+ var encl = symbol
401406 while (! encl.isClass && ! encl.isPackageObject) {
402407 encl = encl.owner
403408 filler += " _$"
404409 }
405- var prefix = encl.fullNameSeparated(kind )
410+ var prefix = encl.fullNameSeparated(prefixKind )
406411 if (kind.separator == " $" )
407412 // duplicate scalac's behavior: don't write a double '$$' for module class members.
408413 prefix = prefix.exclude(ModuleClassName )
@@ -412,10 +417,9 @@ object SymDenotations {
412417 case name : SimpleName => qualify(name)
413418 case name @ AnyQualifiedName (_, _) => qualify(name.mangled.toSimpleName)
414419 }
415- if (isType) fn.toTypeName else fn.toTermName
420+ if (name. isType) fn.toTypeName else fn.toTermName
416421 }
417422
418-
419423 /** The encoded flat name of this denotation, where joined names are separated by `separator` characters. */
420424 def flatName (implicit ctx : Context ): Name = fullNameSeparated(FlatName )
421425
0 commit comments