GNU bug report logs -
#14773
24.2; pcase
Previous Next
Reported by: John Williams <jrw <at> google.com>
Date: Tue, 2 Jul 2013 21:50:01 UTC
Severity: normal
Found in version 24.2
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
Stefan Monnier <monnier <at> IRO.UMontreal.CA> writes:
> > (require 'pcase)
> > (macroexpand
> > '(pcase 1
> > ((and (let var left) (guard var)) 'left)
> > ((and (let var right) (guard var)) 'right)))
>
> > When I run this, the result I get is (let ((x 1)) (if (let* ((var left))
> > var) (let ((var left)) (quote left)) nil)). Note that "right" doesn't
> > appear anywhere in the macro expansion!
>
> Since the second branch of your pcase is unreachable, I think it's OK
> for pcase to eliminate it.
Why is it unreachable?
(defvar left nil)
(defvar right t)
(pcase 1
((and (let var left) (guard var)) 'left)
(_ 'right))
==> 'right
But
(pcase 1
((and (let var left) (guard var)) 'left)
((and (let var right) (guard var)) 'right))
==> nil
It should also return right, no?
Michael.
This bug report was last modified 11 years and 323 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.