From: Mattias EngdegÄrd Date: Mon, 17 Jun 2024 11:14:08 +0000 (+0200) Subject: Don't hide `not` and `null` arity errors X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=dc85da22dd11d3bd0c8206ec895759d874ce3f76;p=emacs.git Don't hide `not` and `null` arity errors * lisp/emacs-lisp/byte-opt.el (byte-optimize-not): Don't silently convert incorrect `not` and `null` applications to nil. (cherry picked from commit 923aad81d473fd99adb651302dcccd79c6afbeff) --- diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index c060c8d676b..d8dbfa62bf9 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -1410,13 +1410,14 @@ See Info node `(elisp) Integer Basics'." form))) (defun byte-optimize-not (form) - (and (= (length form) 2) - (let ((arg (nth 1 form))) - (cond ((null arg) t) - ((macroexp-const-p arg) nil) - ((byte-compile-nilconstp arg) `(progn ,arg t)) - ((byte-compile-trueconstp arg) `(progn ,arg nil)) - (t form))))) + (if (= (length form) 2) + (let ((arg (nth 1 form))) + (cond ((null arg) t) + ((macroexp-const-p arg) nil) + ((byte-compile-nilconstp arg) `(progn ,arg t)) + ((byte-compile-trueconstp arg) `(progn ,arg nil)) + (t form))) + form)) (put 'and 'byte-optimizer #'byte-optimize-and) (put 'or 'byte-optimizer #'byte-optimize-or)