GNU bug report logs - #14773
24.2; pcase

Previous Next

Package: emacs;

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

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: John Williams <jrw <at> google.com>
Cc: 14773 <at> debbugs.gnu.org
Subject: bug#14773: 24.2; pcase
Date: Wed, 03 Jul 2013 05:34:59 -0400
> (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.

Note that it output the message "Redundant pcase pattern: (and (let var
right) (guard var))" which explains the behavior.

This said, I can't remember making this optimization so aggressive (it
seems correct here, but it seems difficult to avoid similar incorrect
ones), so I wouldn't be surprised if there are other cases where it gets
it wrong.

Could it be that you had another (real) problem and that the above
example is a (too) simplified test case you extracted from it?


        Stefan




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.