summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMattias EngdegÄrd <mattiase@acm.org>2020-08-19 14:59:29 +0200
committerMattias EngdegÄrd <mattiase@acm.org>2020-08-19 15:26:34 +0200
commit5fcb97dabd3f7b00ebc574d6be4bad16a64482de (patch)
tree0ec796e0803703a9c1750dff6b0c63cabb693351 /test
parent362ca83a3b9d74c51ac325a6490551272aa25f9a (diff)
downloademacs-5fcb97dabd3f7b00ebc574d6be4bad16a64482de.tar.gz
Fix cond jump table compilation (bug#42919)
This bug affected compilation of (cond ((member '(some list) variable) ...) ...) While equal is symmetric, member is not; in the latter case the arguments must be a variable and a constant list, in that order. Reported by Ikumi Keita. * lisp/emacs-lisp/bytecomp.el (byte-compile--cond-switch-prefix): Don't treat equality and member predicates in the same way; only the former are symmetric in their arguments. * test/lisp/emacs-lisp/bytecomp-tests.el (byte-opt-testsuite-arith-data): Add test cases.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/emacs-lisp/bytecomp-tests.el15
1 files changed, 14 insertions, 1 deletions
diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el
index a16adfedfb8..3aba9af3e79 100644
--- a/test/lisp/emacs-lisp/bytecomp-tests.el
+++ b/test/lisp/emacs-lisp/bytecomp-tests.el
@@ -347,7 +347,20 @@
((eq x 't) 99)
(t 999))))
'((a c) (b c) (7 c) (-3 c) (nil nil) (t c) (q c) (r c) (s c)
- (t c) (x "a") (x "c") (x c) (x d) (x e))))
+ (t c) (x "a") (x "c") (x c) (x d) (x e)))
+
+ (mapcar (lambda (x) (cond ((member '(a . b) x) 1)
+ ((equal x '(c)) 2)))
+ '(((a . b)) a b (c) (d)))
+ (mapcar (lambda (x) (cond ((memq '(a . b) x) 1)
+ ((equal x '(c)) 2)))
+ '(((a . b)) a b (c) (d)))
+ (mapcar (lambda (x) (cond ((member '(a b) x) 1)
+ ((equal x '(c)) 2)))
+ '(((a b)) a b (c) (d)))
+ (mapcar (lambda (x) (cond ((memq '(a b) x) 1)
+ ((equal x '(c)) 2)))
+ '(((a b)) a b (c) (d))))
"List of expression for test.
Each element will be executed by interpreter and with
bytecompiled code, and their results compared.")