Skip to content
Prev Previous commit
Next Next commit
Add regression test for #70190
  • Loading branch information
lambdageek authored and github-actions committed Aug 24, 2022
commit d4e032e000faf9654c2cf7c21aad760e70c675b0
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down Expand Up @@ -78,4 +86,33 @@ public int DoTest ()
Console.WriteLine("Passed => 100");
return 100;
}
}
}

public interface IA
{
public int Foo();
}

public interface IB<T> : IA
{
int IA.Foo() { return 104; }
}

public interface IC<H1, H2> : IB<H2>
{
int IA.Foo() { return 105; }
}

public class C<U, V, W> : IC<V, W>
{
int IA.Foo() { return 100; }
}

public class TestClass2
{
public int DoTest()
{
IA c = new C<byte, short, int>();
return c.Foo();
}
}