[svn] r7079: nemerle/trunk/ncc: testsuite/negative/yield.n typing/Typer.n

malekith svnadmin at nemerle.org
Mon Dec 11 15:01:12 CET 2006


Log:
Wrap RestartInError mode try-catch in (not along) SwitchToYielding catch. Prevents compiler being killed by STY.

Author: malekith
Date: Mon Dec 11 15:01:11 2006
New Revision: 7079

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

Modified: nemerle/trunk/ncc/testsuite/negative/yield.n
==============================================================================
--- nemerle/trunk/ncc/testsuite/negative/yield.n	(original)
+++ nemerle/trunk/ncc/testsuite/negative/yield.n	Mon Dec 11 15:01:11 2006
@@ -1,5 +1,15 @@
 using System.Collections.Generic;
 
+module M
+{
+  public foo () : System.Collections.Generic.IEnumerable[int]
+  {
+     _ = x ; // E: unbound
+    yield 1;
+    _ = y; // E: unbound
+  }
+}
+
 class D
 {
   public GetEnumerator () : string
@@ -7,3 +17,4 @@
     yield "foo"; // E: yield used in a `GetEnumerator' function, which is returning string
   }
 }
+

Modified: nemerle/trunk/ncc/typing/Typer.n
==============================================================================
--- nemerle/trunk/ncc/typing/Typer.n	(original)
+++ nemerle/trunk/ncc/typing/Typer.n	Mon Dec 11 15:01:11 2006
@@ -153,6 +153,7 @@
           }
 
           try {
+            try {
             messenger.Cleanup ();
             messenger.InErrorMode = false;
             def errcnt = Message.ErrorCount;
@@ -178,13 +179,15 @@
 
               when (errcnt == Message.ErrorCount)
                 Util.ice ($"hidden errors compiling $m");
-                
+            }
+          } catch {
             | _ is SwitchToYielding =>
+              messenger.InErrorMode = false;
+              put_in_error_mode ();
               log (TYPING, "got STY, trying again");
               current_fun.yield_type = GetYieldType ();
               def errcnt = Message.ErrorCount;
               // just in case
-              put_in_error_mode ();
               def newBody = Util.locate(m.Body.Location, WrapYieldingFunction (m.Body));
               m.Body = newBody;
               inside_yielding_function = true;



More information about the svn mailing list