fix: add same-class bare-call fallback to incremental rebuild path#1886
Conversation
…ocs check acknowledged) incremental.ts's applyThisReceiverFallbacks (renamed applyCallFallbacks) only implemented the this.method() and Object.defineProperty fallbacks, missing the same-class bare-call fallback that the full-build path has (resolveSameClassBareCallFallback in stages/build-edges.ts). For class-scoped languages (non-JS/TS), a bare call with no receiver now retries qualified as <CallerClass>.<callName> in the incremental path too, guarded by isModuleScopedLanguage exactly as the full-build path is. Reuses the already-shared resolveSameClassQualifiedMethod from call-resolver.ts rather than duplicating its lookup logic. Fixes #1765 Impact: 2 functions changed, 6 affected
Greptile SummaryThis PR adds the missing same-class bare-call fallback (Strategy 2) to the incremental rebuild path in
Confidence Score: 5/5The change is safe to merge — it adds a new fallback branch with guard conditions that are mutually exclusive with all existing strategies, and the shared helper it calls is already proven correct by the full-build path. The new Strategy 2 guard is disjoint from all existing strategies, the implementation mirrors the full-build path exactly, and the parity test is well-structured. No files require special attention. Important Files Changed
Reviews (1): Last reviewed commit: "fix: add same-class bare-call fallback t..." | Re-trigger Greptile |
Codegraph Impact Analysis2 functions changed → 6 callers affected across 2 files
|
Summary
applyThisReceiverFallbacks(renamedapplyCallFallbacks, since it's no longer this-receiver-only) inincremental.tsonly implemented two of the full-build path's fallback strategies (same-classthis.method(),Object.definePropertyaccessor). The full-build path'sresolveSameClassBareCallFallback(a same-class bare-call fallback for class-scoped languages, e.g. C# static sibling calls) had no incremental-path counterpart.resolveSameClassQualifiedMethod/isModuleScopedLanguagefromcall-resolver.ts(no logic duplicated —isModuleScopedLanguagejust needed to be added to the existing import list).Transparency note: I could not reproduce an observable failure from the issue's own example.
incremental.ts's primary resolution step already delegates to a shared function (resolveViaSameClassSibling) that implements an equivalent, strictly broader fallback (global-name lookup vs. this fix's same-file-only lookup) — so the new fallback can mathematically never resolve anything the primary pass didn't already resolve for well-formed inputs. Implemented anyway per the issue's explicit ask: it closes a genuine structural divergence between the two files and is provably harmless. The new test validates full-build/incremental parity (which holds both before and after) rather than a red→green bug transition.Closes #1765
Test plan
npm test— full suite green (3535 passed, 0 failed)npm run lint— cleanValidatorsfixture matching the issue's exact example) confirmed passing on both wasm and native parsing engines, both before and after the change (see transparency note above)incremental.tshas a same-named Rust file (incremental.rs) but it only implements tree-sitter re-parse caching, zero call-resolution logic — no Rust changes neededStacked on #1885 (base branch
fix/issue-1764-computed-key-object-literal) — only the incremental.ts/test diff is this issue's change.