[interp] basic filter clause support
[mono.git] / mono / mini / objects.cs
index 2fe402f907f016291577350c5d7291ed91394daa..21fd43e7d437f0ed5689d9d63c455e19add2be50 100644 (file)
@@ -874,6 +874,49 @@ class Tests {
                return 2;
        }
 
+       class InstanceDelegateTest {
+               public int a;
+
+               public int return_field () {
+                       return a;
+               }
+       }
+
+       public static int test_2_instance_delegate_with_field () {
+               InstanceDelegateTest t = new InstanceDelegateTest () { a = 1337 };
+               GetIntDel del = new GetIntDel (t.return_field);
+               int v = del ();
+               if (v != 1337)
+                       return 0;
+               return 2;
+       }
+
+       interface IFaceVirtualDel {
+               int return_field ();
+       }
+
+       struct VtypeVirtualDelStruct : IFaceVirtualDel {
+               public int f;
+               public int return_field_nonvirt () {
+                       return f;
+               }
+               public int return_field () {
+                       return f;
+               }
+       }
+
+       public static int test_42_vtype_delegate () {
+               var s = new VtypeVirtualDelStruct () { f = 42 };
+               Func<int> f = s.return_field_nonvirt;
+               return f ();
+       }
+
+       public static int test_42_vtype_virtual_delegate () {
+               IFaceVirtualDel s = new VtypeVirtualDelStruct () { f = 42 };
+               Func<int> f = s.return_field;
+               return f ();
+       }
+
        public static int test_1_store_decimal () {
                decimal[,] a = {{1}};
 
@@ -1708,6 +1751,47 @@ ncells ) {
        public static int test_42_pass_16byte_struct_split () {
                return pass_struct16 (null, null, null, null, null, new Struct16 () { a = 42 });
        }
+
+       public interface IComparer2
+       {
+               Type foo<T> ();
+       }
+
+       public class AClass : IComparer2 {
+               public Type foo<T> () {
+                       return typeof(T);
+               }
+       }
+
+       public static int test_0_delegate_to_virtual_generic_on_ifaces () {
+               IComparer2 c = new AClass ();
+
+               Func<Type> f = c.foo<string>;
+               return f () == typeof(string) ? 0 : 1;
+       }
+
+       public enum ByteEnum2 : byte {
+               High = 142
+       }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static int enum_arg_zero_extend (ByteEnum2 b) {
+               return (int)b;
+       }
+
+       public static int test_142_byte_enum_arg_zero_extend () {
+               return enum_arg_zero_extend (ByteEnum2.High);
+       }
+
+       enum Mine { One, Two }
+
+       public static int test_0_enum_gethashcode_opt () {
+               int sum = 0;
+        for (int i = 0; i < 1000000; ++i)
+                       sum += Mine.Two.GetHashCode();
+
+        return 0;
+    }
 }
 
 #if __MOBILE__