forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Regression test for GitHub issue dotnet#80350
- Loading branch information
Showing
2 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
src/tests/Loader/classloader/StaticVirtualMethods/RegressionTests/GitHub_80350.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System; | ||
|
||
// This regression test tracks the issue where implementation of a static virtual method | ||
// on a derived type is not found when there is a re-abstraction of the same method | ||
// higher in inheritance hierarchy. | ||
|
||
class Test1 : I2 | ||
{ | ||
|
||
static int Main() | ||
{ | ||
string result = Test<Test1>(); | ||
const string expectedResult = "Test1.M1"; | ||
Console.WriteLine("Expected {0}, found {1}: {2}", expectedResult, result, expectedResult == result ? "match" : "mismatch"); | ||
return result == expectedResult ? 100 : 101; | ||
} | ||
|
||
static string Test<i1>() where i1 : I1 | ||
{ | ||
return i1.M1(); | ||
} | ||
|
||
static string I1.M1() | ||
{ | ||
return "Test1.M1"; | ||
} | ||
} | ||
|
||
public interface I1 | ||
{ | ||
static abstract string M1(); | ||
} | ||
|
||
public interface I2 : I1 | ||
{ | ||
static abstract string I1.M1(); | ||
} |
9 changes: 9 additions & 0 deletions
9
src/tests/Loader/classloader/StaticVirtualMethods/RegressionTests/GitHub_80350.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
<OutputType>Exe</OutputType> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="$(MSBuildProjectName).cs" /> | ||
</ItemGroup> | ||
</Project> |