summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/timer.el
diff options
context:
space:
mode:
authorMattias EngdegÄrd <mattiase@acm.org>2022-12-14 17:48:17 +0100
committerMattias EngdegÄrd <mattiase@acm.org>2022-12-14 19:30:16 +0100
commit537f78b537ddd56198059bc02b5abc6e51c5b523 (patch)
treef67ece8cc5bd33502d53bef2e37a35bfbb3b5b42 /lisp/emacs-lisp/timer.el
parent3b573f7d1f583d3c4169fa7d7dc1f4bcd22197c1 (diff)
downloademacs-537f78b537ddd56198059bc02b5abc6e51c5b523.tar.gz
emacs-537f78b537ddd56198059bc02b5abc6e51c5b523.tar.bz2
emacs-537f78b537ddd56198059bc02b5abc6e51c5b523.zip
Warn about unmatchable constant args to `eq`, `memq` etc
Add a byte-compiler warning about attempts to compare literal values with undefined identity relation to other values. For example: (eq x 2.0) (memq x '("a" (b) [c])) Such incomparable values include all literal conses, strings, vectors, records and (except for eql and memql) floats and bignums. The warning currently applies to eq, eql, memq, memql, assq, rassq, remq and delq. * lisp/emacs-lisp/bytecomp.el (bytecomp--dodgy-eq-arg) (bytecomp--value-type-description, bytecomp--arg-type-description) (bytecomp--warn-dodgy-eq-arg, bytecomp--check-eq-args) (bytecomp--check-memq-args): New. (eq, eql, memq, memql, assq, rassq, remq, delq): Set compiler-macro property. * lisp/emacs-lisp/byte-run.el (with-suppressed-warnings): Amend doc string. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp--with-warning-test): Fix text-quoting-style and expand re-warning so that it doesn't need to be a literal. (bytecomp-warn-dodgy-args-eq, bytecomp-warn-dodgy-args-memq): New tests.
Diffstat (limited to 'lisp/emacs-lisp/timer.el')
0 files changed, 0 insertions, 0 deletions