Skip to content

Commit 57aebed

Browse files
authored
Fix function pointer expected output on coreclr (#68212)
1 parent ecc3301 commit 57aebed

File tree

2 files changed

+24
-13
lines changed

2 files changed

+24
-13
lines changed

src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenFunctionPointersTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2467,7 +2467,7 @@ .locals init (delegate*<string, string> V_0, //ptr
24672467
}
24682468

24692469
[WorkItem("https://github.com/dotnet/roslyn/issues/68208")]
2470-
[ConditionalFact(typeof(WindowsDesktopOnly))]
2470+
[Fact]
24712471
public void Typeof()
24722472
{
24732473
var verifier = CompileAndVerifyFunctionPointers(@"
@@ -2480,7 +2480,7 @@ static void Main()
24802480
Console.WriteLine(t.ToString());
24812481
}
24822482
}
2483-
", expectedOutput: "System.IntPtr");
2483+
", expectedOutput: ExecutionConditionUtil.IsCoreClr ? "System.Void()" : "System.IntPtr");
24842484

24852485
verifier.VerifyIL("C.Main()", expectedIL: @"
24862486
{

src/Compilers/CSharp/Test/Semantic/Semantics/DelegateTypeTests.cs

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9083,7 +9083,7 @@ static void Main()
90839083
}
90849084

90859085
[WorkItem("https://github.com/dotnet/roslyn/issues/68208")]
9086-
[ConditionalFact(typeof(WindowsDesktopOnly))]
9086+
[Fact]
90879087
public void SynthesizedDelegateTypes_16()
90889088
{
90899089
var source =
@@ -9111,16 +9111,27 @@ static void Main()
91119111
var comp = CreateCompilation(source, options: TestOptions.UnsafeReleaseExe);
91129112
comp.VerifyDiagnostics();
91139113

9114-
CompileAndVerify(comp, expectedOutput:
9115-
@"System.Func`1[(fnptr)[]]
9116-
System.Action`1[(fnptr)[]]
9117-
<>F{00000001}`2[System.Int32,(fnptr)[]]
9118-
<>A{00000001}`1[(fnptr)[]]
9119-
System.Func`1[(fnptr)[]]
9120-
System.Action`1[(fnptr)[]]
9121-
<>F{00000001}`2[System.Int32,(fnptr)[]]
9122-
<>A{00000001}`1[(fnptr)[]]
9123-
");
9114+
CompileAndVerify(comp, expectedOutput: ExecutionConditionUtil.IsCoreClr
9115+
? """
9116+
System.Func`1[System.Int32&(System.Int32)[]]
9117+
System.Action`1[System.Void(System.Int32, System.Int32&)[]]
9118+
<>F{00000001}`2[System.Int32,System.Int32&(System.Int32)[]]
9119+
<>A{00000001}`1[System.Void(System.Int32, System.Int32&)[]]
9120+
System.Func`1[System.Int32&()[]]
9121+
System.Action`1[System.Void(System.Int32&)[]]
9122+
<>F{00000001}`2[System.Int32,System.Int32&()[]]
9123+
<>A{00000001}`1[System.Void(System.Int32&)[]]
9124+
"""
9125+
: """
9126+
System.Func`1[(fnptr)[]]
9127+
System.Action`1[(fnptr)[]]
9128+
<>F{00000001}`2[System.Int32,(fnptr)[]]
9129+
<>A{00000001}`1[(fnptr)[]]
9130+
System.Func`1[(fnptr)[]]
9131+
System.Action`1[(fnptr)[]]
9132+
<>F{00000001}`2[System.Int32,(fnptr)[]]
9133+
<>A{00000001}`1[(fnptr)[]]
9134+
""");
91249135
}
91259136

91269137
[Fact]

0 commit comments

Comments
 (0)