fix not+and combo (issue #701)

This commit is contained in:
Alex Shinn 2020-09-02 10:01:28 +09:00
parent 24b1e5024c
commit 24d1f6a8a5
2 changed files with 2 additions and 1 deletions

View file

@ -34,6 +34,7 @@
(test "or unbalanced" 1 (match 1 ((or (and 1 x) (and 2 y)) x))) (test "or unbalanced" 1 (match 1 ((or (and 1 x) (and 2 y)) x)))
(test "not" 'ok (match 28 ((not (a . b)) 'ok))) (test "not" 'ok (match 28 ((not (a . b)) 'ok)))
(test "not fail" 'bad (match 28 ((not a) 'ok) (else 'bad))) (test "not fail" 'bad (match 28 ((not a) 'ok) (else 'bad)))
(test "not and" #t (match 1 ((and (not 2)) #t)))
(test "pred" 'ok (match 28 ((? number?) 'ok))) (test "pred" 'ok (match 28 ((? number?) 'ok)))
(test "named pred" 29 (match 28 ((? number? x) (+ x 1)))) (test "named pred" 29 (match 28 ((? number? x) (+ x 1))))

View file

@ -385,7 +385,7 @@
((match-two v (or p ...) g+s sk fk i) ((match-two v (or p ...) g+s sk fk i)
(match-extract-vars (or p ...) (match-gen-or v (p ...) g+s sk fk i) i ())) (match-extract-vars (or p ...) (match-gen-or v (p ...) g+s sk fk i) i ()))
((match-two v (not p) g+s (sk ...) fk i) ((match-two v (not p) g+s (sk ...) fk i)
(let ((fk2 (lambda () (sk ...)))) (let ((fk2 (lambda () (sk ... i))))
(match-one v p g+s (match-drop-ids fk) (fk2) i))) (match-one v p g+s (match-drop-ids fk) (fk2) i)))
((match-two v (get! getter) (g s) (sk ...) fk i) ((match-two v (get! getter) (g s) (sk ...) fk i)
(let ((getter (lambda () g))) (sk ... i))) (let ((getter (lambda () g))) (sk ... i)))