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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 46786 in the body.
You can then email your comments to 46786 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#46786; Package emacs. (Fri, 26 Feb 2021 00:42:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Mauricio Collares <mauricio <at> collares.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 26 Feb 2021 00:42:02 GMT) Full text and rfc822 format available.

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

From: Mauricio Collares <mauricio <at> collares.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 28.0.50; pcase-let does not bind variables used inside macro
Date: Thu, 25 Feb 2021 21:40:54 -0300
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

Best,
Mauricio




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#46786; Package emacs. (Sat, 27 Feb 2021 05:09:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Mauricio Collares <mauricio <at> collares.org>
Cc: 46786 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#46786: 28.0.50; pcase-let does not bind variables used
 inside macro
Date: Sat, 27 Feb 2021 06:08:01 +0100
Mauricio Collares <mauricio <at> collares.org> writes:

> 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.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#46786; Package emacs. (Mon, 01 Mar 2021 20:39:01 GMT) Full text and rfc822 format available.

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

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: Re: 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





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#46786; Package emacs. (Tue, 09 Mar 2021 22:32:01 GMT) Full text and rfc822 format available.

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

From: Mauricio Collares <mauricio <at> collares.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 46786 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi <at> gnus.org>
Subject: Re: bug#46786: 28.0.50; pcase-let does not bind variables used
 inside macro
Date: Tue, 09 Mar 2021 19:30:20 -0300
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
>
> 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)?

I've just received a report from a user that the fix worked great. Thank
you very much!

Best,
Mauricio




Reply sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
You have taken responsibility. (Tue, 09 Mar 2021 23:58:01 GMT) Full text and rfc822 format available.

Notification sent to Mauricio Collares <mauricio <at> collares.org>:
bug acknowledged by developer. (Tue, 09 Mar 2021 23:58:01 GMT) Full text and rfc822 format available.

Message #19 received at 46786-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Mauricio Collares <mauricio <at> collares.org>
Cc: 46786-done <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi <at> gnus.org>
Subject: Re: bug#46786: 28.0.50; pcase-let does not bind variables used
 inside macro
Date: Tue, 09 Mar 2021 18:57:11 -0500
> I've just received a report from a user that the fix worked great. Thank
> you very much!

Thanks for confirming, I'm glad you like it,


        Stefan





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 07 Apr 2021 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 20 days ago.

Previous Next


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