Skip to content

fix(csharp): emit generic_arg references for field types - #2994

Closed
akshitj11 wants to merge 1 commit into
Graphify-Labs:v8from
akshitj11:fix/csharp-field-generic-args
Closed

fix(csharp): emit generic_arg references for field types#2994
akshitj11 wants to merge 1 commit into
Graphify-Labs:v8from
akshitj11:fix/csharp-field-generic-args

Conversation

@akshitj11

Copy link
Copy Markdown
Contributor

Problem

C# generic type arguments on fields were dropped. private Box<IAlpha> _field emitted a references[field] edge to Box but not references[generic_arg] to IAlpha. The same type on a property already emitted both edges.

Call-site generic arguments (r.Do<IEpsilon>()) and DI registration (AddScoped<IZeta, Box<IZeta>>()) are unchanged in this PR and left for a follow up.

Cause

The field_declaration handler used _read_csharp_type_name, which reads only the outermost type name. The property_declaration handler beside it already uses _csharp_collect_type_refs to recurse into generic arguments.

Fix

Rewrite the C# field_declaration branch to mirror property_declaration:

Tests

  • tests/test_languages.py::test_csharp_field_generic_type_arguments_emit_references
  • tests/test_languages.py::test_csharp_field_type_parameter_emits_no_reference
pytest tests/test_languages.py -k csharp -q

Fixes #2911 (field position only)

…bs#2911)

Field declarations used _read_csharp_type_name and dropped generic
type arguments. Properties already walked types with
_csharp_collect_type_refs.

Mirror the property_declaration handler for fields while keeping
csharp_field_types receiver registration (Graphify-Labs#2299).

Call-site generic arguments are left for a follow-up PR.

Fixes Graphify-Labs#2911 (field position)

@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).


Graphify review — findings

Adds generic type-argument references for C# field declarations by routing field types through _csharp_receiver_type_name and _csharp_collect_type_refs, so Box<IAlpha> now emits both a field reference to Box and a generic_arg reference to IAlpha. Continues to skip type parameters and self-references. Covers the new behavior with test_csharp_field_generic_type_arguments_emit_references and test_csharp_field_type_parameter_emits_no_reference.

No blocking issues surfaced. 3 lower-confidence candidates did not survive cross-model review.

Analysis details — impact, health, verification

Impact & health

Graphify review

Impact — 905 functions depend on the 698 functions this change touches.

Health — this change adds coupling hotspots:

  • new: _extract_generic() — 18 callers, 24 callees
  • new: extract_xaml() — 19 callers, 17 callees
  • new: extract_objc() — 27 callers, 9 callees
  • new: extract_js() — 80 callers, 3 callees
  • new: extract_julia() — 16 callers, 7 callees
  • new: extract_vue() — 10 callers, 6 callees
  • new: walk() — 1 callers, 56 callees
  • new: extract_groovy() — 14 callers, 3 callees
  • …and 7 more — each is listed as a finding

Verification — 905 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: 863 function(s) in the blast radius were not formally verified this run

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

@safishamsi

Copy link
Copy Markdown
Collaborator

Thanks @akshitj11 — this is already fixed. #2913 landed the same C# field-position generic-arg walk in v0.9.49, and #2994's own tests pass against the current tree without this change. Closing as already-fixed; the field-generics work shipped under #2911 via #2913. Release: https://github.com/Graphify-Labs/graphify/releases/tag/v0.9.49

@safishamsi safishamsi closed this Aug 24, 2026
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#: generic type arguments are dropped in field and call-site position (captured in property/return/parameter)

2 participants