Skip to content

Conversation

WojciechMazur
Copy link
Contributor

Backports #19983 to the LTS branch.

PR submitted by the release tooling.
[skip ci]

When running:

    val f: ( => Int) => Int = i => i ; f(1)

twice in the REPL, the second time crashed with a ClassCastException.

The difference is that in the second run, the denotation for `f.apply` is
created from the SymDenotation for `Function1#apply` which already exists and is
known to be valid in every phase, but that doesn't mean that the derived
denotation for `f.apply` has the same validity: unlike the SymDenotation it
needs to be transformed (in particular to run the `ElimByName` transformer).

It turns out that there were multiple places in the compiler where we created a
new denotation with a validity based on the existing one when this was not
legitimate. I've gone through all these places and replaced them by
`currentStablePeriod`.

Fixes #18756.

[Cherry-picked 49571fa]
Base automatically changed from lts-19931 to lts-3.3 July 5, 2024 13:23
@WojciechMazur
Copy link
Contributor Author

No regressions detected in the community build up to lts-20295.

Reference

@WojciechMazur WojciechMazur merged commit 58af2b0 into lts-3.3 Jul 5, 2024
@WojciechMazur WojciechMazur deleted the lts-19983 branch July 5, 2024 13:23
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.

2 participants