Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Strehovský <MichalStrehovsky@users.noreply.github.com>2017-04-13 21:48:37 +0300
committerGitHub <noreply@github.com>2017-04-13 21:48:37 +0300
commitbe5de3f0d0cc391d90efc3b02e5b2ddc56e8e85f (patch)
tree90e460675f9ca939b01919235de7a493312c099c /tests/src/Simple/Generics/Generics.cs
parent5c57632e50306b4895ecabec9b54991c3df7b4a8 (diff)
Restore support for delegates to GVMs created from unshared code (#3318)
This used to work but it's now failing in the rolling build. It's easy enough to restore enough of the functionality to get the tests passing again. The rest of the work (creating the delegate from shared code) is tracked in #2796 (uncomment the commented out test line to hit a failure in the JIT).
Diffstat (limited to 'tests/src/Simple/Generics/Generics.cs')
-rw-r--r--tests/src/Simple/Generics/Generics.cs46
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/src/Simple/Generics/Generics.cs b/tests/src/Simple/Generics/Generics.cs
index add45f300..01d44b707 100644
--- a/tests/src/Simple/Generics/Generics.cs
+++ b/tests/src/Simple/Generics/Generics.cs
@@ -27,6 +27,7 @@ class Program
TestMDArrayAddressMethod.Run();
TestNameManglingCollisionRegression.Run();
TestSimpleGVMScenarios.Run();
+ TestGvmDelegates.Run();
TestGvmDependencies.Run();
TestFieldAccess.Run();
@@ -1332,6 +1333,51 @@ class Program
}
}
+ class TestGvmDelegates
+ {
+ class Atom { }
+
+ interface IFoo
+ {
+ string Frob<T>(int arg);
+ }
+
+ class FooUnshared : IFoo
+ {
+ public string Frob<T>(int arg)
+ {
+ return typeof(T[,]).GetElementType().Name + arg.ToString();
+ }
+ }
+
+ class FooShared : IFoo
+ {
+ public string Frob<T>(int arg)
+ {
+ return typeof(T[,,]).GetElementType().Name + arg.ToString();
+ }
+ }
+
+ [MethodImpl(MethodImplOptions.NoInlining)]
+ static void RunShared<T>(IFoo foo)
+ {
+ Func<int, string> a = foo.Frob<T>;
+ if (a(456) != "Atom456")
+ throw new Exception();
+ }
+
+ public static void Run()
+ {
+ IFoo foo = new FooUnshared();
+ Func<int, string> a = foo.Frob<Atom>;
+ if (a(123) != "Atom123")
+ throw new Exception();
+
+ // https://github.com/dotnet/corert/issues/2796
+ // RunShared<Atom>(new FooShared());
+ }
+ }
+
class TestGvmDependencies
{
class Atom { }