-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Regression test for GitHub issue #71319 * Fix runtime assertion failure due to wrong GC mode * Disable the new regression test on Mono with issue #71910
- Loading branch information
Showing
4 changed files
with
49 additions
and
1 deletion.
There are no files selected for viewing
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
34 changes: 34 additions & 0 deletions
34
src/tests/Loader/classloader/StaticVirtualMethods/RegressionTests/GitHub_71319.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,34 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System; | ||
|
||
interface IFoo<in T> | ||
{ | ||
static virtual string DoStatic() => typeof(T).ToString(); | ||
} | ||
|
||
interface IFoo2<in T> | ||
{ | ||
static abstract string DoStatic(); | ||
} | ||
|
||
class Fooer<T> : IFoo2<T> | ||
{ | ||
public static string DoStatic() => typeof(T).ToString(); | ||
} | ||
|
||
class Program : IFoo<object> | ||
{ | ||
static string CallStatic<T, U>() where T : IFoo<U> => T.DoStatic(); | ||
static string CallStatic2<T, U>() where T : IFoo2<U> => T.DoStatic(); | ||
|
||
static int Main() | ||
{ | ||
string staticResult1 = CallStatic<Program, string>(); | ||
Console.WriteLine("SVM call result #1: {0} (System.Object expected - using default interface implementation)", staticResult1); | ||
string staticResult2 = CallStatic2<Fooer<object>, string>(); | ||
Console.WriteLine("SVM call result #2: {0} (System.Object expected - using implementation in a helper class)", staticResult2); | ||
return (staticResult1 == "System.Object" && staticResult2 == "System.Object" ? 100 : 101); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/tests/Loader/classloader/StaticVirtualMethods/RegressionTests/GitHub_71319.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,11 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<DebugType>Full</DebugType> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="$(MSBuildThisFileName).cs" /> | ||
</ItemGroup> | ||
</Project> |
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