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

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

bug#46912: 28.0.50; Byte compiled defvar with lexical binding throws (vo


From: Joseph Mingrone
Subject: bug#46912: 28.0.50; Byte compiled defvar with lexical binding throws (void-variable foo)
Date: Thu, 04 Mar 2021 14:03:45 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (berkeley-unix)

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





reply via email to

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