Subject: Re: bug#24171: 25.1; Bytecode returns nil instead of expected closure

From: Stefan Monnier <[email-masked]>
Date: Sun, 07 Aug 2016 10:44:31 -0400

> (defun test ()
>   (let ((my-cool-fun 'dummy))
>     (let ((my-cool-fun
>            (let ((calculate (lambda () 1)))
>              (lambda () (setq my-cool-fun calculate))))
>           (return-my-cool-fun (lambda () my-cool-fun)))
>       (funcall my-cool-fun)
>       (funcall return-my-cool-fun))))

Good catch.  It's a bug in cconv.el in the case where it decides to use
lambda-lifting.  It tries to handle such name-capture (search for "(when
(memq var new-extend)" in cconv.el to see where) but doesn't catch the
above case.

Don't have a fix yet.  For the above test case, you can circumvent the
bug by swapping the order of return-my-cool-fun and my-cool-fun in the
let binding.

        Stefan