forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Import isinst/castclass Nullable as underlying type (dotnet#87241)
* Import isinst Nullable as underlying type * IL test coverage for castclass
- Loading branch information
1 parent
11dcb89
commit 74196a0
Showing
3 changed files
with
88 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
|
||
.assembly extern mscorlib { auto } | ||
.assembly extern xunit.core {} | ||
.assembly extern System.Console { auto } | ||
.assembly extern System.Runtime { .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) } | ||
|
||
.assembly 'castclass_valuetype' { } | ||
|
||
.class public auto Program extends [System.Runtime]System.Object | ||
{ | ||
.method public hidebysig static int32 Main() cil managed | ||
{ | ||
.custom instance void [xunit.core]Xunit.FactAttribute::.ctor() = ( | ||
01 00 00 00 | ||
) | ||
.entrypoint | ||
.maxstack 8 | ||
|
||
.try | ||
{ | ||
// castclass valuetype | ||
ldc.i4 1234 | ||
box int32 | ||
castclass int32 | ||
unbox int32 | ||
call instance string [System.Runtime]System.Int32::ToString() | ||
call void [System.Console]System.Console::WriteLine(class [System.Runtime]System.String) | ||
|
||
// castclass nullable | ||
ldc.i4 1234 | ||
box int32 | ||
castclass valuetype [System.Runtime]System.Nullable`1<int32> | ||
unbox int32 | ||
call instance string [System.Runtime]System.Int32::ToString() | ||
call void [System.Console]System.Console::WriteLine(class [System.Runtime]System.String) | ||
|
||
leave.s SUCCESS | ||
} | ||
catch [System.Runtime]System.Object | ||
{ | ||
pop | ||
leave.s FAIL | ||
} | ||
|
||
SUCCESS: | ||
ldstr "SUCCESS" | ||
call void [System.Console]System.Console::WriteLine(class [System.Runtime]System.String) | ||
ldc.i4 100 | ||
ret | ||
|
||
FAIL: | ||
ldstr "FAILED" | ||
call void [System.Console]System.Console::WriteLine(class [System.Runtime]System.String) | ||
ldc.i4 0 | ||
ret | ||
} | ||
} |
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.IL"> | ||
<PropertyGroup> | ||
<CLRTestPriority>1</CLRTestPriority> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<DebugType>PdbOnly</DebugType> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="castclass_valuetype.il" /> | ||
</ItemGroup> | ||
</Project> |