Skip to content

Handle AvoidMap recursions #15393

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

Merged
merged 2 commits into from
Jun 12, 2022
Merged

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Jun 7, 2022

Issue a diagnostic instead of crashing when there is a stack overflow

Avoids the crash in the minimized version of #15365

@odersky
Copy link
Contributor Author

odersky commented Jun 7, 2022

We still need to get to the bottom of why we get the cyclic lower bounds that lead to the problem.

@odersky odersky requested a review from smarter June 7, 2022 16:02
@odersky odersky force-pushed the fix-15365-partial branch from 045027c to 93da7c9 Compare June 8, 2022 09:17
@smarter
Copy link
Member

smarter commented Jun 10, 2022

We still need to get to the bottom of why we get the cyclic lower bounds that lead to the problem.

I have a simpler example where the constraint solver can create cycles like this: #15280, in this issue I proposed to detect the cycle at instantiation and emit an error then, but this isn't enough for operations like avoid that traverse the bounds of uninstantatiated type variables. So unless by some miracle we can come up with a cycle-free constraint solver, I guess we'd have to guard recursion in avoid and other operations by keeping track of seen type variables.

@@ -0,0 +1,17 @@
trait Tagged[U]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw, you can also just add // scalac: -Yno-deep-subtypes

@odersky
Copy link
Contributor Author

odersky commented Jun 12, 2022

OK, I am going to merge this for now, since a more fundamental fix is out of reach.

@odersky odersky closed this Jun 12, 2022
@odersky odersky reopened this Jun 12, 2022
@odersky odersky merged commit 1e09221 into scala:main Jun 12, 2022
@odersky odersky deleted the fix-15365-partial branch June 12, 2022 21:13
@Kordyjan Kordyjan added this to the 3.2.0 milestone Aug 1, 2023
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.

4 participants