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.
(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))
(: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.")