From d4e032e000faf9654c2cf7c21aad760e70c675b0 Mon Sep 17 00:00:00 2001 From: Aleksey Kliger Date: Tue, 23 Aug 2022 15:26:39 -0400 Subject: [PATCH] Add regression test for #70190 --- .../regressions/github61244.cs | 41 ++++++++++++++++++- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/src/tests/Loader/classloader/DefaultInterfaceMethods/regressions/github61244.cs b/src/tests/Loader/classloader/DefaultInterfaceMethods/regressions/github61244.cs index ae08369177388..66783d12a7a16 100644 --- a/src/tests/Loader/classloader/DefaultInterfaceMethods/regressions/github61244.cs +++ b/src/tests/Loader/classloader/DefaultInterfaceMethods/regressions/github61244.cs @@ -14,11 +14,19 @@ // derived interface contexts, but the order is changed (or different.) // When this occurs the generic info is incorrect for the inflated method. +// TestClass2 tests a regression due to the fix for the previous +// regression that caused Mono to incorrectly instantiate generic +// interfaces that appeared in the MethodImpl table + class Program { static int Main(string[] args) { - return new TestClass().DoTest(); + int result = new TestClass().DoTest(); + if (result != 100) + return result; + result = new TestClass2().DoTest(); + return result; } } @@ -78,4 +86,33 @@ public int DoTest () Console.WriteLine("Passed => 100"); return 100; } -} \ No newline at end of file +} + +public interface IA +{ + public int Foo(); +} + +public interface IB : IA +{ + int IA.Foo() { return 104; } +} + +public interface IC : IB

+{ + int IA.Foo() { return 105; } +} + +public class C : IC +{ + int IA.Foo() { return 100; } +} + +public class TestClass2 +{ + public int DoTest() + { + IA c = new C(); + return c.Foo(); + } +}