Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[tests] Add regression test
  • Loading branch information
BrzVlad committed Dec 13, 2022
commit ce06ae122d1ed1294afb876ca397c9f4387370a7
45 changes: 45 additions & 0 deletions src/tests/JIT/Regression/JitBlue/Runtime_79354/Runtime_79354.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// 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.Reflection;

public interface IGetContents {
(string, int, string) GetContents();
}

public struct MyStruct : IGetContents {
public string s1;
public int a;
public string s2;

public (string, int, string) GetContents()
{
return (s1, a, s2);
}
}

public class Program {

public delegate (string, int, string) MyDelegate(IGetContents arg);

public static int Main(string[] args)
{
MyStruct str = new MyStruct();
str.s1 = "test1";
str.a = 42;
str.s2 = "test2";

MethodInfo mi = typeof(IGetContents).GetMethod("GetContents");
MyDelegate func = (MyDelegate)mi.CreateDelegate(typeof(MyDelegate));

(string c1, int c2, string c3) = func(str);
if (c1 != "test1")
return 1;
if (c2 != 42)
return 2;
if (c3 != "test2")
return 3;
return 100;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<Optimize>True</Optimize>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildProjectName).cs" />
</ItemGroup>
</Project>