summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMattias EngdegÄrd <mattiase@acm.org>2019-06-01 17:57:51 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2019-06-01 18:13:00 -0700
commitb5e41e8ba3d90f5d01a41912681c47a3408c679a (patch)
treec6d0c6262a07bd8b94ecead2be12f82f7a070f85
parentaa9d57eed17ee6a8006c9cdd4f8636100482cd71 (diff)
downloademacs-b5e41e8ba3d90f5d01a41912681c47a3408c679a.tar.gz
Fix `cl-member' and `cl-assoc' for bignums
* lisp/emacs-lisp/cl-seq.el (cl-member, cl-assoc): Work with bignums. * test/lisp/emacs-lisp/cl-seq-tests.el (cl-seq-bignum-eql): New.
-rw-r--r--lisp/emacs-lisp/cl-seq.el6
-rw-r--r--test/lisp/emacs-lisp/cl-seq-tests.el8
2 files changed, 10 insertions, 4 deletions
diff --git a/lisp/emacs-lisp/cl-seq.el b/lisp/emacs-lisp/cl-seq.el
index 3eb6ea16daf..86a73e19970 100644
--- a/lisp/emacs-lisp/cl-seq.el
+++ b/lisp/emacs-lisp/cl-seq.el
@@ -703,9 +703,7 @@ Return the sublist of LIST whose car is ITEM.
(while (and cl-list (not (cl--check-test cl-item (car cl-list))))
(setq cl-list (cdr cl-list)))
cl-list)
- (if (and (numberp cl-item) (not (integerp cl-item)))
- (member cl-item cl-list)
- (memq cl-item cl-list))))
+ (memql cl-item cl-list)))
(autoload 'cl--compiler-macro-member "cl-macs")
;;;###autoload
@@ -744,7 +742,7 @@ Return the sublist of LIST whose car matches.
(not (cl--check-test cl-item (car (car cl-alist))))))
(setq cl-alist (cdr cl-alist)))
(and cl-alist (car cl-alist)))
- (if (and (numberp cl-item) (not (integerp cl-item)))
+ (if (numberp cl-item)
(assoc cl-item cl-alist)
(assq cl-item cl-alist))))
(autoload 'cl--compiler-macro-assoc "cl-macs")
diff --git a/test/lisp/emacs-lisp/cl-seq-tests.el b/test/lisp/emacs-lisp/cl-seq-tests.el
index 86288e99ca5..6515eee9f24 100644
--- a/test/lisp/emacs-lisp/cl-seq-tests.el
+++ b/test/lisp/emacs-lisp/cl-seq-tests.el
@@ -302,6 +302,14 @@ Body are forms defining the test."
(should (equal '(2 8) (last (cl-replace list list2) 2)))
(should (equal '(1 1) (last (cl-fill list 1) 2)))))
+(ert-deftest cl-seq-bignum-eql ()
+ (let ((x (+ most-positive-fixnum 1))
+ (y (+ most-positive-fixnum 1)))
+ (let ((l (list y)))
+ (should (eq (cl-member x l) l)))
+ (let ((a (list (cons y 1) (cons 2 y))))
+ (should (eq (cl-assoc x a) (car a)))
+ (should (eq (cl-rassoc x a) (cadr a))))))
(provide 'cl-seq-tests)
;;; cl-seq-tests.el ends here