Skip to content

Commit 592f2d5

Browse files
committed
Expand name should use initial owner.
1 parent 55c7232 commit 592f2d5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1050,10 +1050,15 @@ object SymDenotations {
10501050
override def transformAfter(phase: DenotTransformer, f: SymDenotation => SymDenotation)(implicit ctx: Context): Unit =
10511051
super.transformAfter(phase, f)
10521052

1053+
/** If denotation is private, remove the Private flag and expand the name if necessary */
10531054
def ensureNotPrivate(implicit ctx: Context) =
10541055
if (is(Private))
10551056
copySymDenotation(
1056-
name = if (is(ExpandedName) || isConstructor) this.name else this.name.expandedName(owner),
1057+
name =
1058+
if (is(ExpandedName) || isConstructor) this.name
1059+
else this.name.expandedName(initial.asSymDenotation.owner),
1060+
// need to use initial owner to disambiguate, as multiple private symbols with the same name
1061+
// might have been moved from different origins into the same class
10571062
initFlags = this.flags &~ Private | ExpandedName)
10581063
else this
10591064
}

0 commit comments

Comments
 (0)