diff options
author | github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | 2022-08-25 21:11:22 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-25 21:11:22 +0300 |
commit | 66173b4b0b092ae878cd0d01ad18625b117920ed (patch) | |
tree | e7e954d1b6229e2e63e50128f9a4222dcd8104cc /src/tests/Loader | |
parent | 1a5c7eef9332e44f13f7a64339823ba8bd819809 (diff) |
[release/7.0] [mono] Assert that we don't need to inflate types when applying DIM overrides (#74519)
* do we need to inflate here? it seems like we always get the right class
* use member access, not type punning
* Add regression test for #70190
* Assert code from #64102 is unreachable
In https://github.com/dotnet/runtime/pull/64102#discussion_r790019545
we concluded that this branch is never taken.
* Assert that overrides are already inflated how we expect
* try to enable some disabled DIM tests
* remove unused var
* Don't assert - code is reachable, there's just nothing to do
* Add link to issue for failing tests
Co-authored-by: Aleksey Kliger <alklig@microsoft.com>
Co-authored-by: Aleksey Kliger <aleksey@lambdageek.org>
Diffstat (limited to 'src/tests/Loader')
-rw-r--r-- | src/tests/Loader/classloader/DefaultInterfaceMethods/regressions/github61244.cs | 41 |
1 files 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 ae083691773..66783d12a7a 100644 --- a/src/tests/Loader/classloader/DefaultInterfaceMethods/regressions/github61244.cs +++ b/src/tests/Loader/classloader/DefaultInterfaceMethods/regressions/github61244.cs @@ -14,11 +14,19 @@ using System; // 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 class TestClass : SecondInterface<int, string> Console.WriteLine("Passed => 100"); return 100; } -}
\ No newline at end of file +} + +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(); + } +} |