C#: bare calls to inherited members of a generic base class stay ambiguous against unrelated same-name statics #370

Closed
opened 2026-10-14 08:50:20 +02:00 by buildagent · 0 comments
Member

Field report (local-ai-server, E3, 0.37.1 8df22f69)

TypedPara.cs has 5,150 unresolved refs. All of them are ambiguous, and none are qualified:

public class BELPOSGroup : ParaGroupBase<TypedPara> {
    public string PosErfassungSchalter {
        get { return Get("PosErfassungSchalter", null, @"..."); }
        set { Set("PosErfassungSchalter", value, @"..."); } } }
  • Get (2,237 refs) and Set (2,237 refs) are bare calls to protected members of the generic base ParaGroupBase<T>. The base lives in another project of the same repo.
  • Competing same-name candidates exist: each of the ~325 Enums structs declares public static X Get(string key).
  • The base-class member should win. In C#, an unqualified call inside a class binds through the class's own members and then its base chain, never to a static member of an unrelated type.

To do

  • Reproduce with a fixture: a generic base with protected T Get(...) and Set(...), a subclass in another file/namespace calling Get(...) bare, and decoy types with static Get(...).
  • Find whether the resolver has an inherited-member rule for bare calls (supertype role bits, #240) and why it does not apply here: the generic base ParaGroupBase<TypedPara>, a base in another project, or the bare call kind.
  • Fix with one rule: bare call → enclosing type → base chain, with the type arguments stripped.
  • Measure with a corpus bind diff and a hand-checked sample. Precision must stay 7/7, phantom 0.

Related: #369, #371.

## Field report (local-ai-server, E3, 0.37.1 8df22f69) `TypedPara.cs` has 5,150 unresolved refs. All of them are `ambiguous`, and none are qualified: ```csharp public class BELPOSGroup : ParaGroupBase<TypedPara> { public string PosErfassungSchalter { get { return Get("PosErfassungSchalter", null, @"..."); } set { Set("PosErfassungSchalter", value, @"..."); } } } ``` - `Get` (2,237 refs) and `Set` (2,237 refs) are bare calls to **protected members of the generic base** `ParaGroupBase<T>`. The base lives in another project of the same repo. - Competing same-name candidates exist: each of the ~325 `Enums` structs declares `public static X Get(string key)`. - The base-class member should win. In C#, an unqualified call inside a class binds through the class's own members and then its base chain, never to a static member of an unrelated type. ## To do - Reproduce with a fixture: a generic base with `protected T Get(...)` and `Set(...)`, a subclass in another file/namespace calling `Get(...)` bare, and decoy types with `static Get(...)`. - Find whether the resolver has an inherited-member rule for bare calls (supertype role bits, #240) and why it does not apply here: the generic base `ParaGroupBase<TypedPara>`, a base in another project, or the bare call kind. - Fix with one rule: bare call → enclosing type → base chain, with the type arguments stripped. - Measure with a corpus bind diff and a hand-checked sample. Precision must stay 7/7, phantom 0. Related: #369, #371.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
h-dv/code-index#370
No description provided.