Skip to content

Commit

Permalink
Add regression test for #70190
Browse files Browse the repository at this point in the history
  • Loading branch information
lambdageek authored and github-actions committed Aug 24, 2022
1 parent 980767f commit d4e032e
Showing 1 changed file with 39 additions and 2 deletions.
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();
}
}

0 comments on commit d4e032e

Please sign in to comment.