[svn] r5920: nemerle/trunk/ncc: testsuite/positive/match-with.n typing/Typer2.n

malekith svnadmin at nemerle.org
Wed Nov 9 14:09:19 CET 2005


Log:
Walk pattern first, and with-clauses later. Resolves #567.

Author: malekith
Date: Wed Nov  9 14:09:18 2005
New Revision: 5920

Modified:
   nemerle/trunk/ncc/testsuite/positive/match-with.n
   nemerle/trunk/ncc/typing/Typer2.n

Modified: nemerle/trunk/ncc/testsuite/positive/match-with.n
==============================================================================
--- nemerle/trunk/ncc/testsuite/positive/match-with.n	(original)
+++ nemerle/trunk/ncc/testsuite/positive/match-with.n	Wed Nov  9 14:09:18 2005
@@ -80,6 +80,13 @@
 with_matching_1 (Some ([1]));
 with_matching_2 (Some ([2]));
 
+match ([] : list [int]) {
+  | [assign] with assigns = [assign]
+  | assigns =>
+    System.Console.WriteLine (assigns)
+}
+
+
 /*
 BEGIN-OUTPUT
 ok 3 7
@@ -108,5 +115,6 @@
 []
 [1]
 [2]
+[]
 END-OUTPUT
 */

Modified: nemerle/trunk/ncc/typing/Typer2.n
==============================================================================
--- nemerle/trunk/ncc/typing/Typer2.n	(original)
+++ nemerle/trunk/ncc/typing/Typer2.n	Wed Nov  9 14:09:18 2005
@@ -1044,12 +1044,13 @@
           foreach (case in cases) {
             mutable pats = [];
             foreach ((pat, expr, assigns) in case.patterns) {
+              def pat = WalkPattern (pat);
               def assigns = assigns.Map (fun (decl, val) {
                 unless (decl.IsRegistered)
                   decl.Register ();
                 (decl, Walk (val))
               });
-              pats = (WalkPattern (pat), Walk (expr), assigns) :: pats;
+              pats = (pat, Walk (expr), assigns) :: pats;
             }
             case.patterns = List.Rev (pats);
             case.body = 



More information about the svn mailing list