* bug#46912: 28.0.50; Byte compiled defvar with lexical binding throws (void-variable foo)
[not found] <CAAQMm-85X7hMaYoce-Hw84AL957pQPhi1zZMme2xLrE2CEqmag@mail.gmail.com>
@ 2021-03-04 18:03 ` Joseph Mingrone
0 siblings, 0 replies; only message in thread
From: Joseph Mingrone @ 2021-03-04 18:03 UTC (permalink / raw)
To: 46912; +Cc: Vitalie Spinu, emacs-devel
On Thu, 2021-03-04 at 01:14, Vitalie Spinu <spinuvit@gmail.com> wrote:
> 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
Hi,
With
;;; -*- lexical-binding: t -*-
(let ((foo t))
(defvar tmp-bar foo))
the same warning is reported when compiling, but when loading the .elc
file, the debugger isn't started. Just
load: Symbol’s value as variable is void: foo
is reported.
With
;;; -*- lexical-binding: t -*-
(defvar foo
(let ((bar t))
(if bar 1 0)))
The .elc loads without errors.
Joe
^ permalink raw reply [flat|nested] only message in thread