GNU bug report logs - #46786
28.0.50; pcase-let does not bind variables used inside macro

Previous Next

Package: emacs;

Reported by: Mauricio Collares <mauricio <at> collares.org>

Date: Fri, 26 Feb 2021 00:42:02 UTC

Severity: normal

Found in version 28.0.50

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Mauricio Collares <mauricio <at> collares.org>
Cc: 46786 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi <at> gnus.org>
Subject: bug#46786: 28.0.50; pcase-let does not bind variables used inside macro
Date: Mon, 01 Mar 2021 15:38:43 -0500
>> This testcase is a reduced version of a problem that happens in
>> the "matrix-client.el" package (available on alphapapa's GitHub):
>>
>> (require 'cl-lib)
>> (require 'pcase)
>>
>> (cl-macrolet
>>     ((message-self () `(message self)))
>>   (pcase-let ((`(,self ,self2) '("1" "2")))
>>     (message-self)))
>>
>> Behavior before commit a218c9861573b5ec4979ff2662f5c0343397e3ff
>> ("lisp/emacs-lisp/pcase.el: Don't bind unused vars in branches"):
>> outputs 1 to the minibuffer.
>>
>> Behavior after the commit: Symbol’s value as variable is void: self
>
> I can reproduce the problem on the trunk here, too.  I've added Stefan M
> to the CCs.

Indeed, this is a bug.  I reverted the commit and installed some other
attempt at silencing the corresponding spurious warnings.
Can you confirm that this fixes the problem in your original code
(i.e. matrix-client.el, IIUC)?


        Stefan





This bug report was last modified 4 years and 130 days ago.

Previous Next


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