bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#51982: Erroneous handling of local variables in byte-compiled nested


From: Michael Heerdegen
Subject: bug#51982: Erroneous handling of local variables in byte-compiled nested lambdas
Date: Sat, 20 Nov 2021 05:44:38 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Hello Paul,

thanks for the report, I can reproduce the issue, there is something
going wrong when compiling.  I guess this is something for Mattias or
Stefan maybe? (CC'd)

#+begin_src emacs-lisp
; -*- lexical-binding: t -*-

(defun wtf (x)
  (let ((it 0))
    #'(lambda ()
        (let ((fn #'(lambda () it)))
          (if x
              (let ((it x))
                it)
            (funcall fn))))))
#+end_src

Byte compile:

>     wtf.el:9:17:Warning: reference to free variable ‘it’

(funcall (wtf 1))

>     Symbol’s value as variable is void: it

while expected result is 1.  Uncompiled code works as expected.

TIA,

Michael.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]