-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix #1401: Make sure all references are forwarded #1407
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
Conversation
Review by @liufengyun ? |
- increase page width - print scopes more legibly under -verbose
Faced with recursive dependencies through self types, we might have to apply `normalizeToClassRefs` to a class P with a parent that is not yet initialized (witnessed by P's parents being Nil). In that case we should still execute forwardRefs on P, but we have to wait in a suspension until P is initialized. This avoids the problem raised in scala#1401. I am still not quite sure why forwardRefs is needed, but it seems that asSeenFrom alone is not enough to track the dependencies in this case.
Rebased to master |
@@ -106,7 +106,7 @@ object Scala2Unpickler { | |||
// `denot.sourceModule.exists` provision i859.scala crashes in the backend. | |||
denot.owner.thisType select denot.sourceModule | |||
else selfInfo | |||
denot.info = ClassInfo(denot.owner.thisType, denot.classSymbol, Nil, decls, ost) // first rough info to avoid CyclicReferences | |||
denot.info = new TempClassInfo(denot.owner.thisType, denot.classSymbol, decls, ost) // first rough info to avoid CyclicReferences |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not clear to me where the suspensions
of this TempClassInfo is executed. For the TempClassInfo in Namer, there's an explicit call tempClassInfo.suspensions.foreach(_())
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch (they were never executed). I added a commit that fixes that. I could not come up with a test case specifically for classfile reading, but it seems obvious that the treatment
should be the same as in Namer.
Make treatment in Scala2Unpickler and Namer the same and factor out common functionality.
LGTM |
Thanks @odersky for fixing this tricky bug. |
I minimized the problem to i1401.scala. If we swap Buffer and BufferLike, the test already succeeds without this PR. The difference between the two orders is that we are lacking some parameter forwarders in the error scenario. This PR fixes that.