1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-21 18:23:59 +00:00

* lisp/emacs-lisp/pcase.el (pcase--split-pred): Re-fix bug#14773

Adjust to calling convention of `macroexp--fgrep`.
This commit is contained in:
Stefan Monnier 2021-03-01 14:07:05 -05:00
parent a0f60293d9
commit d56b1f9e7c
2 changed files with 9 additions and 1 deletions

View File

@ -661,7 +661,7 @@ A and B can be one of:
;; run, but we don't have the environment in which `pat' will
;; run, so we can't do a reliable verification. But let's try
;; and catch at least the easy cases such as (bug#14773).
(not (macroexp--fgrep (mapcar #'car vars) (cadr upat)))))
(not (macroexp--fgrep vars (cadr upat)))))
'(:pcase--succeed . :pcase--fail))
;; In case PAT is of the form (pred (not PRED))
((and (eq 'pred (car-safe pat)) (eq 'not (car-safe (cadr pat))))

View File

@ -75,6 +75,14 @@
(ert-deftest pcase-tests-vectors ()
(should (equal (pcase [1 2] (`[,x] 1) (`[,x ,y] (+ x y))) 3)))
(ert-deftest pcase-tests-bug14773 ()
(let ((f (lambda (x)
(pcase 'dummy
((and (let var x) (guard var)) 'left)
((and (let var (not x)) (guard var)) 'right)))))
(should (equal (funcall f t) 'left))
(should (equal (funcall f nil) 'right))))
;; Local Variables:
;; no-byte-compile: t
;; End: