unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#46786: 28.0.50; pcase-let does not bind variables used inside macro
@ 2021-02-26  0:40 Mauricio Collares
  2021-02-27  5:08 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 5+ messages in thread
From: Mauricio Collares @ 2021-02-26  0:40 UTC (permalink / raw)
  To: 46786

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





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#46786: 28.0.50; pcase-let does not bind variables used inside macro
  2021-02-26  0:40 bug#46786: 28.0.50; pcase-let does not bind variables used inside macro Mauricio Collares
@ 2021-02-27  5:08 ` Lars Ingebrigtsen
  2021-03-01 20:38   ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Lars Ingebrigtsen @ 2021-02-27  5:08 UTC (permalink / raw)
  To: Mauricio Collares; +Cc: 46786, Stefan Monnier

Mauricio Collares <mauricio@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





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#46786: 28.0.50; pcase-let does not bind variables used inside macro
  2021-02-27  5:08 ` Lars Ingebrigtsen
@ 2021-03-01 20:38   ` Stefan Monnier
  2021-03-09 22:30     ` Mauricio Collares
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2021-03-01 20:38 UTC (permalink / raw)
  To: Mauricio Collares; +Cc: 46786, Lars Ingebrigtsen

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






^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#46786: 28.0.50; pcase-let does not bind variables used inside macro
  2021-03-01 20:38   ` Stefan Monnier
@ 2021-03-09 22:30     ` Mauricio Collares
  2021-03-09 23:57       ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Mauricio Collares @ 2021-03-09 22:30 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 46786, Lars Ingebrigtsen


Stefan Monnier <monnier@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





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#46786: 28.0.50; pcase-let does not bind variables used inside macro
  2021-03-09 22:30     ` Mauricio Collares
@ 2021-03-09 23:57       ` Stefan Monnier
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2021-03-09 23:57 UTC (permalink / raw)
  To: Mauricio Collares; +Cc: 46786-done, Lars Ingebrigtsen

> 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






^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-03-09 23:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-26  0:40 bug#46786: 28.0.50; pcase-let does not bind variables used inside macro Mauricio Collares
2021-02-27  5:08 ` Lars Ingebrigtsen
2021-03-01 20:38   ` Stefan Monnier
2021-03-09 22:30     ` Mauricio Collares
2021-03-09 23:57       ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).