[jit] Add support for constrained calls with vtype return types in gsharedvt code...
[mono.git] / mono / mini / gshared.cs
index 342dec7060a2f2f36a7c38929570398ac1f21b6e..27149e9085d7a5ee63311e6cac1789caaba04991 100644 (file)
@@ -1018,7 +1018,36 @@ public class Tests
                return 0;
        }
 
-       struct Pair<T1, T2> {
+       interface IConstrainedCalls {
+               Pair<int, int> vtype_ret<T, T2>(T t, T2 t2) where T: IReturnVType;
+       }
+
+       public interface IReturnVType {
+               Pair<int, int> return_vtype ();
+       }
+
+       public class CConstrainedCalls : IConstrainedCalls {
+               [MethodImplAttribute (MethodImplOptions.NoInlining)]
+               public Pair<int, int> vtype_ret<T, T2>(T t, T2 t2) where T : IReturnVType {
+                       return t.return_vtype ();
+               }
+       }
+
+       class ReturnVType : IReturnVType {
+               public Pair<int, int> return_vtype () {
+                       return new Pair<int, int> () { First = 1, Second = 2 };
+               }
+       }
+
+       public static int test_0_constrained_vtype_ret () {
+               IConstrainedCalls c = new CConstrainedCalls ();
+               var r = c.vtype_ret<ReturnVType, int> (new ReturnVType (), 1);
+               if (r.First != 1 || r.Second != 2)
+                       return 1;
+               return 0;
+       }
+
+       public struct Pair<T1, T2> {
                public T1 First;
                public T2 Second;
        }