[svn] r6256: nemerle/trunk/ncc: generation/ILEmitter.n testsuite/positive/array.n

malekith svnadmin at nemerle.org
Fri May 12 11:49:10 CEST 2006


Log:
Use target not source type for array stores. Resolves #670.

Author: malekith
Date: Fri May 12 11:49:09 2006
New Revision: 6256

Modified:
   nemerle/trunk/ncc/generation/ILEmitter.n
   nemerle/trunk/ncc/testsuite/positive/array.n

Modified: nemerle/trunk/ncc/generation/ILEmitter.n
==============================================================================
--- nemerle/trunk/ncc/generation/ILEmitter.n	(original)
+++ nemerle/trunk/ncc/generation/ILEmitter.n	Fri May 12 11:49:09 2006
@@ -916,7 +916,7 @@
 
 
         /* assignment to an array element */
-        | Assign (ArrayIndexer (array_obj, [index]), val) =>
+        | Assign (ArrayIndexer (array_obj, [index]) as target, val) =>
           def type_of_val = val.SystemType;
 
           emit (array_obj);
@@ -926,7 +926,7 @@
             _ilg.Emit (OpCodes.Ldelema, type_of_val);
 
           emit (val);
-          emit_array_store_opcode (type_of_val);
+          emit_array_store_opcode (target.SystemType);
 
         | Assign (ArrayIndexer (array_obj, indexes), val) =>
           emit (array_obj);

Modified: nemerle/trunk/ncc/testsuite/positive/array.n
==============================================================================
--- nemerle/trunk/ncc/testsuite/positive/array.n	(original)
+++ nemerle/trunk/ncc/testsuite/positive/array.n	Fri May 12 11:49:09 2006
@@ -89,6 +89,14 @@
     System.Console.WriteLine (ar.GetType ());
     
     assert (Tricky.makeAnArray().Length == 2);
+
+    // bug #670
+    def data = array(4) : array[byte];
+    foreach( i in [0 .. 3])
+    {
+        data[i] = 42;
+        System.Console.WriteLine("data[{0}] = {1}", i, data[i]);
+    }
   }
 }
 
@@ -107,5 +115,9 @@
 42
 42
 System.IComparable[]
+data[0] = 42
+data[1] = 42
+data[2] = 42
+data[3] = 42
 END-OUTPUT
 */



More information about the svn mailing list