[svn] r6005: nemerle/trunk: macros/assertions.n ncc/testsuite/positive/assert.n

nazgul svnadmin at nemerle.org
Wed Dec 7 20:21:34 CET 2005


Log:
Rethrow exceptions in invariant expose macro

Author: nazgul
Date: Wed Dec  7 20:21:26 2005
New Revision: 6005

Modified:
   nemerle/trunk/macros/assertions.n
   nemerle/trunk/ncc/testsuite/positive/assert.n

Modified: nemerle/trunk/macros/assertions.n
==============================================================================
--- nemerle/trunk/macros/assertions.n	(original)
+++ nemerle/trunk/macros/assertions.n	Wed Dec  7 20:21:26 2005
@@ -245,12 +245,12 @@
         need_to_check = true;
         result
       }
+      /* FIXME: we would need support for checked exceptions (at method's signature level)
       catch {
-       /* FIXME: we would need to sign checked exception in BCL
-        | e : IChecked => need_to_check = true; rethrow
-       */ 
-        | _e => result
+        | e is IChecked => need_to_check = true; throw;
+        | _ => throw;
       }
+      */
       finally {
         lock (e) {
           e._N_invariant_lock = false;

Modified: nemerle/trunk/ncc/testsuite/positive/assert.n
==============================================================================
--- nemerle/trunk/ncc/testsuite/positive/assert.n	(original)
+++ nemerle/trunk/ncc/testsuite/positive/assert.n	Wed Dec  7 20:21:26 2005
@@ -153,9 +153,39 @@
         printf ("got argument out of range exception\n");
     };
     try {  abort ()    } catch { _ => () }
+    
+    ExposePropagateException.Run ();
   }
 }
 
+class ExposePropagateException
+invariant x > 10 
+{
+  class MyExposeException : System.Exception { }
+
+  mutable x : int = 20;
+  
+  private NoAutoExpose () : void {
+    try {
+      expose (this) {
+        x = 15;
+        when (x == 15) throw MyExposeException ();
+      }
+      printf ("should not happen\n");
+    }
+    catch {
+      | _ is MyExposeException => 
+        printf ("should happen\n");
+    }  
+  }
+  
+  public static Run () : void {
+    ExposePropagateException ().NoAutoExpose ();
+  }
+}
+
+
+
 /*
 BEGIN-OUTPUT
 3
@@ -177,6 +207,7 @@
 Assertion number 3 failed
 Got System.Exception (ok!)
 got argument out of range exception
+should happen
 END-OUTPUT
 */
 



More information about the svn mailing list