Repository navigation
fix(resolution): resolve this.#field.method() on the field's type (#1987) - #1990
Closed
danusha2345 wants to merge 1 commit into
Closed
danusha2345 wants to merge 1 commit into
danusha2345 wants to merge 1 commit into
Conversation
…lbymchenry#1987) A call through an ES private field fell outside the `this.<field>` shape (colbymchenry#1496): the extractor accepted only a property_identifier, so `this.#items.add(x)` was emitted as the bare `add` and exact-matched whichever project method shared the name, often the calling method itself. The extractor and its kernel mirror now keep `this.#items.add`, and the resolver matches that shape and reads the field's type off the class declaration. The field regexes open with a lookbehind instead of `\b`, which never matches before `#`. A builtin or external field type (`new Set()`, a `Map`, an array) now yields no edge. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
colbymchenry
added a commit
that referenced
this pull request
Sep 27, 2026
…1987) (#2028) * fix(resolution): resolve this.#field.method() on the field's type (#1987) A call through an ES private field fell outside the `this.<field>` shape (#1496): the extractor accepted only a property_identifier, so `this.#items.add(x)` was emitted as the bare `add` and exact-matched whichever project method shared the name, often the calling method itself. The extractor and its kernel mirror now keep `this.#items.add`, and the resolver matches that shape and reads the field's type off the class declaration. The field regexes open with a lookbehind instead of `\b`, which never matches before `#`. A builtin or external field type (`new Set()`, a `Map`, an array) now yields no edge. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(resolution): require receiver evidence for built-in method calls (#1987) Unknown JavaScript receivers could match unrelated methods by name or class-name similarity. Require validated receiver evidence for built-in method names while retaining typed, imported, object-literal and class resolution. Preserve private-field receivers in TypeScript and Rust extraction and keep public/private field declarations distinct. Build on PR #1990 with regression coverage across all four JS/TS variants and kernel/WASM parity. Co-authored-by: danusha2345 <ewidusoc498@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: danusha2345 <ewidusoc498@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Owner
|
Thanks @danusha2345! Your commits here were carried into #2028 (authorship preserved), with a few follow-up changes from review, and that is now merged. Closing this one in favour of it. It will be in the next release. |
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.
Covers the ES private field case from #1987. The untyped
list.mapcase in that issue is #1941.Problem
this.<field>.<method>()(#1496) resolves on the field's declared type, but only for a public field. The extractor checks that the member is aproperty_identifier. An ES private field is aprivate_property_identifier, sothis.#items.add(x)was emitted as the bareadd. That name exact-matched whichever project method is calledadd, often the calling method itself.Fix
this.<field>branch accepts a private field and keeps the#, emittingthis.#items.add. The kernel'sthis_field_ofmirrors this.matchMethodCallmatchesthis.#field.methodbefore its generic dotted pattern, whose receiver class[\w.]+has no#, and hands it tomatchTsThisFieldCall. That function's field regexes now open with a lookbehind instead of\bfor a#name, because\bnever matches before#.The declared-type and
newinitializer patterns are unchanged, and a builtin or external field type (Set,Map, an array) still yields no edge.Measured (
mainba3c21e vs this branch, kernel on)Calls edges on lines containing
this.#field.method(:#keyMap.get→LRUCache::get,#perf.now→Status::now#perf.now→Perf::now#fs.lstatSync→PathBase::lstatSync#var.get→Context::get(self-edge)#root.insert→Node::insert,#init.send→WSContextInit::sendlru-cache also loses 5 wrong
this.#disposed?.push(…)→Stack::pushedges, where#disposedis an array. Total edge counts move by exactly these amounts (lru-cache −24, path-scurry −5, hono −2).Known limit, shared with public fields: a field typed as a type alias to a union isn't followed. lru-cache's
#free: StackLike(Stack | Index[]) loses two plausibleStack::pushedges, the same resultfree: StackLikegets today.Tests
ts-this-field-call.test.ts: a#field: Mailerand a#field = new Mailer()resolve toMailer::sendover a same-file decoyOutbox::send, andthis.#items.add()on aSetstays unresolved over a same-fileCart::add. Both cases fail onmain.kernel-tsjs-parity: the torture fixture gains a private-field delegator. Parity fails if the kernel mirror is reverted.Full suite on this branch (Linux, Node 22, native kernel): all tests pass except the known intermittent
extraction.test.tspool-worker crash from #1779 (fixed by #1883), which also occurs onmain; that file alone passes 655/655.🤖 Generated with Claude Code