Skip to content

fix(rust): keep self method calls on the correct owner - #1882

Merged
colbymchenry merged 6 commits into
mainfrom
fix/triage-1861
Sep 16, 2026
Merged

colbymchenry merged 6 commits into
mainfrom
fix/triage-1861

Conversation

@colbymchenry

Copy link
Copy Markdown
Owner

Rust self.reset() could link to another type's reset() solely because that method was nearer in the file. Retain the receiver in both extractors and resolve it against the enclosing type, with guards for duplicate type names across modules. Missing or ambiguous owners stay unresolved; valid trait, field, split-impl and local-owner calls remain covered.

Fixes #1861. Reuses @L4XB's implementation and original regression tests from #1866, adding duplicate-owner and remove/restore sync coverage. Co-authored-by: L4XB lukas.buck@e-mail.de.

Validation on Linux, Node 24.16, freshly built Rust 1.98.1 kernel:

  • Original actual-index reproduction fails on main 51116a2 in native and WASM, and passes after this change.
  • 254 native tests pass, including full resolution, owner/edit-sync tests, release-to-main regressions, scaffold and all three Rust native/WASM parity cases (none skipped).
  • 46 focused WASM Rust extraction/resolution/owner tests and 23 release-to-main tests pass; full app and native builds pass.
  • Full all-language WASM resolution did not complete: a Dart test timed out and its worker exited. The same Dart case passes isolated. No full-suite or macOS/Windows claim.

The additional ownership guard is covered by tests that fail against the original #1866 proposal. Existing #1794 fixture suites (90 tests) and #1784 getter presence were checked on the fresh baseline before resolver edits.

@colbymchenry
colbymchenry merged commit 8f80819 into main Sep 16, 2026
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.
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.

Rust: self.method() resolves to a same-named method on an unrelated type

1 participant