Skip to content

[backport] TreeUnpickler: fix cycle involving param accessor #12873

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,12 @@ class TreeUnpickler(reader: TastyReader,
}
goto(end)
setSpan(start, tree)
if (!sym.isType) // Only terms might have leaky aliases, see the documentation of `checkNoPrivateLeaks`

// Dealias any non-accessible type alias in the type of `sym`. This can be
// skipped for types (see `checkNoPrivateLeaks` for why) as well as for
// param accessors since they can't refer to an inaccesible type member of
// the class.
if !sym.isType && !sym.is(ParamAccessor) then
sym.info = ta.avoidPrivateLeaks(sym)

if (ctx.settings.YreadComments.value) {
Expand Down
2 changes: 2 additions & 0 deletions tests/pos/i12834.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class A(val ref: Option[B])
class B extends A(None)