dotnet / dotnet/runtime

Constrained variant interface dispatch dispatches to wrong method

Open
#122,863 0 comments 0 reactions 0 assignees View on GitHub
area-VM-meta-mono
Dominant language
C#
Stars
18.3k
Forks
5.6k
PR merge metrics
PR metrics pending

Description

See the test added in #121167. I'm going to ActiveIssue the test on this issue.

```csharp
using Xunit;

namespace SimpleStaticVirtual
{
public class Tests
{
[Fact]
public static void TestEntryPoint()
{
Assert.Equal(nameof(IGetter), Get());
Assert.Equal("Object", GetVariant, string>());
}

static string Get() where T : IGetter => T.Get();
static string GetVariant() where T : IGetter => T.Get();
}

interface IGetter
{
static virtual string Get() => nameof(IGetter);
}

interface IGetter
{
static virtual string Get() => typeof(T).Name;
}
}
```

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.