Skip to content

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
@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