GNU bug report logs - #24641
let-alist redundantly binds variables already bound by nested let-alist calls

Previous Next

Package: emacs;

Reported by: Philipp <p.stephani2 <at> gmail.com>

Date: Sat, 8 Oct 2016 12:48:01 UTC

Severity: minor

Tags: confirmed, fixed

Found in version 26.0.50

Fixed in version 26

Done: npostavs <at> users.sourceforge.net

Bug is archived. No further changes may be made.

Full log


Message #10 received at control <at> debbugs.gnu.org (full text, mbox):

From: npostavs <at> users.sourceforge.net
To: Philipp <p.stephani2 <at> gmail.com>
Cc: 24641 <at> debbugs.gnu.org
Subject: Re: bug#24641: 26.0.50;
 let-alist: Incorrect byte-compile warning about unused lexical
 variable
Date: Sat, 08 Oct 2016 09:09:52 -0400
retitle 24641 let-alist redundantly binds variables already bound by nested let-alist calls
severity 24641 minor
tags 24641 confirmed
quit

Philipp <p.stephani2 <at> gmail.com> writes:

> $ cat /tmp/letalist.el 
> ;; -*- lexical-binding: t; -*-
> (print
>  (let-alist '((outer . ((inner . value))))
>    (let-alist .outer .inner)))
>    
> $ emacs -Q -batch -f batch-byte-compile /tmp/letalist.el 
>
> In toplevel form:
> /tmp/letalist.el:2:1:Warning: Unused lexical variable ‘\.inner’
>
> This warning is incorrect because '.inner' is used in the inner
> let-alist form.

The byte compiler warning correct, the problem is in let-alist: both the
outer and inner let-alist calls let-bind '.inner'.  Here is the
macroexpansion:

(let
    ((#1=#:alist
      '((outer
         (inner . value)))))
  (let
      ((\.outer
        (cdr
         (assq 'outer #1#)))
       (\.inner ; <------------ this one is unused
        (cdr
         (assq 'inner #1#))))
    (let
        ((#2=#:alist \.outer))
      (let
          ((\.inner
            (cdr
             (assq 'inner #2#))))
        \.inner))))




This bug report was last modified 8 years and 170 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.