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

Rollback constraints if isSameType failed second direction #20109

Merged
merged 1 commit into from
Apr 6, 2024

Conversation

EugeneFlesselle
Copy link
Contributor

@EugeneFlesselle EugeneFlesselle commented Apr 5, 2024

It turns out the following assertion does not hold in the current definition of isSameType

val preConstraint = constraint
val isSame = isSubType(tp1, tp2) && isSubType(tp2, tp1)
isSame.ensuring(_ || constraint == preConstraint)

I didn't try to form a minimised snippet where this would cause a problem. But as an example, the code in #19955 (comment) produces invalid constraints which lead to suspicious looking <notypes>s in the subtyping trace.

@EugeneFlesselle EugeneFlesselle marked this pull request as ready for review April 5, 2024 21:14
@odersky odersky merged commit 960858d into scala:main Apr 6, 2024
19 checks passed
@odersky odersky deleted the isSameType branch April 6, 2024 10:27
@Kordyjan Kordyjan added this to the 3.5.0 milestone May 10, 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.

3 participants