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

Do not propagate TypeErrors of ops from TypeComparer#tryAlso #21070

Merged
merged 1 commit into from
Jul 6, 2024

Conversation

EugeneFlesselle
Copy link
Contributor

In pos-deep-subtype/i21015.scala:30, we ask the TypeComparer if M1[Int] <:< M1[A]

isMatchingApply first tries isSubArgs which succeeds, but then also checks if a weaker constraint is generated by recur(tp1.superTypeNormalized, tp2.superTypeNormalized). The latter throws a RecursionOverflow which, before the changes, bypassed the former successful check, and failed the overall subtype test.

Fix #21015

In pos-deep-subtype/i21015.scala:30,
we ask the TypeComparer if `M1[Int] <:< M1[A]`

`isMatchingApply` first tries `isSubArgs` which succeeds,
but then also checks if a weaker constraint is generated by
`recur(tp1.superTypeNormalized, tp2.superTypeNormalized)`.
The latter throws a `RecursionOverflow` which, before the changes,
bypassed the former successful check, and failed the overall subtype test.

Fix scala#21015
@EugeneFlesselle EugeneFlesselle requested a review from odersky July 5, 2024 20:14
@EugeneFlesselle EugeneFlesselle merged commit 2d0e373 into scala:main Jul 6, 2024
24 checks passed
@EugeneFlesselle EugeneFlesselle deleted the fix-21015 branch July 6, 2024 07:28
WojciechMazur added a commit that referenced this pull request Jul 11, 2024
…Also`" to LTS (#21169)

Backports #21070 to the LTS branch.

PR submitted by the release tooling.
@WojciechMazur WojciechMazur added this to the 3.6.0 milestone Oct 8, 2024
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 in 3.5: Infinite recursion during typecheck of polymorphic-recursion with match types
3 participants