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

Fix condition in prefixIsElidable to prevent compiler crash #18924

Merged
merged 2 commits into from
Nov 17, 2023

Conversation

szymon-rd
Copy link
Contributor

@szymon-rd szymon-rd commented Nov 14, 2023

Fix #18901

The check in prefixIsElidable was defined as follows:

tp.symbol.isParamOrAccessor && !pre.cls.is(Trait) && ctx.owner.enclosingClass == pre.cls

I assume that !pre.cls.is(Trait) condition was introduced to accommodate for Mixin phase getting rid of ParamAccessor defined in traits. However, the prefix does not indicate where the symbol is really defined - it only represents the prefix from the perspective of the current template, so it could be inherited. When it's inherited from a trait, the prefix would be the current class, but the member still is defined in the trait, and Mixin would get rid of the ParamAccessor flag. Therefore, I changed this condition to the following:

tp.symbol.isParamOrAccesso && !pre.cls.is(Trait) && !tp.symbol.owner.is(Trait) && ctx.owner.enclosingClass == pre.cls

@szymon-rd szymon-rd requested a review from sjrd November 14, 2023 15:52
@sjrd sjrd self-assigned this Nov 14, 2023
@szymon-rd
Copy link
Contributor Author

It fails a lot of CC tests (for some reason only CC and captures)

@szymon-rd
Copy link
Contributor Author

Now it's passing

@sjrd sjrd merged commit 772be76 into main Nov 17, 2023
35 checks passed
@sjrd sjrd deleted the fix-check-elidable-compiler-crash branch November 17, 2023 12:29
@Kordyjan Kordyjan added this to the 3.4.0 milestone Dec 20, 2023
WojciechMazur added a commit that referenced this pull request Jun 23, 2024
…" to LTS (#20752)

Backports #18924 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.

Simple snippet crashing when Ycheck:all
3 participants