[Feature]: C#: interface dispatch stops at the interface when there is more than one implementer, and property access through an interface is not linked
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
Research direction
Start in the C# resolution layer (the tree-sitter csharp module and the interface-dispatch code path, which today only proceeds when exactly one implementer exists — same area as #3003). Build the graph over the single-file Conn.cs repro in the issue to confirm the current output: only references to IConnecter and calls to IConnecter.Read, with no dispatches_to and nothing for c.Count. Done means dispatches_to edges from IConnecter.Read to both Effect.Read and Property.Read, plus an edge for the interface-typed property read; extend the existing C# resolution tests for the single-implementer case.
Written by the indexing model from the issue text.
Description
Problem or use case
Related to #3003. Once a call has reached an interface member, a walk only continues to the
implementation when the interface has exactly one implementer. With two or more, the graph
stops at the interface, which is where most interfaces in practice sit. Reading a property through
an interface-typed receiver produces no edge at all.
Repro, one file, Conn.cs:
namespace Demo
{
public interface IConnecter { void Read(); int Count { get; } }
public class Effect : IConnecter
{
public void Read() { }
public int Count => 0;
}
public class Property : IConnecter
{
public void Read() { }
public int Count => 1;
}
public class User
{
public void Go(IConnecter c)
{
c.Read();
int n = c.Count;
}
}
}
Actual:
conn_demo_user_go --references--> conn_demo_iconnecter
conn_demo_user_go --calls--> conn_demo_iconnecter_read
No dispatches_to from IConnecter.Read() to either implementation, and nothing for c.Count.
Proposed solution
dispatches_tofrom an interface member to the same-named member of every implementing
type (and subclasses of one), explicit implementations included, withconfidence: INFERRED
and perhaps a score that falls with the implementer count. #3003's reasoning ("guessing among
several implementers would not" mirror the runtime) is right for a single call site, but for a
static structural graph the question is "what can this call reach", and the answer is all of
them. Stopping at the interface answers "nothing".- A
callsedge (or a distinct relation such asaccesses) from a method to an interface
property it reads or writes through an interface-typed receiver. Property getters are method
calls, and in interface-heavy code they are a large share of the traffic across the seam.
Limiting this to interface receivers would keep it from flooding the graph with every
obj.Nameread.
Alternatives considered
No response
Area
Graph building or querying
Additional context
in a Unity codebase whose editor assembly may only reach the runtime through interfaces,
the busiest seam interface has three implementers and much of the editor's traffic through it is
property reads (Ed.DataOwner, Ed.EditorLayouts). A local post-pass doing exactly (1) and (2)
added about 170 member-level dispatch edges and 190 property-access edges to a ~120-file graph,
and made editor-to-implementation paths two hops long.
- Dominant language
- Python
- Stars
- 124k
- Forks
- 11.9k
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Graphify-Labs/graphify
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
Graphify-Labs/graphify#3763 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Graphify-Labs/graphify#3611 · 1 comment ·
Maintainers usually reply within 1 day
-
Nix supportOpen
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Graphify-Labs/graphify#3193 · 2 reactions ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
Graphify-Labs/graphify#2871 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Graphify-Labs/graphify#2865 ·
Maintainers usually reply within 1 day
All issues in Graphify-Labs/graphify
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
huggingface/peft#3955 ·
Maintainers usually reply within 1 day
-
author-page correction
Difficulty 2/5 1-3 hours Newbie friendliness 60/100
acl-org/acl-anthology#10313 ·
Maintainers usually reply within 1 day
-
anime duplicate exception request-theme
Difficulty 1/5 Under an hour Newbie friendliness 82/100
LizardByte/ThemerrDB#8926 · 1 comment ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
huggingface/transformers#49556 ·
Maintainers usually reply within 1 day
-
area/security bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
mozilla-ai/otari#2245 ·
Maintainers usually reply within 1 day