1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-10 16:20:17 -08:00

Fix byte compilation of (eq foo 'default)

Do not use the symbol ‘default’ as a special marker.
Instead, use a value that cannot appear in the program,
improving on a patch proposed by Robert Cochran (Bug#31718#14).
* lisp/emacs-lisp/bytecomp.el (byte-compile--default-val):
New constant.
(byte-compile-cond-jump-table-info)
(byte-compile-cond-jump-table): Use it instead of 'default.
* test/lisp/emacs-lisp/bytecomp-tests.el:
(byte-opt-testsuite-arith-data): Add a test for the bug.
This commit is contained in:
Paul Eggert 2018-06-16 07:44:58 -07:00 committed by Paul Eggert
parent 34e257f83a
commit 9af399fd80
2 changed files with 23 additions and 10 deletions

View file

@ -289,7 +289,14 @@
(t)))
(let ((a))
(cond ((eq a 'foo) 'incorrect)
('correct))))
('correct)))
;; Bug#31734
(let ((variable 0))
(cond
((eq variable 'default)
(message "equal"))
(t
(message "not equal")))))
"List of expression for test.
Each element will be executed by interpreter and with
bytecompiled code, and their results compared.")