Fix byte-compiler warning for failed uses of lexical vars
* lisp/emacs-lisp/bytecomp.el (byte-compile-form): Fix byte-compiler warning for failed uses of lexical vars. (Bug#44980) * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp--define-warning-file-test): Don't prefix tests with 'warn'. (bytecomp/error-lexical-var-with-add-hook\.el) (bytecomp/error-lexical-var-with-remove-hook\.el) (bytecomp/error-lexical-var-with-run-hook-with-args-until-failure\.el) (bytecomp/error-lexical-var-with-run-hook-with-args-until-success\.el) (bytecomp/error-lexical-var-with-run-hook-with-args\.el) (bytecomp/error-lexical-var-with-symbol-value\.el): New tests. * test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-symbol-value.el: * test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-run-hook-with-args.el: * test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-run-hook-with-args-until-success.el: * test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-run-hook-with-args-until-failure.el: * test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-remove-hook.el: * test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-add-hook.el: New files.
This commit is contained in:
parent
8a27b0cad7
commit
ace6eba036
8 changed files with 45 additions and 4 deletions
|
@ -3203,7 +3203,7 @@ for symbols generated by the byte compiler itself."
|
|||
run-hook-with-args-until-failure))
|
||||
(pcase (cdr form)
|
||||
(`(',var . ,_)
|
||||
(when (assq var byte-compile-lexical-variables)
|
||||
(when (memq var byte-compile-lexical-variables)
|
||||
(byte-compile-report-error
|
||||
(format-message "%s cannot use lexical var `%s'" fn var))))))
|
||||
;; Warn about using obsolete hooks.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue