Skip to content

Commit 3100b7c

Browse files
committed
Avoid private leaks when unpickling from Scala 2
Previously, this was only done when typechecking from sources or when unpickling from Tasty.
1 parent 8a9aedc commit 3100b7c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,12 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
560560
// we need the checkNonCyclic call to insert LazyRefs for F-bounded cycles
561561
else if (!denot.is(Param)) tp1.underlyingIfRepeated(isJava = false)
562562
else tp1
563+
564+
if (!denot.isType) { // Only terms might have leaky aliases, see the documentation of `checkNoPrivateLeaks`
565+
val sym = denot.symbol
566+
denot.info = ctx.typeAssigner.avoidPrivateLeaks(sym, sym.pos)
567+
}
568+
563569
if (denot.isConstructor) addConstructorTypeParams(denot)
564570
if (atEnd) {
565571
assert(!denot.isSuperAccessor, denot)

0 commit comments

Comments
 (0)