Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mono / mini / objects.cs
index 21fd43e7d437f0ed5689d9d63c455e19add2be50..ef796986cd5419e570167885a1b9220f2b6eace6 100644 (file)
@@ -639,6 +639,7 @@ class Tests {
        public static int test_0_vector_array_cast () {
                Array arr1 = Array.CreateInstance (typeof (int), new int[] {1}, new int[] {0});
                Array arr2 = Array.CreateInstance (typeof (int), new int[] {1}, new int[] {10});
+               Array arr5 = Array.CreateInstance (typeof (string), new int[] {1}, new int[] {10});
 
                if (arr1.GetType () != typeof (int[]))
                        return 1;
@@ -659,6 +660,9 @@ class Tests {
 
                if (arr2 is int[])
                        return 4;
+               var as_object_arr = arr5 as object [];
+               if (as_object_arr != null)
+                       return 5;
 
                int [,] [] arr3 = new int [1, 1] [];
                object o = arr3;
@@ -1031,6 +1035,19 @@ class Tests {
                return 0;
        }
 
+       static Nullable<bool> s_nullb;
+       static AStruct s_struct1;
+
+       /* test if VES uses correct sizes for value type write to static field */
+       public static int test_0_static_nullable_bool () {
+               s_struct1 = new AStruct (0x1337dead);
+               s_nullb = true;
+               /* make sure that the write to s_nullb didn't smash the value after it */
+               if (s_struct1.i != 0x1337dead)
+                       return 2;
+               return 0;
+       }
+
        public static int test_71_long_shift_right () {
                ulong value = 38654838087;
                int x = 0;
@@ -1792,6 +1809,25 @@ ncells ) {
 
         return 0;
     }
+
+       public static int test_0_typedref () {
+               int i = 5;
+               System.TypedReference r = __makeref(i);
+               System.Type t = __reftype(r);
+
+               if (t != typeof (int))
+                       return 1;
+               int j = __refvalue(r, int);
+               if (j != 5)
+                       return 2;
+
+               try {
+                       object o = __refvalue (r, object);
+               } catch (InvalidCastException) {
+               }
+
+               return 0;
+       }
 }
 
 #if __MOBILE__