Fix mistake in switch-case generation of null (bug#49746)

Reported by Gregor Zattler.

* lisp/emacs-lisp/bytecomp.el (byte-compile--cond-switch-prefix):
Be more careful in the selection of equality.
* test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--test-cases):
Add test case.
This commit is contained in:
Mattias Engdegård 2021-07-27 17:26:26 +02:00
parent 989937e1bc
commit 949dd41c31
2 changed files with 8 additions and 1 deletions

View file

@ -503,6 +503,12 @@
(:success 'good))
(1+ x))))
(funcall f 3))
;; Check `not' in cond switch (bug#49746).
(mapcar (lambda (x) (cond ((equal x "a") 1)
((member x '("b" "c")) 2)
((not x) 3)))
'("a" "b" "c" "d" nil))
)
"List of expressions for cross-testing interpreted and compiled code.")