dotnet / dotnet/csharpstandard
Generic interface method call variance disambiguation behavior is not specified
- Dominant language
- C#
- Stars
- 815
- Forks
- 99
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 16
Description
This is sort of a cross-cutting issue since the behavior for CLI is specified in ECMA-335 II.12.2, but .NET Core seems to actually work differently than the CLI spec (i.e. see test cases in https://github.com/mono/mono/issues/6312), and the C# standard just doesn't specify it at all.
Basically, if a class implements interfaces `IVar` and `IVar` and both satisfy variance with `IVar`, and a method is invoked using a value of type `IVar`, how does it behave?
12.6.6.1 states that the "function member is determined by applying the interface mapping rules" but the interface mapping rules only specify interface-to-class implementation mapping, they do not specify interface-to-interface mapping behavior when multiple interfaces satisfy variance beyond stating that such conversions are type-safe.
Contributor guide
Assessment
This issue has not been assessed yet.