diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2021-01-21 13:15:05 -0500 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2021-01-21 13:15:05 -0500 |
commit | b41b4add7bc2485fadc6ff3a890efbd1307b2351 (patch) | |
tree | c9a07528185cd511820635a04abbfbd0329218e3 /lisp/emacs-lisp/byte-opt.el | |
parent | 931be5ee7d618904361ab2d434d3901cbd9abc9a (diff) | |
download | emacs-b41b4add7bc2485fadc6ff3a890efbd1307b2351.tar.gz emacs-b41b4add7bc2485fadc6ff3a890efbd1307b2351.tar.bz2 emacs-b41b4add7bc2485fadc6ff3a890efbd1307b2351.zip |
Fix spurious "Lexical argument shadows the dynamic variable" due to inlining
Before this patch doing:
rm lisp/calendar/calendar.elc
make lisp/calendar/cal-hebrew.elc
would spew out lots of spurious such warnings about a `date` argument,
pointing to code which has no `date` argument in sight. This was
because that code had calls to inlinable functions (taking a `date`
argument) defined in `calendar.el`, and while `date` is a normal
lexical var at the site of those functions' definitions, it was
declared as dynbound at the call site.
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand):
Don't impose our local context onto the inlined function.
* test/lisp/emacs-lisp/bytecomp-tests.el: Add matching test.
Diffstat (limited to 'lisp/emacs-lisp/byte-opt.el')
-rw-r--r-- | lisp/emacs-lisp/byte-opt.el | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index cfa407019a7..66a117fccc8 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -284,8 +284,10 @@ ;; If `fn' is from the same file, it has already ;; been preprocessed! `(function ,fn) - (byte-compile-preprocess - (byte-compile--reify-function fn))))) + ;; Try and process it "in its original environment". + (let ((byte-compile-bound-variables nil)) + (byte-compile-preprocess + (byte-compile--reify-function fn)))))) (if (eq (car-safe newfn) 'function) (byte-compile-unfold-lambda `(,(cadr newfn) ,@(cdr form))) ;; This can happen because of macroexp-warn-and-return &co. |