-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Recursive type throws RecursionOverflow: Recursion limit exceeded #17380
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
Comments
@odersky Should this compile? It looks like it should, but I don't know the exact limitations around types like that. |
It seems like a reasonable type to me. AFAICT it should compile, indeed. At the very least, there's nothing cyclic in there. |
odersky
added a commit
to dotty-staging/dotty
that referenced
this issue
May 1, 2023
The previous logic used two boolean variables to selectively create defensive copies. It was quite complicated. The new logic is simpler and copies less. - It copies only if the same recursive type is accessed with two different prefixes. As long as the prefix stays the same,no confusion in the `substRecThis` is possible. - It avoids the openedTwice logic that causes defensive copies at all points in the future. It seems that trick is no longer necessary. Fixes scala#17380 by avoiding infinite recursion due to defensive copies.
Yes, this should compile. Trying a fix... |
Fixed by the time I woke up the next morning 😄 |
smarter
added a commit
that referenced
this issue
May 5, 2023
The previous logic used two boolean variables to selectively create defensive copies. It was quite complicated. The new logic is simpler and copies less. - It copies only if the same recursive type is accessed with two different prefixes. As long as the prefix stays the same,no confusion in the `substRecThis` is possible. - It avoids the openedTwice logic that causes defensive copies at all points in the future. It seems that trick is no longer necessary. Fixes #17380 by avoiding infinite recursion due to defensive copies. Fixes #17381 as well.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Compiler version
3.3.0-RC3
Minimized code
Output
Expectation
It should compile (I think?).
I was trying to figure out what these
RecTypes
were so I took the example from lookuprefined.scala and added theu
member to it.The text was updated successfully, but these errors were encountered: