Skip to content

Backport "Fix issue with static this references erroring in quoted code" to 3.3 LTS #254

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
Apr 22, 2025

Conversation

tgodzik
Copy link

@tgodzik tgodzik commented Apr 22, 2025

Backports scala#22618 to the 3.3.7.

PR submitted by the release tooling.
[skip ci]

Previously, inherited methods, even if accessed via static objects,
were not able to be used in quotations, unless explicitly pointed to
with a non-`this` prefix. This was due to the fact that during the
cross-stage safety check, first the method itself was checked for if it
was static (which for the inherited method, it was not), and if not,
the prefix was checked further, erroring on any `this` tree found along
the way.

This was fixed by allowing `this` trees if they point to static objects.
This way not only is the initial issue fixed, but also we are able to
freely reference static methods with `this`, like '{this.objectMethod}
(whereas previously, only '{Object.objectMethod} or '{objectMethod}
were allowed, despite them all pointing to the same static method).

[Cherry-picked 71ddfb5]
Base automatically changed from backport-lts-3.3-22611 to lts-3.3 April 22, 2025 17:06
@tgodzik
Copy link
Author

tgodzik commented Apr 22, 2025

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

Reference

@tgodzik tgodzik merged commit 38d859b into lts-3.3 Apr 22, 2025
22 checks passed
@tgodzik tgodzik deleted the backport-lts-3.3-22618 branch April 22, 2025 17:06
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