[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#51982: Erroneous handling of local variables in byte-compiled nested
From: |
Paul Pogonyshev |
Subject: |
bug#51982: Erroneous handling of local variables in byte-compiled nested lambdas |
Date: |
Fri, 19 Nov 2021 21:31:13 +0100 |
Steps to reproduce:
1) save attached file as `wtf.el';
2) execute from command line:
$ emacs --batch --eval "(byte-compile-file \"wtf.el\")"
$ emacs --batch -L . --eval "(require 'wtf)" --eval "(print (funcall (wtf 1)))"
Results, of the first command (byte-compilation):
In wtf:
wtf.el:9:17:Warning: reference to free variable ‘it’
of the second:
Symbol’s value as variable is void: it
Expected results: byte compilation succeeds without warnings, second command prints "1".
Note that if you change line "(let ((fn #'(lambda () it)))" to e.g. "(let ((fn #'(lambda () nil)))", everything works as expected. However, 'fn' _is not even used_ when function `wtf' is called with non-nil argument, which further conforms that the observed behavior is a bug. Another indication: when the function is not byte-compiled (e.g. delete file `wtf.elc' after the first command), it produces expected results.
Function, of course, doesn't make any sense. It is a result of removing contents of real failure until it is as small as possible.
Paul
wtf.el
Description: Text Data
- bug#51982: Erroneous handling of local variables in byte-compiled nested lambdas,
Paul Pogonyshev <=