all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#25558: Spurious warnings with variables mentioned only pcase guard patterns
@ 2017-01-28  0:14 Clément Pit--Claudel
  2017-01-28  0:24 ` npostavs
  0 siblings, 1 reply; 3+ messages in thread
From: Clément Pit--Claudel @ 2017-01-28  0:14 UTC (permalink / raw)
  To: 25558


[-- Attachment #1.1: Type: text/plain, Size: 239 bytes --]

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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* bug#25558: Spurious warnings with variables mentioned only pcase guard patterns
  2017-01-28  0:14 bug#25558: Spurious warnings with variables mentioned only pcase guard patterns Clément Pit--Claudel
@ 2017-01-28  0:24 ` npostavs
  0 siblings, 0 replies; 3+ messages in thread
From: npostavs @ 2017-01-28  0:24 UTC (permalink / raw)
  To: Clément Pit--Claudel; +Cc: 25558

forcemerge 16771 25558
quit

Clément Pit--Claudel <clement.pitclaudel@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.





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

* bug#25558: Spurious warnings with variables mentioned only pcase guard patterns
  2017-07-01 10:01 bug#27545: 25.1; Unused lexical variable when byte-compiling pcase with guards Yuri Khan
@ 2021-09-03  8:49 ` Lars Ingebrigtsen
  0 siblings, 0 replies; 3+ messages in thread
From: Lars Ingebrigtsen @ 2021-09-03  8:49 UTC (permalink / raw)
  To: Yuri Khan; +Cc: 27545, 25558

Yuri Khan <yuri.v.khan@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





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

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

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-28  0:14 bug#25558: Spurious warnings with variables mentioned only pcase guard patterns Clément Pit--Claudel
2017-01-28  0:24 ` npostavs
  -- strict thread matches above, loose matches on Subject: below --
2017-07-01 10:01 bug#27545: 25.1; Unused lexical variable when byte-compiling pcase with guards Yuri Khan
2021-09-03  8:49 ` bug#25558: Spurious warnings with variables mentioned only pcase guard patterns Lars Ingebrigtsen

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.