Skip to content

Commit f003711

Browse files
authored
Merge pull request #12844 from dotty-staging/unpickle-param-cycle
TreeUnpickler: fix cycle involving param accessor
2 parents b48b2c1 + 712d53b commit f003711

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -885,7 +885,12 @@ class TreeUnpickler(reader: TastyReader,
885885
}
886886
goto(end)
887887
setSpan(start, tree)
888-
if (!sym.isType) // Only terms might have leaky aliases, see the documentation of `checkNoPrivateLeaks`
888+
889+
// Dealias any non-accessible type alias in the type of `sym`. This can be
890+
// skipped for types (see `checkNoPrivateLeaks` for why) as well as for
891+
// param accessors since they can't refer to an inaccesible type member of
892+
// the class.
893+
if !sym.isType && !sym.is(ParamAccessor) then
889894
sym.info = ta.avoidPrivateLeaks(sym)
890895

891896
if (ctx.settings.YreadComments.value) {

tests/pos/i12834.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
class A(val ref: Option[B])
2+
class B extends A(None)

0 commit comments

Comments
 (0)