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

Heal occurrences of => T between ElimByName and Erasure #19558

Merged
merged 2 commits into from
Jan 31, 2024

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Jan 29, 2024

There's a window of vulnerability between ElimByName and Erasure where some ExprTypes => T that appear as parameters of function types are not yet converted to by-name functions () ?=> T. These would cause an assertion violation when used as operands of & or |. We fix this on the fly when forming these types in TypeComparer. As explained in ElimByName, we can't fix it beforehand by mapping all occurrences of => T to () ?=> T since that could lead to cycles.

Fixes #19548

There's a window of vulnerability between ElimByName and Erasure where some
ExprTypes `=> T` that appear as parameters of function types are not yet converted
to by-name functions `() ?=> T`. These would cause an assertion violation when
used as operands of & or |. We fix this on the fly when forming these types in TypeComparer.
As explained in ElimByName, we can't fix it beforehand by mapping all occurrences of `=> T` to
`() ?=> T` since that could lead to cycles.

Fixes scala#19548
Avoids follow-up failures in Ycheck for the test case.
@odersky odersky merged commit 5c1f86a into scala:main Jan 31, 2024
19 checks passed
@odersky odersky deleted the fix-19548 branch January 31, 2024 09:54
@Kordyjan Kordyjan added this to the 3.4.1 milestone Feb 14, 2024
WojciechMazur added a commit that referenced this pull request Jul 1, 2024
… LTS (#20871)

Backports #19558 to the LTS branch.

PR submitted by the release tooling.
[skip ci]
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.

Compiler crashes with an invocation of a polymorphic by-name function in an if
3 participants