Commit 3b29844
authored
fix(parity): infer var-typed local types from new-expression initializers in C# (#1424)
* test(bench): add JS fixture for bare-call class-scoped lookup regression guard (#1407)
Adds class-scope.js to the JS resolution benchmark. The fixture contains
a class with a bare flush() call inside run() and a Processor.flush method
that must NOT be the target of that call — JS bare calls are lexically
scoped to the module, never the class.
The 1.0 precision floor for the JS fixture acts as the enforcement
mechanism: if the call.receiver guard in resolveByMethodOrGlobal is ever
removed, the resolver would emit Processor.run → Processor.flush as a
false positive, immediately failing CI.
Closes #1407
* fix(parity): infer var-declared local types from new-expression initializers in C#
Both the WASM and native C# extractors were skipping variable declarations
with `var`/`implicit_type` type nodes entirely, so `var service = new
UserService(repo)` never added `service → UserService` to the typeMap. The
call-edge resolver therefore could not resolve `service.AddUser()` or
`service.GetUser()` to the qualified methods on `UserService`.
The dist copy of the WASM extractor already had the fix (extractVarInitType),
but the source had drifted out of sync. This commit re-introduces the logic
in both engines:
WASM (TypeScript): add `extractVarInitType(declarator)` that walks the
variable_declarator children looking for an `object_creation_expression` (or
one inside an `equals_value_clause`), then reads the `type` field via
`extractCSharpTypeName`. `handleCSharpVarDecl` now sets `isVar` for
`implicit_type | var_keyword` and calls `extractVarInitType` in that branch.
Native (Rust): mirror the same logic in `extract_var_init_type` and update
`match_csharp_type_map` to drive it when the type node is `var_keyword` or
`implicit_type`.
Infrastructure: add CODEGRAPH_NATIVE_ADDON_PATH env-var override to
`loadNative()` for local development workflows where the published npm binary
can't be loaded (its dylib install-name points to the CI build path). Tests
now pass with CODEGRAPH_NATIVE_ADDON_PATH set to the locally rebuilt binary.
Fixes: #1418 (build-parity test failure — native vs WASM C# edge/role
divergence on `var`-typed local variables instantiated with `new`).
* fix(resolver): gate bare-call same-class lookup on language (#1424)
In JS/TS, bare foo() calls inside a class method are module-scoped — there
is no implicit class binding. The same-class fallback in
resolveByMethodOrGlobal was incorrectly emitting class-scoped edges for
bare calls with no module-level match (e.g. flush() inside Processor.run
resolving to Processor.flush).
Gate the fallback: skip for bare calls in JS/TS, keep for this.method()
calls and for C#/Java where bare calls are class-scoped.
* fix: update class-scope.js PR reference from #1407 to #1422 (#1424)
* fix: update bare-call guard PR reference from #1407 to #1422/#1424 (#1424)1 parent 7019424 commit 3b29844
2 files changed
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
132 | | - | |
| 132 | + | |
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
0 commit comments