Repository navigation
test(resolution): calls on nested receivers keep their evidence and guess no target - #2867
Merged
Merged
Conversation
…uess no target A member call on a nested receiver, like holder?.values.get(readKey()), has failed both ways. Before PR #1790, each such call was linked by its bare method name, to any project method called get. PR #1790 stopped that by dropping every call on a chain rooted at a name, which also dropped the call sites effects are drawn from (issue #1794). PR #1862 brought the dotted chains back as unresolved references; shapes its chain pattern rejects, like holder[0].get(), are still dropped. The test indexes eight receiver shapes in .ts, .tsx, .js and .jsx: optional access, computed and numeric keys, a quoted key, a comment inside the receiver, a non-ASCII name, an imported root and a namespace import. It checks that the readKey() argument call survives, that nothing links to Collision.get or to the imported object, and that the three dotted chains (holder.values.get, imported.values.get and data.holder.values.get) are still in the index, unresolved. That last check is ours. As first written, the test passed on PR 1790's commit de5adba, so it could not see the drop issue 1794 is about. With it, the test fails 4 of 4 on de5adba (the chains are gone) and 4 of 4 on its parent 72c1ff1 (every shape linked Collision::get), with the kernel and with CODEGRAPH_KERNEL=0, and passes 4 of 4 on main d02a88d with both. On main's code, putting the drop back fails it, as it fails release-main-regressions' retention test; letting the shapes the chain pattern rejects fall back to the bare method name fails only this test. The non-ASCII name is written with U+00F6 and U+00E9, Latin-1 letters, not homoglyphs. Test-only, so no CHANGELOG entry. Original PR #1844 by @bompus. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
Test-only. A regression test for member calls on nested receivers, like
holder?.values.get(readKey()), in.ts,.tsx,.jsand.jsx. Such calls have failed both ways:get;holder[0].get(), are still dropped.What the test checks
Eight receiver shapes: optional access, a computed key, a numeric index, a quoted key, a comment inside the receiver, a non-ASCII name, an imported root and a namespace import. For each one it checks:
readKey()argument call survives;Collision.getor to the imported object;holder.values.get,imported.values.get,data.holder.values.get) are still in the index as unresolved references.What came from the contributor, and what we changed
The test is @bompus's commit, with one addition of ours: the third check, 7 lines. As first written, the test passed on #1790's commit
de5adba7, with the kernel and withCODEGRAPH_KERNEL=0. So it could not see the drop that #1794 is about. It only caught the bare-name guesses from before #1790. We squashed it into one commit with their authorship and our message.The non-ASCII name
höldéruses U+00F6 and U+00E9. These are Latin-1 letters, not homoglyphs. The diff has no invisible or bidi characters.Validation
The 4 cases (ts, tsx, js, jsx), with the kernel (
CODEGRAPH_KERNEL_EXPECT=1) and withCODEGRAPH_KERNEL=0:72c1ff13, #1790's parentCollision::getde5adba7, #1790expected [] to deeply equal [ 'holder.values.get' ]d02a88d0Mutations of main's TS extractor (
CODEGRAPH_KERNEL=0):#1566Map testrelease-main-regressionsretention testSo the second mutation is caught by this test alone.
Suite:
__tests__/resolution.test.tson the exact commit, 240 of 240 passed with the kernel. The new cases also pass withCODEGRAPH_KERNEL=0. Test-only, so no CHANGELOG entry.Lands #1844 by @bompus.
🤖 Generated with Claude Code