fix(resolution): resolve awaited TypeScript receivers safely - #1885
Merged
Merged
Conversation
Reuse and extend PR #1855 with scope, import and edit guards. Co-authored-by: Max Hsu <maxmilian@gmail.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
bompus
added a commit
to bompus/codegraph
that referenced
this pull request
Sep 16, 2026
Upstream changes: - fix(resolution): resolve awaited TypeScript receivers safely (colbymchenry#1885) - fix(rust): keep self method calls on the correct owner (colbymchenry#1882) - fix(telemetry): honor opt-out (colbymchenry#1880) Conflicts: - CHANGELOG.md (both appended under Fixes; kept fork bullets, added upstream's) - src/resolution/name-matcher.ts (fork's modular/binding architecture vs upstream's awaited-receiver machinery; kept both — awaited caches, lexical scope gating and the matchMethodCall fallback slot in alongside requireReceiverEvidence, guarded/iteration receivers and bound-call factory resolution) Fork-side reconciliation: - matchBoundReceiverCall factory path now requires the callee call to end the initializer (upstream's tail rule), so `await f().chain()` binds the chain result rather than f's return type. - Added `new Cls().factory()` member-factory handling to the same path — upstream resolves the awaited member-factory case via generic name matching that the fork's receiver-evidence gate deliberately blocks. - Re-baselined the fork-owned torture-multilang golden: `self.m()` refs are now emitted owner-scoped; `self.area` resolves via qualified-name (0.9) instead of bare-name exact-match (0.4), and calls to methods absent from Self stay unresolved.
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.
Awaiting a function that returns a primitive can currently make calls such as
listed.split()resolve to an unrelated project class. This change uses the visible local or imported factory's return type, keeping the reallistPathscall and validPromise<Engine> → Engine.runrelationships.Reuses @maxmilian's regression cases and primitive guard from #1855, with additional scope, import-alias, return-type ownership, shadowing, multiline-signature, ASI, chained-result, and edit/sync controls. Per-file scope data is lazy and bounded; resolver invalidation clears both eligibility and inferred-type caches. Existing member-factory handling remains intact.
Fixes #1840.
Validation on Node 24.16/Linux:
8f808196and passes with both native and WASM backends.966394c8(treed913cf85c85406ee12b39be93909fd9d79348aa4).Bounded performance check: replayed 207,446 saved JS/TS call references from pinned VS Code platform commit
38246c0through the actual method matcher. Scope caching reduced the initial implementation's cost. The final sequential pair used 23.10 → 26.05 CPU seconds (21.88 → 24.47 wall seconds); this is helper-only overhead, not a full-index timing or speed claim. Optimized matcher results are identical to the preceding correct implementation.Limitations: Linux only. A broader all-language WASM resolution run during the preceding Rust validation exited after a Dart timeout; that case passes in isolation. No full-suite or cross-platform verdict is claimed.
Co-authored-by: Max Hsu maxmilian@gmail.com
Co-authored-by: Claude Opus 5 (1M context) noreply@anthropic.com