unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Mattias Engdegård" <mattiase@acm.org>
To: 34781@debbugs.gnu.org
Subject: bug#34781: Acknowledgement (27.0.50; integer in pcase sometimes compared by eq)
Date: Tue, 12 Mar 2019 13:24:41 +0100	[thread overview]
Message-ID: <305d88ad0e9aecb3c7c5f09471c46b73f94ec0ed.camel@acm.org> (raw)
In-Reply-To: <handler.34781.B.15519717565134.ack@debbugs.gnu.org>

[-- Attachment #1: Type: text/plain, Size: 49 bytes --]

Tags: patch

Complete patch with test case.


[-- Attachment #2: 0001-Don-t-match-bignums-with-memq-in-pcase.patch --]
[-- Type: text/x-patch, Size: 2008 bytes --]

From b156563ce680f2f63cf57e976f2416d53a94ab4e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mattias=20Engdeg=C3=A5rd?= <mattiase@acm.org>
Date: Tue, 12 Mar 2019 13:19:35 +0100
Subject: [PATCH] Don't match bignums with `memq' in `pcase'

* lisp/emacs-lisp/pcase.el (pcase--u1):
Use fixnump 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..c26a3d7708 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 (fixnump 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..a7c66dbf1e 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 #x10000000000000000 2 3)
+                                               body)))))
+  (should-not (pcase-tests-grep
+               'memq (macroexpand-all '(pcase x ((or #x10000000000000000 2 3)
+                                                 body)))))
   (let ((exp (macroexpand-all
                       '(pcase x
                          ("a" body1)
-- 
2.20.1


  parent reply	other threads:[~2019-03-12 12:24 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-07 15:13 bug#34781: 27.0.50; integer in pcase sometimes compared by eq Mattias Engdegård
     [not found] ` <handler.34781.B.15519717565134.ack@debbugs.gnu.org>
2019-03-12 12:24   ` Mattias Engdegård [this message]
2019-03-16 19:09     ` Mattias Engdegård
2019-03-28 18:25 ` Paul Eggert
2019-03-28 19:47   ` Michael Heerdegen
2019-03-28 20:33     ` Paul Eggert
2019-03-28 21:30       ` Michael Heerdegen
2019-03-28 19:51   ` Mattias Engdegård
2019-03-28 20:30     ` Paul Eggert
2019-03-28 21:51       ` Mattias Engdegård
2019-03-28 22:10         ` Paul Eggert
2019-03-28 22:11         ` Stefan Monnier
2019-03-28 22:20           ` Mattias Engdegård
2019-03-28 22:38             ` Paul Eggert
2019-03-28 23:03               ` Mattias Engdegård
2019-03-29  8:48         ` Eli Zaretskii
2019-03-29  9:52           ` Mattias Engdegård
2019-03-29 12:33             ` Eli Zaretskii
2019-03-28 19:43 ` Michael Heerdegen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=305d88ad0e9aecb3c7c5f09471c46b73f94ec0ed.camel@acm.org \
    --to=mattiase@acm.org \
    --cc=34781@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).