diff --git a/lib/chibi/match-test.sld b/lib/chibi/match-test.sld index b40acd49..9e0074f3 100644 --- a/lib/chibi/match-test.sld +++ b/lib/chibi/match-test.sld @@ -31,6 +31,7 @@ (test "or empty" 'ok (match '(o k) ((or) 'fail) (else 'ok))) (test "or single" 'ok (match 'ok ((or x) 'ok))) (test "or double" 'ok (match 'ok ((or (? symbol? y) y) y))) + (test "or unbalanced" 1 (match 1 ((or (and 1 x) (and 2 y)) x))) (test "not" 'ok (match 28 ((not (a . b)) 'ok))) (test "pred" 'ok (match 28 ((? number?) 'ok))) (test "named pred" 29 (match 28 ((? number? x) (+ x 1)))) diff --git a/lib/chibi/match/match.scm b/lib/chibi/match/match.scm index a043a40a..82527ea8 100644 --- a/lib/chibi/match/match.scm +++ b/lib/chibi/match/match.scm @@ -531,7 +531,8 @@ (define-syntax match-gen-or (syntax-rules () ((_ v p g+s (sk ...) fk (i ...) ((id id-ls) ...)) - (let ((sk2 (lambda (id ...) (sk ... (i ... id ...))))) + (let ((sk2 (lambda (id ...) (sk ... (i ... id ...)))) + (id (if #f #f)) ...) (match-gen-or-step v p g+s (match-drop-ids (sk2 id ...)) fk (i ...)))))) (define-syntax match-gen-or-step