Skip to content

Backport "Fix inline reduction for CaseDef guards with asInstanceOf" to 3.3 LTS #163

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

Merged
merged 1 commit into from
Mar 14, 2025

Conversation

tgodzik
Copy link

@tgodzik tgodzik commented Mar 14, 2025

Backports scala#22305 to the 3.3.6.

PR submitted by the release tooling.
[skip ci]

In Inliner.scala
we add asInstanceOf to references to private inline methods to make sure
we later are able to know which method is referenced (if e.g. we inline
out of the scope where that method would be visible). This added
asInstanceOf caused issue when inlining CaseDef guards, as instead of a
simple constant literal we get an Inlined node with an added binding,
like this:
```scala
{
  val A_this: A = A_this.asInstanceOf[A]
  true:Boolean
}
```
We fix that by just unpacking that Inlined node (and we do not need that
binding for constant literals, so we can just ignore it).
[Cherry-picked 1448123]
@tgodzik
Copy link
Author

tgodzik commented Mar 14, 2025

No regressions detected in the community build up to backport-lts-3.3-22326.

Reference

@tgodzik tgodzik merged commit ac70557 into lts-3.3 Mar 14, 2025
22 checks passed
@tgodzik tgodzik deleted the backport-lts-3.3-22305 branch March 14, 2025 17:13
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