[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#14773: 24.2; pcase
From: |
Stefan Monnier |
Subject: |
bug#14773: 24.2; pcase |
Date: |
Wed, 03 Jul 2013 05:34:59 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
> (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