Subject: Re: bug#14773: 24.2; pcase

From: Michael Heerdegen <[email-masked]>
Date: Wed, 03 Jul 2013 18:53:38 +0200

Stefan Monnier <[email-masked]> 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.