Skip to content
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

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

Merged

Conversation

smarter
Copy link
Member

@smarter smarter commented Jun 18, 2021

This backports #12844

When unpickling a template like `A` in i12834.scala, the first thing we
do is to unpickle its class parameters, here that's `ref`. While
unpickling `ref` we run `avoidPrivateLeaks` on it which forces its info
and requires unpickling `B` which refers to `A.<init>` which leads to a
crash because we haven't entered `<init>` in `A` yet. We can avoid this
cycle by simply not running `avoidPrivateLeaks` on param accessors, this
should be safe since a primary constructor parameter cannot refer to a
type member of the class.

Fixes scala#12834.
@smarter smarter requested a review from bishabosha June 18, 2021 10:56
@smarter smarter added this to the 3.0.1 milestone Jun 18, 2021
@smarter
Copy link
Member Author

smarter commented Jun 18, 2021

The CI failure is unrelated to this PR.

@bishabosha bishabosha merged commit 0c8bb6c into scala:release-3.0.1 Jun 21, 2021
@bishabosha bishabosha deleted the backport-unpickle-param-cycle branch June 21, 2021 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants