Skip to content

fix: prevent built-in Map calls from resolving to project methods (#1566) - #1790

Merged
colbymchenry merged 1 commit into
mainfrom
forge/1566-ts-map-builtin-methods
Sep 8, 2026
Merged

fix: prevent built-in Map calls from resolving to project methods (#1566)#1790
colbymchenry merged 1 commit into
mainfrom
forge/1566-ts-map-builtin-methods

Conversation

@colbymchenry

Copy link
Copy Markdown
Owner

Fixes #1566.

Calls such as values.get() on a local Map and holder.values.get() previously linked to unrelated project methods named get, set, or has. These calls now stay unresolved, while a local new LRUCache() still resolves to that class's methods.

  • Stop receiver-name guessing when the inferred JS/TS type is a known built-in and has no matching project method; share the existing built-in names between resolver paths, including WeakMap and WeakSet.
  • Drop untyped identifier-rooted nested calls in both wasm and native extraction, while retaining calls inside their arguments and the existing window-namespace behavior.
  • Add regression coverage for TS, TSX, JS, JSX, other built-in types, project-class receivers, built-in name shadowing, and kernel/wasm parity.

Verification on Linux x86_64, Node 22.19.0:

  • Rebuilt and reproduced both failures on main at 72c1ff13: local Map produced three false edges at confidence 0.7; nested Map produced one at 0.9, in both engines.
  • npx tsc, npm run copy-assets, and npm run build:kernel passed.
  • Fresh CLI re-index plus SQLite checks in both engines: zero LRUCache callees from either Map function; all three project-class method calls retained at confidence 0.9; removing LRUCache also leaves zero false edges.
  • Native: 920 tests passed across nine related suites, including kernel parity/scaffold. Wasm (CODEGRAPH_KERNEL=0): 889 tests passed across seven related suites.

Re-index after upgrading. Nested property types are not inferred by this change. PR #1691 was evaluated and not used: its this.<field>.method() work remains separately tracked by #1496/#1691.

@colbymchenry
colbymchenry merged commit de5adba into main Sep 8, 2026
@colbymchenry
colbymchenry deleted the forge/1566-ts-map-builtin-methods branch September 8, 2026 19:04
colbymchenry added a commit that referenced this pull request Sep 8, 2026
…ed type (#1496) (#1792)

Land the six-file fix from upstream PR #1691 by danusha2345
(pr-1691 at 6d0e80d), preserving
wasm/native extraction parity and exclusive field-type resolution.

Preserve coexistence with the #1566 Map/collection fix merged in #1790,
including nested holder.values.get coverage and the unchanged #1566
Unreleased changelog bullet. EXTRACTION_VERSION remains unchanged.

Align the existing chained-receiver regression with the fix: a declared
service field calls its method, while an anonymous field type does not
bind to unrelated same-named project functions.

Verified on Linux with Node 22.19.0:
- Rebuilt the native kernel and TypeScript/browser distribution.
- Both backends change Outbox::send -> Outbox::send into
  Outbox::send -> Mailer::send, keep Relay::forward -> Mailer::send,
  and store no self-edges in the issue repro.
- Wasm: 224 tests passed; native kernel: 255 tests passed, no skips.
- All 10 #1566 resolution cases pass on each backend, plus all four
  nested-receiver extraction parity cases.

Co-authored-by: Colby McHenry <colbymchenry@users.noreply.github.com>
bompus added a commit to bompus/codegraph that referenced this pull request Sep 8, 2026
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.

TypeScript: built-in Map.get/set/has calls resolve to unrelated project methods

1 participant