diff options
| author | Mattias EngdegÄrd | 2024-06-17 13:14:08 +0200 |
|---|---|---|
| committer | Mattias EngdegÄrd | 2024-06-17 13:14:08 +0200 |
| commit | 923aad81d473fd99adb651302dcccd79c6afbeff (patch) | |
| tree | cf2d42fd33d198b8c2bba110f605f9ae1f93fe52 | |
| parent | 175a513d19b7dd2aa2af3eb549b4c6b5a099e88d (diff) | |
| download | emacs-923aad81d473fd99adb651302dcccd79c6afbeff.tar.gz emacs-923aad81d473fd99adb651302dcccd79c6afbeff.zip | |
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.
| -rw-r--r-- | lisp/emacs-lisp/byte-opt.el | 15 |
1 files changed, 8 insertions, 7 deletions
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'." | |||
| 1410 | form))) | 1410 | form))) |
| 1411 | 1411 | ||
| 1412 | (defun byte-optimize-not (form) | 1412 | (defun byte-optimize-not (form) |
| 1413 | (and (= (length form) 2) | 1413 | (if (= (length form) 2) |
| 1414 | (let ((arg (nth 1 form))) | 1414 | (let ((arg (nth 1 form))) |
| 1415 | (cond ((null arg) t) | 1415 | (cond ((null arg) t) |
| 1416 | ((macroexp-const-p arg) nil) | 1416 | ((macroexp-const-p arg) nil) |
| 1417 | ((byte-compile-nilconstp arg) `(progn ,arg t)) | 1417 | ((byte-compile-nilconstp arg) `(progn ,arg t)) |
| 1418 | ((byte-compile-trueconstp arg) `(progn ,arg nil)) | 1418 | ((byte-compile-trueconstp arg) `(progn ,arg nil)) |
| 1419 | (t form))))) | 1419 | (t form))) |
| 1420 | form)) | ||
| 1420 | 1421 | ||
| 1421 | (put 'and 'byte-optimizer #'byte-optimize-and) | 1422 | (put 'and 'byte-optimizer #'byte-optimize-and) |
| 1422 | (put 'or 'byte-optimizer #'byte-optimize-or) | 1423 | (put 'or 'byte-optimizer #'byte-optimize-or) |