--- Begin Message ---
Subject: |
28.0.50; Byte compiled defvar with lexical binding throws (void-variable foo) |
Date: |
Thu, 4 Mar 2021 01:14:50 +0100 |
Hello,
Compiling the following file:
;;; -*- lexical-binding: t -*-
(let ((foo t))
(defvar tmp-bar (if foo 0 1 -1)))
gives:
tmp.el:4:23: Warning: reference to free variable ‘foo’
When loading the .elc file the error
Debugger entered--Lisp error: (void-variable foo)
byte-code("\301\10\203\11\0\302\202\n\0\303!\207" [foo (lambda
(def-tmp-var) (defvar tmp-bar def-tmp-var)) 0 -1] 2)
load(".../tmp.elc" nil nil t)
No problems with emacs-27 branch.
Vitalie
In GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.22.30, cairo version 1.15.10)
of 2021-03-03 built on NB277
Repository revision: a350ae058caedcb7be7d332564817954e3624e60
Repository branch: HEAD
Windowing system distributor 'The X.Org Foundation', version 11.0.11906000
System Description: Ubuntu 18.04.5 LTS
--- End Message ---
--- Begin Message ---
Subject: |
Re: bug#46912: 28.0.50; Byte compiled defvar with lexical binding throws (void-variable foo) |
Date: |
Fri, 5 Mar 2021 09:56:28 +0000 |
On Fri, Mar 5, 2021 at 9:11 AM Mattias Engdegård <mattiase@acm.org> wrote:
> 4 mars 2021 kl. 22.08 skrev Pip Cet <pipcet@gmail.com>:
>
> > Not a problem at all. In fact, I've taken a look and it seems
> > byte-optimize-form-code-walker simply ignores the value form in a
> > defvar now..
>
> Oh dear, what a silly mistake. Thank you for finding it so quickly, and that
> (last, corrected) patch of yours looks sound -- please push it right away.
Done, and closing. Sorry about the first patch, I must have "tested"
it after setting byte-optimize to nil...
Pip
--- End Message ---