-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Avoid forcing ctors & parents which caused cycles #17086
Conversation
Need to go back, see if we can make class completion defer completing the constructor, now that #16664 is in. |
dfea49c
to
a4a87b0
Compare
Added comments to the changes and added detail to the PR description. |
@odersky Can I do anything to assist in reviewing and merging this? |
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 difficult for me to review this because the change set is large and the issues are very subtle. Would it be possible to split this in two commits? The first commit should only refactor things and move code around (it seems there's quite a bit of that). The second commit should then change the logic.
Yep absolutely. |
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 complicated, but i think I get it. Looks good to me!
Thank you Martin. |
Fixes #15177
The current class completion eagerly completes the constructor before finishing. This means that any reference within the constructor that ends up referencing that class would fail as "cyclic" even though the actual classes aren't cyclic. With the change in #16664 "Disallow constructor params from appearing in parent types for soundness", I thought perhaps that was the motivation for the completion, so with that motivation going away we could fix this code. It turns out that DerivedFromParamTree perhaps was at the centre of this. Without changing that scheme, I allowed for the necessary indexing to occur on the constructor for successful compilation, deferring the rest of the constructor completion for later.
It seems this has impacted a number of users, it used to work in Scala 2, and there's nothing wrong with it compiling, so I think we find a way to make it.