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.
Add runtime test for static gsharedvt methods (dotnet#101489)
- Loading branch information
1 parent
50eb87e
commit 1557838
Showing
2 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
src/tests/JIT/Regression/JitBlue/Runtime_94467/Runtime_94467.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,44 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System; | ||
using Xunit; | ||
|
||
public static class Runtime_94467 | ||
{ | ||
public interface ITypeChecker | ||
{ | ||
static abstract bool Test<T>(T value); | ||
} | ||
|
||
public interface IHandler | ||
{ | ||
bool Test<T>(T value); | ||
} | ||
|
||
public struct TypeChecker : ITypeChecker | ||
{ | ||
public static bool Test<T>(T value) => true; | ||
} | ||
|
||
public class Handler<TChecker> : IHandler where TChecker : ITypeChecker | ||
{ | ||
public bool Test<T>(T value) => TChecker.Test(value); | ||
} | ||
|
||
public static IHandler GetHandler() => new Handler<TypeChecker>(); | ||
|
||
[Fact] | ||
public static int Test() | ||
{ | ||
try { | ||
var handler = GetHandler(); | ||
if (handler.Test<bool>(true) && handler.Test<bool?>(true)) | ||
return 100; | ||
else | ||
return 101; | ||
} catch (Exception) { | ||
return -1; | ||
} | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
src/tests/JIT/Regression/JitBlue/Runtime_94467/Runtime_94467.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,8 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<Optimize>True</Optimize> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="$(MSBuildProjectName).cs" /> | ||
</ItemGroup> | ||
</Project> |