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

Fix stack overflow errors when generating opaque type proxies #22479

Merged
merged 1 commit into from
Jan 30, 2025

Conversation

jchyb
Copy link
Contributor

@jchyb jchyb commented Jan 29, 2025

Fixes #22468
Before the regressive PR, we would check via the generated opaqueProxies list whether one was already generated. In that PR, we tried allowing generating proxies for rhs of currently generated proxy. Since we have to add the generated proxy to opaqueProxies only after that step, this could cause infinite recursion (and adding the proxies earlier could cause another infinite loop).

To fix that, we add another collection for termrefs which we already visited this way, but which is not used in the mapOpaques function.

Before the regressive PR, we would check via the generated opaqueProxies
list whether one was already generated. In that PR, we tried allowing
generating proxies for rhs of currently generated proxy. Since we have
to add the generated proxy to opaqueProxies only after that step,
this could cause infinite recursion (and adding the proxies earlier could
cause another infinite loop).

To fix that, we add another collection for termrefs which we already
visited this way, but which is not used in the `mapOpaques` function.
@jchyb jchyb marked this pull request as ready for review January 30, 2025 10:52
@jchyb jchyb merged commit 6d9b0f1 into scala:main Jan 30, 2025
29 checks passed
@jchyb jchyb deleted the fix-i22468-opaque-regression branch January 30, 2025 10:53
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.

Regression for opaque types in getkyo/kyo leading to StackOverflowError
2 participants