dotnet / dotnet/csharpstandard

Generic interface method call variance disambiguation behavior is not specified

Open
#281 1 comment 0 reactions 0 assignees View on GitHub
status: needs triaging
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.