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

@ -4362,7 +4362,8 @@ Return (TAIL VAR TEST CASES), where:
(and (or (eq var switch-var) (not switch-var))
(progn
(setq switch-var var)
(setq switch-test 'eq)
(setq switch-test
(byte-compile--common-test switch-test 'eq))
(unless (memq nil keys)
(push nil keys)
(push (cons (list nil) (or body '(t))) cases))