-
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.
Fix compareTypesForEquality (#97062)
Fixes #96876
- Loading branch information
Showing
5 changed files
with
145 additions
and
47 deletions.
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
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
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
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,26 @@ | ||
// 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 System.Runtime.CompilerServices; | ||
using Xunit; | ||
|
||
public class Test96876 | ||
{ | ||
[Fact] | ||
public static void TestEntryPoint() | ||
{ | ||
Assert.True(foo<string>(new string[1])); | ||
Assert.False(foo<object>(new string[1])); | ||
|
||
Assert.True(foo2<string>()); | ||
Assert.False(foo2<object>()); | ||
} | ||
|
||
// Validate that the type equality involving shared array types is handled correctly | ||
// in shared generic code. | ||
[MethodImpl(MethodImplOptions.NoInlining)] | ||
static bool foo<T>(string[] list) => typeof(T[]) == list.GetType(); | ||
|
||
[MethodImpl(MethodImplOptions.NoInlining)] | ||
static bool foo2<T>() => typeof(T[]) == typeof(string[]); | ||
} |
11 changes: 11 additions & 0 deletions
11
src/tests/Regressions/coreclr/GitHub_96876/test96876.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> | ||
<CLRTestPriority>1</CLRTestPriority> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="test96876.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="$(TestSourceDir)Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" /> | ||
</ItemGroup> | ||
</Project> |