Fix phantom argument attachment in Fluent DSL member expressions#2795
Draft
narangtanmay wants to merge 2 commits into
Draft
Fix phantom argument attachment in Fluent DSL member expressions#2795narangtanmay wants to merge 2 commits into
narangtanmay wants to merge 2 commits into
Conversation
|
Tanmay seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
7452117 to
1f199c7
Compare
1f199c7 to
e025dd1
Compare
member() base lambdas evaluated eagerly under the enclosing Call's ArgumentHolder, attaching ref()/member() inside them as phantom arguments before member() itself ran. Clean up the phantom via holder -= memberBase, mirroring the existing memberCall() fix. Removes the makeMagic flag on ref(), now redundant.
base now declares its own Holder context parameter, resolved at invocation rather than capture. Calling it under a no-op DiscardHolder means ref()/member() inside it never reach the real outer holder, removing the need for the holder -= memberBase cleanup.
e025dd1 to
7beddf7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
member()with an explicitbaselambda (e.g.call("doSomething") { member("field1") { ref("s1") } }) attached the base expression to the wrongArgumentHolder. A plain lambda resolves its enclosing holder from where it's written, not where it's invoked, soref("s1")resolved to the outerCalland added itself as a phantom second argument.basenow declares its ownHoldercontext parameter, bound at invocation rather than capture. Calling it under a no-opDiscardHoldermeans anyref()/member()inside it attaches there instead of leaking into the real outer holder.Removes the
makeMagicper-callsite flag previously needed as a workaround atref()call sites.Test plan
cpg-core:test(FluentTest.testMemberWithBaseAttachesExactlyOnce)cpg-analysis:test(QueryTest)cpg-core:compileKotlin