From 5054ac21b6bdb522437d97db2a514a53d8ce7773 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Engdeg=C3=A5rd?= Date: Tue, 12 Mar 2019 13:19:35 +0100 Subject: [PATCH 2/2] Don't match integers with `memq' in `pcase' * lisp/emacs-lisp/pcase.el (pcase--u1): Use portable-fixnum-p instead of integerp as criterion for memq (Bug#34781). * test/lisp/emacs-lisp/pcase-tests.el (pcase-tests-member): Test the above. --- lisp/emacs-lisp/pcase.el | 2 +- test/lisp/emacs-lisp/pcase-tests.el | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el index 9de2401549..a13694ed33 100644 --- a/lisp/emacs-lisp/pcase.el +++ b/lisp/emacs-lisp/pcase.el @@ -792,7 +792,7 @@ pcase--u1 (let ((upat (cddr alt))) (eq (car-safe upat) 'quote))) (let ((val (cadr (cddr alt)))) - (unless (or (integerp val) (symbolp val)) + (unless (or (portable-fixnum-p val) (symbolp val)) (setq memq-ok nil)) (push (cadr (cddr alt)) simples)) (push alt others)))) diff --git a/test/lisp/emacs-lisp/pcase-tests.el b/test/lisp/emacs-lisp/pcase-tests.el index 1e9d37fbfa..29f02cbaa9 100644 --- a/test/lisp/emacs-lisp/pcase-tests.el +++ b/test/lisp/emacs-lisp/pcase-tests.el @@ -56,6 +56,12 @@ pcase-tests-grep 'member (macroexpand-all '(pcase x ((or "a" 2 3) body))))) (should-not (pcase-tests-grep 'memq (macroexpand-all '(pcase x ((or "a" 2 3) body))))) + (should (pcase-tests-grep + 'member (macroexpand-all '(pcase x ((or #x100000000 2 3) + body))))) + (should-not (pcase-tests-grep + 'memq (macroexpand-all '(pcase x ((or #x100000000 2 3) + body))))) (let ((exp (macroexpand-all '(pcase x ("a" body1) -- 2.20.1