Skip to content

C# delegate declarations dropped, so in-file references mint a sourceless god node #4552

Closed

Description

@rajatnagda45

Version

v8 @ 0.9.92 (86c57be)

Problem

A C# delegate is a named type, but delegate_declaration is in neither class_types nor function_types, so the declaration is dropped. A field or parameter typed as the delegate still resolves the name through ensure_named_node, which mints a sourceless stub and points the references edge at it — even though the delegate is declared in the same file.

That violates the provenance invariant: a real source-backed declaration must not lose to a sourceless god node (and the bare-id stub becomes a cross-file hub shared by every same-named reference in the corpus).

Reproduce

public delegate int BinOp(int a, int b);
public class Calc {
    public BinOp Op;
    public int Apply(BinOp f, int x) { return f(x, x); }
}

BinOp appears as a node with empty source_file, and Calc/Apply reference that sourceless node.

Expected vs actual

  • Expected: BinOp is a sourced node in the declaring file; references bind to it.
  • Actual: BinOp is sourceless; references bind to the stub.

Notes

delegate_declaration has a name field and no body, so it emits a clean empty type node (no phantom members). Delegate parameter/return type refs and delegate-instance invocation resolution are out of scope.

Activity

  1. github-actions commented on Oct 18, 2026

    @github-actions

    Thanks for opening this issue, @rajatnagda45. A maintainer will take a look soon.

    If you would like to discuss it in real time, come say hi on our Discord server. For longer-form questions and ideas there is also GitHub Discussions.

    To help us triage, please make sure the report includes what you expected, what actually happened, and the steps (and a small sample) to reproduce it.

  2. safishamsi commented on Oct 20, 2026

    @safishamsi
    Member

    Fixed in 0.9.93 by #4556. A C# delegate reference now resolves instead of minting a sourceless stub. Thanks @rajatnagda45 for the report. Live on PyPI: https://pypi.org/project/graphifyy/0.9.93/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions