[svn] r6131: nemerle/trunk/ncc: generation/Typer4.n testsuite/negative/cg-post.n

nazgul svnadmin at nemerle.org
Sun Feb 19 12:49:21 CET 2006


Log:
Do not allow throw in first param, just try is allowed here

Author: nazgul
Date: Sun Feb 19 12:49:00 2006
New Revision: 6131

Modified:
   nemerle/trunk/ncc/generation/Typer4.n
   nemerle/trunk/ncc/testsuite/negative/cg-post.n

Modified: nemerle/trunk/ncc/generation/Typer4.n
==============================================================================
--- nemerle/trunk/ncc/generation/Typer4.n	(original)
+++ nemerle/trunk/ncc/generation/Typer4.n	Sun Feb 19 12:49:00 2006
@@ -347,17 +347,16 @@
             
           | Call (func, parms, _) =>
             NoThrowPlease (func);
-            def parm_throws =
               match (parms) {
                 | p :: ps =>
                   def fst = Throws (p.expr, allow_try);
+                if (fst) 
+                  Message.Error (p.expr.loc, "`throw' is not allowed here");
+                else 
                   foreach (parm in ps) NoThrowPlease (parm.expr);
-                  fst
                   
-                | [] => false
+              | [] => ()
               }
-            if (parm_throws) true
-            else
               if (is_top && Options.GeneralTailCallOpt) {
                 expr.GenerateTail = true;
                 foreach (p in parms)

Modified: nemerle/trunk/ncc/testsuite/negative/cg-post.n
==============================================================================
--- nemerle/trunk/ncc/testsuite/negative/cg-post.n	(original)
+++ nemerle/trunk/ncc/testsuite/negative/cg-post.n	Sun Feb 19 12:49:00 2006
@@ -2,9 +2,15 @@
   public mutable x : int;
 }
 
+module Bug621 {
+    public F(_:object):void {}
 
-class M {
+    Run () : void { 
+      Bug621.F(throw System.Exception()) // E: `throw' is not allowed here
+   }
+}
 
+class M {
   bar () : void
   {
     match (3) {



More information about the svn mailing list