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

review: fix: Use CtSuperAccess when implicitly accessing superclass field #5406

Merged
merged 5 commits into from
Oct 4, 2023

Conversation

I-Al-Istannen
Copy link
Collaborator

Closes #5221

@I-Al-Istannen I-Al-Istannen self-assigned this Aug 28, 2023
@I-Al-Istannen I-Al-Istannen force-pushed the fix/implicit-super-access branch 2 times, most recently from 12a258a to ea9a0ad Compare August 28, 2023 16:00
@I-Al-Istannen I-Al-Istannen changed the title fix: Use SuperAccess when implicitly accessing superclass field review: fix: Use SuperAccess when implicitly accessing superclass field Aug 28, 2023
@I-Al-Istannen I-Al-Istannen changed the title review: fix: Use SuperAccess when implicitly accessing superclass field review: fix: Use CtSuperAccess when implicitly accessing superclass field Aug 28, 2023
@@ -364,12 +365,32 @@ <T> CtFieldAccess<T> createFieldAccess(SingleNameReference singleNameReference)
if (ref.isStatic() && !ref.getDeclaringType().isAnonymous()) {
va.setTarget(jdtTreeBuilder.getFactory().Code().createTypeAccess(ref.getDeclaringType(), true));
} else if (!ref.isStatic()) {
va.setTarget(jdtTreeBuilder.getFactory().Code().createThisAccess(jdtTreeBuilder.getReferencesBuilder().getTypeReference(singleNameReference.actualReceiverType), true));
CtTypeReference<?> owningType = jdtTreeBuilder.getReferencesBuilder().getTypeReference(singleNameReference.actualReceiverType);
if (enclosingClassHasFieldWithName(singleNameReference)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like singleNameReference.actualReceiverType == singleNameReference.fieldBinding().declaringClass does the job too, however I'm wondering if actualReceiverType is what we want here for the owning type?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@I-Al-Istannen can you resolve this?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MartinWitt MartinWitt merged commit 30c6186 into INRIA:master Oct 4, 2023
11 checks passed
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.

[Bug]: CtFieldAccess with an implicit super has a target of CtThisAccess instead of CtSuperAccess
3 participants