X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fmini%2Fobjects.cs;h=21fd43e7d437f0ed5689d9d63c455e19add2be50;hb=222df67b5f5a9bd5e2c8da9e454b0f2883e1fe41;hp=2fe402f907f016291577350c5d7291ed91394daa;hpb=a7500b8f2dd177a47c3b15c51dbf26a8ca9deacc;p=mono.git diff --git a/mono/mini/objects.cs b/mono/mini/objects.cs index 2fe402f907f..21fd43e7d43 100644 --- a/mono/mini/objects.cs +++ b/mono/mini/objects.cs @@ -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 f = s.return_field_nonvirt; + return f (); + } + + public static int test_42_vtype_virtual_delegate () { + IFaceVirtualDel s = new VtypeVirtualDelStruct () { f = 42 }; + Func 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 (); + } + + public class AClass : IComparer2 { + public Type foo () { + return typeof(T); + } + } + + public static int test_0_delegate_to_virtual_generic_on_ifaces () { + IComparer2 c = new AClass (); + + Func f = c.foo; + 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__