GNU bug report logs - #25558
Spurious warnings with variables mentioned only pcase guard patterns

Previous Next

Package: emacs;

Reported by: Clément Pit--Claudel <clement.pitclaudel <at> live.com>

Date: Sat, 28 Jan 2017 00:16:02 UTC

Severity: minor

Tags: confirmed

Merged with 16771, 27545

Found in versions 24.3.50, 25.1

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

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 25558 in the body.
You can then email your comments to 25558 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#25558; Package emacs. (Sat, 28 Jan 2017 00:16:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Clément Pit--Claudel <clement.pitclaudel <at> live.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 28 Jan 2017 00:16:02 GMT) Full text and rfc822 format available.

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

From: Clément Pit--Claudel <clement.pitclaudel <at> live.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Spurious warnings with variables mentioned only pcase guard patterns
Date: Fri, 27 Jan 2017 19:14:54 -0500
[Message part 1 (text/plain, inline)]
The following causes a warning (unused variable 'b'):

  (pcase '(1 2) ((and `(,a ,b) (guard (equal a b))) a))

This is due to pcase let-binding 'a' twice; once around the guard test ('(equal a b)'), and once around the body ('a').

[signature.asc (application/pgp-signature, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25558; Package emacs. (Sat, 28 Jan 2017 00:24:02 GMT) Full text and rfc822 format available.

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

From: npostavs <at> users.sourceforge.net
To: Clément Pit--Claudel <clement.pitclaudel <at> live.com>
Cc: 25558 <at> debbugs.gnu.org
Subject: Re: bug#25558: Spurious warnings with variables mentioned only pcase
 guard patterns
Date: Fri, 27 Jan 2017 19:24:41 -0500
forcemerge 16771 25558
quit

Clément Pit--Claudel <clement.pitclaudel <at> live.com> writes:

> The following causes a warning (unused variable 'b'):
>
>   (pcase '(1 2) ((and `(,a ,b) (guard (equal a b))) a))
>
> This is due to pcase let-binding 'a' twice; once around the guard test ('(equal a b)'), and once around the body ('a').

This was reported as #16771.  It seems difficult to fix, unfortunately.




Forcibly Merged 16771 25558. Request was from npostavs <at> users.sourceforge.net to control <at> debbugs.gnu.org. (Sat, 28 Jan 2017 00:24:02 GMT) Full text and rfc822 format available.

Forcibly Merged 16771 25558 27545. Request was from npostavs <at> users.sourceforge.net to control <at> debbugs.gnu.org. (Sat, 01 Jul 2017 12:38:02 GMT) Full text and rfc822 format available.

Added tag(s) confirmed. Request was from npostavs <at> users.sourceforge.net to control <at> debbugs.gnu.org. (Sat, 01 Jul 2017 12:45:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25558; Package emacs. (Fri, 03 Sep 2021 08:50:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Yuri Khan <yuri.v.khan <at> gmail.com>
Cc: 27545 <at> debbugs.gnu.org, 25558 <at> debbugs.gnu.org
Subject: Re: bug#25558: Spurious warnings with variables mentioned only
 pcase guard patterns
Date: Fri, 03 Sep 2021 10:49:09 +0200
Yuri Khan <yuri.v.khan <at> gmail.com> writes:

> C-x C-f test.el RET
>
> ;; -*- lexical-binding: t -*-
>
> (defun foo (x)
>   (pcase x
>     ((and `(,bar ,baz)
>           (guard (eq bar 'quux)))
>      baz)))
>
> C-x C-s
> M-x byte-compile RET test.el RET
>
> Observed output:
>
> Compiling file /home/yuri/test.el at Sat Jul  1 16:27:36 2017
> test.el:3:1:Warning: Unused lexical variable ‘bar’

I can reproduce this in Emacs 26.1, but not in Emacs 28, so I'm guessing
that this is fixed, and I'm closing this bug report.  If there's still
problems here, please respond to the debbugs address and we'll reopen.

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




bug marked as fixed in version 28.1, send any further explanations to 25558 <at> debbugs.gnu.org and Clément Pit--Claudel <clement.pitclaudel <at> live.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Fri, 03 Sep 2021 08:50:03 GMT) Full text and rfc822 format available.

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

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

Previous Next


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