fix(csharp): emit generic_arg references for field types - #2994
Conversation
…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)
There was a problem hiding this comment.
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).
|
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 |
Problem
C# generic type arguments on fields were dropped.
private Box<IAlpha> _fieldemitted areferences[field]edge toBoxbut notreferences[generic_arg]toIAlpha. 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_declarationhandler used_read_csharp_type_name, which reads only the outermost type name. Theproperty_declarationhandler beside it already uses_csharp_collect_type_refsto recurse into generic arguments.Fix
Rewrite the C#
field_declarationbranch to mirrorproperty_declaration:_csharp_collect_type_refsand emitfield/generic_argedges.csharp_field_typesreceiver registration via_csharp_receiver_type_name(C#: file-scoped receiver typing drops truecallsedges in unrelated methods (regression in 0.9.27) #2299).skipset soT valuedoes not fabricate references.Tests
tests/test_languages.py::test_csharp_field_generic_type_arguments_emit_referencestests/test_languages.py::test_csharp_field_type_parameter_emits_no_referenceFixes #2911 (field position only)