summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/pcase.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/emacs-lisp/pcase.el')
-rw-r--r--lisp/emacs-lisp/pcase.el18
1 files changed, 10 insertions, 8 deletions
diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el
index d111d9e41f8..63b187be02b 100644
--- a/lisp/emacs-lisp/pcase.el
+++ b/lisp/emacs-lisp/pcase.el
@@ -326,7 +326,8 @@ Evaluation happens sequentially as in `setq' (not in parallel).
An example: (pcase-setq `((,a) [(,b)]) '((1) [(2)]))
-When a PATTERN doesn't match it's VALUE, the pair is silently skipped.
+VAL is presumed to match PAT. Failure to match may signal an error or go
+undetected, binding variables to arbitrary values, such as nil.
\(fn PATTERNS VALUE PATTERN VALUES ...)"
(declare (debug (&rest [pcase-PAT form])))
@@ -348,13 +349,14 @@ When a PATTERN doesn't match it's VALUE, the pair is silently skipped.
(t
(pcase-compile-patterns
val
- (list (cons pat
- (lambda (varvals &rest _)
- `(setq ,@(mapcan (lambda (varval)
- (let ((var (car varval))
- (val (cadr varval)))
- (list var val)))
- varvals)))))))))
+ `((,pat
+ . ,(lambda (varvals &rest _)
+ `(setq ,@(mapcan (lambda (varval)
+ (let ((var (car varval))
+ (val (cadr varval)))
+ (list var val)))
+ varvals))))
+ (pcase--dontcare . ignore))))))
(defun pcase--trivial-upat-p (upat)
(and (symbolp upat) (not (memq upat pcase--dontcare-upats))))