From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Gemini Lasswell Newsgroups: gmane.emacs.bugs Subject: bug#29236: 26.0.90; [PATCH] Incorrect Edebug specs for and-let* and if-let* Date: Thu, 09 Nov 2017 14:11:11 -0800 Message-ID: <87375nhzls.fsf@runbox.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1510265537 27752 195.159.176.226 (9 Nov 2017 22:12:17 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 9 Nov 2017 22:12:17 +0000 (UTC) To: 29236@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Nov 09 23:12:13 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eCv3R-0006ui-33 for geb-bug-gnu-emacs@m.gmane.org; Thu, 09 Nov 2017 23:12:09 +0100 Original-Received: from localhost ([::1]:38973 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eCv3Y-0003w3-Ea for geb-bug-gnu-emacs@m.gmane.org; Thu, 09 Nov 2017 17:12:16 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37213) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eCv3N-0003tM-JI for bug-gnu-emacs@gnu.org; Thu, 09 Nov 2017 17:12:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eCv3K-0004IC-Dw for bug-gnu-emacs@gnu.org; Thu, 09 Nov 2017 17:12:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:52295) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eCv3K-0004Hy-8v for bug-gnu-emacs@gnu.org; Thu, 09 Nov 2017 17:12:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eCv3K-0005uE-4e for bug-gnu-emacs@gnu.org; Thu, 09 Nov 2017 17:12:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Gemini Lasswell Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 09 Nov 2017 22:12:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 29236 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.151026550622649 (code B ref -1); Thu, 09 Nov 2017 22:12:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 9 Nov 2017 22:11:46 +0000 Original-Received: from localhost ([127.0.0.1]:60970 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eCv33-0005tF-PV for submit@debbugs.gnu.org; Thu, 09 Nov 2017 17:11:46 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:46139) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eCv32-0005t1-90 for submit@debbugs.gnu.org; Thu, 09 Nov 2017 17:11:44 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eCv2v-00043D-Tl for submit@debbugs.gnu.org; Thu, 09 Nov 2017 17:11:39 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:42461) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eCv2v-000439-Pv for submit@debbugs.gnu.org; Thu, 09 Nov 2017 17:11:37 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37104) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eCv2u-0003kx-J9 for bug-gnu-emacs@gnu.org; Thu, 09 Nov 2017 17:11:37 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eCv2r-000412-E4 for bug-gnu-emacs@gnu.org; Thu, 09 Nov 2017 17:11:36 -0500 Original-Received: from aibo.runbox.com ([91.220.196.211]:36322) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eCv2r-0003yR-2S for bug-gnu-emacs@gnu.org; Thu, 09 Nov 2017 17:11:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=runbox.com; s=rbselector1; h=Content-Type:MIME-Version:Message-ID:Date:Subject:To:From; bh=JjFrjbRnQSV/ml8oTUG/sD7zdq+XoAF0Db7RkMF2l3w=; b=lyiO/oQRAKgyAacUPB7vk+gi6 +4SrIx4fGlQHXe02opPkVVcTenz1djgUuGVY0srJC/elzywpeQdB4hcSiqbpjWpVw6vjVM3Fds451 DL2kr7ADWAboYbuDTwPq113AoRsYqVXuqiDdjTXQirecXYpG7wb5Rb7BnLg1rjtj6nDiUaan6ma+m rf7Xixxl2b+MhhA9Uj2MC3mcKrUkSJKGd+Jq8vP4iYDwJ266hcZMyW4j0QtO3uHIuL48PxegbjxG5 6N48/xPVkygA8PiHThopYCFumQzZrvWhkXyQTmO/G2rUiFoGLiJao7nOhFZZddYXHD5molZHFs3Ab Jr6hzqgYg==; Original-Received: from [10.9.9.211] (helo=mailfront11.runbox.com) by mailtransmit03.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1eCv2n-0000jo-1S for bug-gnu-emacs@gnu.org; Thu, 09 Nov 2017 23:11:29 +0100 Original-Received: from c-24-22-244-161.hsd1.wa.comcast.net ([24.22.244.161] helo=chinook) by mailfront11.runbox.com with esmtpsa (uid:179284 ) (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) id 1eCv2X-0008Fq-EH for bug-gnu-emacs@gnu.org; Thu, 09 Nov 2017 23:11:13 +0100 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.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" Xref: news.gmane.org gmane.emacs.bugs:139698 Archived-At: --=-=-= Content-Type: text/plain The Edebug spec for and-let* inherits from if-let*, but and-let* allows its code body to be empty and if-let*'s Edebug spec does not permit that. To reproduce: Load test/lisp/emacs-lisp/subr-x-tests.el M-x edebug-all-defs RET M-x eval-buffer RET Result: edebug-syntax-error: Invalid read syntax: "Expected form" The error happens while instrumenting subr-x-and-let*-test-empty-varlist. I noticed while looking at the Edebug specs for these macros that the one for if-let* uses "sexp" to match a form which will be evaluated, in the case where a test is not bound to a symbol (referred to as the (VALUEFORM) case in the docstring). This will cause Edebug to skip over that test instead of stepping through it, so it should be changed from "sexp" to "form". After those two fixes, Edebug still fails to instrument subr-x-tests.el because of a missing quote in subr-x-and-let*-test-group-1. Here is a patch with all three of these fixed: --=-=-= Content-Type: text/plain Content-Disposition: inline; filename=0001-Fix-Edebug-specs-for-if-let-and-and-let.patch >From ee73f9e3dbf8ee75a7f247f58f1022c7034b3c76 Mon Sep 17 00:00:00 2001 From: Gemini Lasswell Date: Sun, 5 Nov 2017 21:36:58 -0800 Subject: [PATCH] Fix Edebug specs for if-let* and and-let* * test/lisp/emacs-lisp/subr-x.el (if-let*, if-let): Change Edebug spec to cause Edebug to instrument tests the results of which are not bound to symbols (the (VALUEFORM) case). (and-let*): Change Edebug spec to allow empty body. *test/lisp/emacs-lisp/subr-x-tests.el: (subr-x-and-let*-test-group-1): Add missing quote to erroneous form so Edebug will work on this test. --- lisp/emacs-lisp/subr-x.el | 8 +++++--- test/lisp/emacs-lisp/subr-x-tests.el | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el index 8ed29d8659..af764ed4c2 100644 --- a/lisp/emacs-lisp/subr-x.el +++ b/lisp/emacs-lisp/subr-x.el @@ -133,7 +133,7 @@ if-let* nil; i.e. SYMBOL can be omitted if only the test result is of interest." (declare (indent 2) - (debug ((&rest [&or symbolp (symbolp form) (sexp)]) + (debug ((&rest [&or symbolp (symbolp form) (form)]) form body))) (if varlist `(let* ,(setq varlist (internal--build-bindings varlist)) @@ -156,7 +156,9 @@ and-let* "Bind variables according to VARLIST and conditionally eval BODY. Like `when-let*', except if BODY is empty and all the bindings are non-nil, then the result is non-nil." - (declare (indent 1) (debug when-let*)) + (declare (indent 1) + (debug ((&rest [&or symbolp (symbolp form) (form)]) + body))) (let (res) (if varlist `(let* ,(setq varlist (internal--build-bindings varlist)) @@ -168,7 +170,7 @@ if-let "Bind variables according to SPEC and eval THEN or ELSE. Like `if-let*' except SPEC can have the form (SYMBOL VALUEFORM)." (declare (indent 2) - (debug ([&or (&rest [&or symbolp (symbolp form) (sexp)]) + (debug ([&or (&rest [&or symbolp (symbolp form) (form)]) (symbolp form)] form body)) (obsolete "use `if-let*' instead." "26.1")) diff --git a/test/lisp/emacs-lisp/subr-x-tests.el b/test/lisp/emacs-lisp/subr-x-tests.el index 0e8871d9a9..0187f39d15 100644 --- a/test/lisp/emacs-lisp/subr-x-tests.el +++ b/test/lisp/emacs-lisp/subr-x-tests.el @@ -403,7 +403,7 @@ (should-error (eval '(and-let* (nil (x 1))) lexical-binding) :type 'setting-constant) (should (equal nil (and-let* ((nil) (x 1))))) - (should-error (eval (and-let* (2 (x 1))) lexical-binding) + (should-error (eval '(and-let* (2 (x 1))) lexical-binding) :type 'wrong-type-argument) (should (equal 1 (and-let* ((2) (x 1))))) (should (equal 2 (and-let* ((x 1) (2))))) -- 2.15.0 --=-=-=--