diff options
author | Mattias EngdegÄrd <mattiase@acm.org> | 2019-03-12 13:19:35 +0100 |
---|---|---|
committer | Mattias EngdegÄrd <mattiase@acm.org> | 2019-03-28 23:57:34 +0100 |
commit | eb6bbd9fb175cacdfdc54c1187f5785ed3858f2f (patch) | |
tree | 9d9d04fadb4bef4c9c71cfc63316f39dd767ee84 /lisp/emacs-lisp/pcase.el | |
parent | dd30154e27b1085939abf144daaf257ebda0c3d6 (diff) | |
download | emacs-eb6bbd9fb175cacdfdc54c1187f5785ed3858f2f.tar.gz |
Use memql instead of memq in pcase
* lisp/emacs-lisp/pcase.el (pcase--u1):
Use memql instead of memq to work with bignums (Bug#34781).
* test/lisp/emacs-lisp/pcase-tests.el (pcase-tests-member): Test the above.
Diffstat (limited to 'lisp/emacs-lisp/pcase.el')
-rw-r--r-- | lisp/emacs-lisp/pcase.el | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el index 9de24015494..a644453a948 100644 --- a/lisp/emacs-lisp/pcase.el +++ b/lisp/emacs-lisp/pcase.el @@ -785,7 +785,7 @@ Otherwise, it defers to REST which is a list of branches of the form ((eq 'or (caar matches)) (let* ((alts (cdar matches)) (var (if (eq (caar alts) 'match) (cadr (car alts)))) - (simples '()) (others '()) (memq-ok t)) + (simples '()) (others '()) (memql-ok t)) (when var (dolist (alt alts) (if (and (eq (car alt) 'match) (eq var (cadr alt)) @@ -793,16 +793,16 @@ Otherwise, it defers to REST which is a list of branches of the form (eq (car-safe upat) 'quote))) (let ((val (cadr (cddr alt)))) (unless (or (integerp val) (symbolp val)) - (setq memq-ok nil)) + (setq memql-ok nil)) (push (cadr (cddr alt)) simples)) (push alt others)))) (cond ((null alts) (error "Please avoid it") (pcase--u rest)) - ;; Yes, we can use `memq' (or `member')! + ;; Yes, we can use `memql' (or `member')! ((> (length simples) 1) (pcase--u1 (cons `(match ,var . (pred (pcase--flip - ,(if memq-ok #'memq #'member) + ,(if memql-ok #'memql #'member) ',simples))) (cdr matches)) code vars |