diff --git a/src/tests/JIT/interpreter/Interpreter.cs b/src/tests/JIT/interpreter/Interpreter.cs index 40f2d3b3657b91..b903ef3ba2e4fe 100644 --- a/src/tests/JIT/interpreter/Interpreter.cs +++ b/src/tests/JIT/interpreter/Interpreter.cs @@ -845,10 +845,11 @@ public static void RunInterpreterTests() Console.WriteLine("TestLdtoken"); if (!TestLdtoken()) Environment.FailFast(null); - /* + + Console.WriteLine("TestMdArray"); if (!TestMdArray()) Environment.FailFast(null); - */ + Console.WriteLine("TestExceptionHandling"); TestExceptionHandling(); @@ -2246,13 +2247,28 @@ public static bool TestLdtoken() public static bool TestMdArray() { - // FIXME: This generates roughly: - // newobj int[,].ctor - // ldtoken int[,] - // call System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray - // The newobj currently fails because int[,].ctor isn't a real method, the interp needs to use getCallInfo to determine how to invoke it int[,] a = { { 1, 2 }, { 3, 4 } }; - return a[0, 1] == 2; + if (a[0, 1] != 2) + return false; + + object[,] b = new object[1, 1]; + ref object bElt = ref b[0, 0]; + bElt = null; + + object[,] c = new string[1, 1]; + + try + { + ref object cElt = ref c[0, 0]; + return false; + } + catch (ArrayTypeMismatchException) + { + } + + ref readonly object cElt2 = ref c[0, 0]; + + return true; } private static int _fieldA;