Skip to content

fix(csharp): resolve unqualified generic call sites, Get<int>(...) (#3406) - #3422

Closed
abhay-codes07 wants to merge 1 commit into
Graphify-Labs:v8from
abhay-codes07:fix/csharp-generic-callsites
Closed

abhay-codes07 wants to merge 1 commit into
Graphify-Labs:v8from
abhay-codes07:fix/csharp-generic-callsites

Conversation

@abhay-codes07

Copy link
Copy Markdown
Contributor

Closes #3406.

The problem

A C# call with an explicit type argument and no receiver never got a calls edge — Get<int>("port"), this.Get<int>("port"), Make<int>() all dropped it while the non-generic spellings resolved, exactly as the issue's 5-case table shows (reproduced verbatim on 0.9.56).

The invocation handler has arms for a member_access_expression function node and an identifier one. Get<int>(...) parses as a generic_name, so it fell to the raw-text fallback and the callee was captured as Get<int> — brackets and all — which can never match the .Get() member node. this.Get<int>(...) failed one arm earlier: the member branch read the name field's raw text, and that field is the same generic_name.

The change

A small helper, _csharp_bare_call_name, reads the identifier child of a generic_name (and passes a plain identifier through untouched). The member arm uses it for the name field, and the unqualified path gains a generic_name arm beside the identifier one. The type-argument list is not part of the method's identity, so the callee is the bare name — after that, same-class and base-class resolution work exactly as they do for the non-generic controls. The #2911 generic_arg reference emission reads the type-argument list off the same nodes and is untouched.

Tests

tests/test_csharp_generic_callsites.py — 5 tests on the issue's exact 3-file repro: the unqualified base-class call, the this.-qualified call, and the same-class call all resolve; no target ever derives from the bracketed raw text; and the two non-generic controls keep resolving. With the fix reverted, 3 of 5 fail (the controls rightly keep passing). The C# suites are unchanged (174 passed); the full suite matches a fresh same-version v8 (0.9.56) baseline.

🤖 Generated with Claude Code

https://claude.ai/code/session_01JJbLfztSxm2tH5cJwBbe9q

Copilot AI lite review requested due to automatic review settings September 8, 2026 18:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@graphify-labs graphify-labs Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Graphify reviewed this change.

Looks safe to merge — no coupling regressions and no blocking issues, checked against the code graph (not a self-assessment).

Formal verification. No changes could be formally verified in this run.


Graphify review — findings

Fixes C# generic call sites (Get<int>(...), this.Get<int>(...), Make<int>()) dropping their calls edges by resolving the callee to the bare identifier via _csharp_bare_call_name, which strips the type-argument list from a generic_name node so the call matches the actual method instead of the verbatim Get<int> text. Adds a generic_name arm to the unqualified-invocation handler in _extract_generic (member and identifier calls were already covered) and tests covering the base-class, this-qualified, and same-class cases plus regression guards that no target retains bracketed text.

No blocking issues surfaced.

Analysis details — impact, health, verification

Impact & health

Graphify review

Impact — 665 functions depend on the 224 functions this change touches.

Health — this change adds coupling hotspots:

  • new: _extract_generic() — 18 callers, 26 callees
  • new: extract_js() — 85 callers, 4 callees
  • new: extract_xaml() — 19 callers, 17 callees
  • new: extract_objc() — 27 callers, 9 callees
  • new: extract_julia() — 17 callers, 7 callees
  • new: extract_cpp() — 27 callers, 3 callees
  • new: extract_vue() — 10 callers, 7 callees
  • new: walk() — 1 callers, 58 callees
  • …and 8 more — each is listed as a finding

Verification — 665 functions in the blast radius were not formally verified this run (proofs are advisory here).

Gate & verification

graphify gate

PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.

Advisory (not blocking):

  • verification_scope: 605 function(s) in the blast radius were not formally verified this run

Test selection

Test selection

22 of 260 test file(s) selected (8%) via static blast radius.

  • tests/test_astro_extraction.py — impact
  • tests/test_build.py — impact
  • tests/test_cjs_module_extension.py — impact
  • tests/test_cpp_nested_and_cli.py — impact
  • tests/test_csharp_generic_callsites.py — impact, changed-test
  • tests/test_dotnet.py — impact
  • tests/test_extract.py — impact
  • tests/test_import_extension_resolution.py — impact
  • tests/test_indirect_dispatch.py — impact
  • tests/test_indirect_dispatch_assign_return.py — impact
  • tests/test_indirect_dispatch_getattr.py — impact
  • tests/test_js_exported_scalar_bindings.py — impact
  • tests/test_languages.py — impact
  • tests/test_multilang.py — impact
  • tests/test_python_underscore_resolution.py — impact
  • tests/test_rationale.py — impact
  • tests/test_ruby_resolution.py — impact
  • tests/test_scala_self_type.py — impact
  • tests/test_swift_computed_properties.py — impact
  • tests/test_ts_new_expression_calls.py — impact
  • tests/test_typescript_module_extensions.py — impact
  • tests/test_vue_extraction.py — impact

Selection is safe under the controlled-regression assumption; always-run tests + a periodic full run are the backstops. Advisory — it never changes the check verdict.

Formal verification

Could not verify: Could not verify \_extract\_generic.

The verifier did not have enough to check \_extract\_generic, so it is saying so rather than guessing. No false assurance is the whole point.

Guarantee: No guarantee either way, this is an honest abstention, not a pass.

Note: Reason: parameter `path` is annotated `Path` — outside the synthesizable primitive/collection set

· 16 more finding(s) on lines outside this diff (see the check run).

@safishamsi

Copy link
Copy Markdown
Member

Shipped in v0.9.57 — landed on v8 via cherry-pick with your authorship preserved. Thanks @abhay-codes07 — a C# generic call site with explicit type arguments (Get(...)) now resolves to the method definition. Release: https://github.com/Graphify-Labs/graphify/releases/tag/v0.9.57

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.

C#: an unqualified generic call (Get<T>(...), this.Get<T>(...)) drops its calls edge

3 participants