[svn] r7820: nemerle/trunk/ncc: testsuite/negative/array.n typing/Typer.n

divan svnadmin at nemerle.org
Sat Oct 20 21:25:55 CEST 2007


Log:
Add early check for arrays of void (fixes 880).

Author: divan
Date: Sat Oct 20 21:25:53 2007
New Revision: 7820

Modified:
   nemerle/trunk/ncc/testsuite/negative/array.n
   nemerle/trunk/ncc/typing/Typer.n

Modified: nemerle/trunk/ncc/testsuite/negative/array.n
==============================================================================
--- nemerle/trunk/ncc/testsuite/negative/array.n	(original)
+++ nemerle/trunk/ncc/testsuite/negative/array.n	Sat Oct 20 21:25:53 2007
@@ -17,3 +17,10 @@
      _ = array.[33][] // E: array must have at most 32 dimensions
    }
 }
+
+class Bug880 {
+  foo () : void {
+    _ = array[()]; // E: array element type cannot be void
+    _ = array[null : void]; // E: array element type cannot be void
+  }
+}
\ No newline at end of file

Modified: nemerle/trunk/ncc/typing/Typer.n
==============================================================================
--- nemerle/trunk/ncc/typing/Typer.n	(original)
+++ nemerle/trunk/ncc/typing/Typer.n	Sat Oct 20 21:25:53 2007
@@ -2179,7 +2179,11 @@
                     AddCastTo (TypeExpr (expr), element_type, 
                                "array initializer")
                   });
-
+      if (element_type.IsFixed && element_type.FixedValue is MType.Void) {
+        ReportError (messenger, "array element type cannot be void");
+        TExpr.Error ()
+      }
+      else
       TExpr.Array (initializers, dimensions)
     }
 



More information about the svn mailing list