From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#14773: 24.2; pcase Date: Wed, 03 Jul 2013 05:34:59 -0400 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1372844173 16264 80.91.229.3 (3 Jul 2013 09:36:13 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 3 Jul 2013 09:36:13 +0000 (UTC) Cc: 14773@debbugs.gnu.org To: John Williams Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jul 03 11:36:13 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UuJTw-0002Ni-U0 for geb-bug-gnu-emacs@m.gmane.org; Wed, 03 Jul 2013 11:36:13 +0200 Original-Received: from localhost ([::1]:55407 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UuJTw-0004TS-HL for geb-bug-gnu-emacs@m.gmane.org; Wed, 03 Jul 2013 05:36:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47581) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UuJTr-0004Q5-I7 for bug-gnu-emacs@gnu.org; Wed, 03 Jul 2013 05:36:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UuJTn-0002qv-2R for bug-gnu-emacs@gnu.org; Wed, 03 Jul 2013 05:36:07 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:59436) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UuJTm-0002qL-U2 for bug-gnu-emacs@gnu.org; Wed, 03 Jul 2013 05:36:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1UuJTm-0000tV-Di for bug-gnu-emacs@gnu.org; Wed, 03 Jul 2013 05:36:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 03 Jul 2013 09:36:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14773 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 14773-submit@debbugs.gnu.org id=B14773.13728441053367 (code B ref 14773); Wed, 03 Jul 2013 09:36:02 +0000 Original-Received: (at 14773) by debbugs.gnu.org; 3 Jul 2013 09:35:05 +0000 Original-Received: from localhost ([127.0.0.1]:53751 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UuJSq-0000sE-DW for submit@debbugs.gnu.org; Wed, 03 Jul 2013 05:35:04 -0400 Original-Received: from chene.dit.umontreal.ca ([132.204.246.20]:55869) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UuJSp-0000rv-1u for 14773@debbugs.gnu.org; Wed, 03 Jul 2013 05:35:03 -0400 Original-Received: from fmsmemgm.homelinux.net (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id r639YxWg011086; Wed, 3 Jul 2013 05:35:00 -0400 Original-Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id 8B783AE15B; Wed, 3 Jul 2013 05:34:59 -0400 (EDT) In-Reply-To: (John Williams's message of "Tue, 02 Jul 2013 14:19:02 -0700") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV4627=0 X-NAI-Spam-Version: 2.3.0.9362 : core <4627> : streams <993296> : uri <1465589> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:75842 Archived-At: > (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