unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#40434: 27.0.90; Can't run ERT tests for edebugged generator functions
@ 2020-04-04 16:57 Philipp Stephani
  2020-06-10 11:28 ` Philipp Stephani
  0 siblings, 1 reply; 4+ messages in thread
From: Philipp Stephani @ 2020-04-04 16:57 UTC (permalink / raw)
  To: 40434


Insert into *scratch*:

(require 'generator)
(require 'ert)
(iter-defun foo () (iter-yield 123))
(ert-deftest foo () (should (equal (iter-next (foo)) 123)))

Evaluate the first two forms.  Edebug the third form (C-u C-M-x).
Evaluate the fourth form.  Then run the test using M-x ert RET RET.
The test will reach `foo', then just hit space to continue.  The test
will then fail with

F foo
    (void-function cps-internal-yield)

Backtrace:

Backtrace for test ‘foo’:
  signal(void-function (cps-internal-yield))
  apply(signal (void-function (cps-internal-yield)))
  (setq value-18 (apply fn-16 args-17))
  (unwind-protect (setq value-18 (apply fn-16 args-17)) (setq form-description-20 (nconc (list '(should (equal (iter-next ...) 123))) (list :form (cons fn-16 args-17)) (if (eql value-18 'ert-form-evaluation-aborted-19) nil (list :value value-18)) (let ((-explainer- (and (symbolp ...) (get ... ...)))) (if -explainer- (progn (list :explanation (apply -explainer- args-17))))))) (ert--signal-should-execution form-description-20))
  (if (unwind-protect (setq value-18 (apply fn-16 args-17)) (setq form-description-20 (nconc (list '(should (equal ... 123))) (list :form (cons fn-16 args-17)) (if (eql value-18 'ert-form-evaluation-aborted-19) nil (list :value value-18)) (let ((-explainer- (and ... ...))) (if -explainer- (progn (list :explanation ...)))))) (ert--signal-should-execution form-description-20)) nil (ert-fail form-description-20))
  (let (form-description-20) (if (unwind-protect (setq value-18 (apply fn-16 args-17)) (setq form-description-20 (nconc (list '(should ...)) (list :form (cons fn-16 args-17)) (if (eql value-18 'ert-form-evaluation-aborted-19) nil (list :value value-18)) (let ((-explainer- ...)) (if -explainer- (progn ...))))) (ert--signal-should-execution form-description-20)) nil (ert-fail form-description-20)))
  (let ((value-18 'ert-form-evaluation-aborted-19)) (let (form-description-20) (if (unwind-protect (setq value-18 (apply fn-16 args-17)) (setq form-description-20 (nconc (list '...) (list :form (cons fn-16 args-17)) (if (eql value-18 ...) nil (list :value value-18)) (let (...) (if -explainer- ...)))) (ert--signal-should-execution form-description-20)) nil (ert-fail form-description-20))) value-18)
  (let* ((fn-16 #'equal) (args-17 (condition-case err (let ((signal-hook-function #'ert--should-signal-hook)) (list (iter-next (foo)) 123)) (error (progn (setq fn-16 #'signal) (list (car err) (cdr err))))))) (let ((value-18 'ert-form-evaluation-aborted-19)) (let (form-description-20) (if (unwind-protect (setq value-18 (apply fn-16 args-17)) (setq form-description-20 (nconc (list ...) (list :form ...) (if ... nil ...) (let ... ...))) (ert--signal-should-execution form-description-20)) nil (ert-fail form-description-20))) value-18))
  (closure (t) nil (let* ((fn-16 #'equal) (args-17 (condition-case err (let ((signal-hook-function ...)) (list (iter-next ...) 123)) (error (progn (setq fn-16 ...) (list ... ...)))))) (let ((value-18 'ert-form-evaluation-aborted-19)) (let (form-description-20) (if (unwind-protect (setq value-18 (apply fn-16 args-17)) (setq form-description-20 (nconc ... ... ... ...)) (ert--signal-should-execution form-description-20)) nil (ert-fail form-description-20))) value-18)))()
  ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test :name foo :documentation nil :body (closure (t) nil (let* ... ...)) :most-recent-result #s(ert-test-failed :messages "\n" :should-forms (...) :duration 1.045761238 :condition (void-function cps-internal-yield) :backtrace (... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...) :infos nil) :expected-result-type :passed :tags nil) :result #s(ert-test-failed :messages "\n" :should-forms ((... :form ... :explanation ...)) :duration 1.045761238 :condition (void-function cps-internal-yield) :backtrace (#s(backtrace-frame :evald t :fun signal :args ... :flags nil :locals ... :buffer nil :pos nil) #s(backtrace-frame :evald t :fun apply :args ... :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald nil :fun setq :args ... :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald nil :fun unwind-protect :args ... :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald nil :fun if :args ... :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald nil :fun let :args ... :flags nil :locals ... :buffer nil :pos nil) #s(backtrace-frame :evald nil :fun let :args ... :flags nil :locals ... :buffer nil :pos nil) #s(backtrace-frame :evald nil :fun let* :args ... :flags nil :locals ... :buffer nil :pos nil) #s(backtrace-frame :evald t :fun ... :args nil :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun ert--run-test-internal :args #0 :flags nil :locals ... :buffer nil :pos nil) #s(backtrace-frame :evald t :fun ert-run-test :args ... :flags nil :locals ... :buffer nil :pos nil) #s(backtrace-frame :evald t :fun ert-run-or-rerun-test :args ... :flags nil :locals ... :buffer nil :pos nil) #s(backtrace-frame :evald t :fun ert-run-tests :args ... :flags nil :locals ... :buffer nil :pos nil) #s(backtrace-frame :evald t :fun ert :args ... :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun funcall-interactively :args ... :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun call-interactively :args ... :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun command-execute :args ... :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun execute-extended-command :args ... :flags nil :locals ... :buffer nil :pos nil) #s(backtrace-frame :evald t :fun funcall-interactively :args ... :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun call-interactively :args ... :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun command-execute :args ... :flags nil :locals nil :buffer nil :pos nil)) :infos nil) :exit-continuation #f(compiled-function () #<bytecode 0x15560c3e9c8d>) :next-debugger debug :ert-debug-on-error nil))
  ert-run-test(#s(ert-test :name foo :documentation nil :body (closure (t) nil (let* ((fn-16 #'equal) (args-17 (condition-case err ... ...))) (let ((value-18 ...)) (let (form-description-20) (if ... nil ...)) value-18))) :most-recent-result #s(ert-test-failed :messages "\n" :should-forms (((should (equal ... 123)) :form (signal void-function (cps-internal-yield)) :explanation (different-types void-function (cps-internal-yield)))) :duration 1.045761238 :condition (void-function cps-internal-yield) :backtrace (#s(backtrace-frame :evald t :fun signal :args (void-function (cps-internal-yield)) :flags nil :locals ((debugger-may-continue . t) (inhibit-redisplay) (inhibit-debugger . t) (inhibit-changing-match-data)) :buffer nil :pos nil) #s(backtrace-frame :evald t :fun apply :args (signal (void-function ...)) :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald nil :fun setq :args (value-18 (apply fn-16 args-17)) :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald nil :fun unwind-protect :args ((setq value-18 ...) (setq form-description-20 ...) (ert--signal-should-execution form-description-20)) :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald nil :fun if :args ((unwind-protect ... ... ...) nil (ert-fail form-description-20)) :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald nil :fun let :args ((form-description-20) (if ... nil ...)) :flags nil :locals ((fn-16 . signal) (args-17 void-function ...) (value-18 . ert-form-evaluation-aborted-19) (form-description-20)) :buffer nil :pos nil) #s(backtrace-frame :evald nil :fun let :args ((...) (let ... ...) value-18) :flags nil :locals ((fn-16 . signal) (args-17 void-function ...) (value-18 . ert-form-evaluation-aborted-19)) :buffer nil :pos nil) #s(backtrace-frame :evald nil :fun let* :args ((... ...) (let ... ... value-18)) :flags nil :locals ((fn-16 . signal) (args-17 void-function ...)) :buffer nil :pos nil) #s(backtrace-frame :evald t :fun (closure (t) nil (let* ... ...)) :args nil :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun ert--run-test-internal :args (#s(ert--test-execution-info :test #1 :result #2 :exit-continuation #f(compiled-function () #<bytecode 0x15560c3e9c8d>) :next-debugger debug :ert-debug-on-error nil)) :flags nil :locals ((ert--infos) (debug-ignored-errors) (debug-on-quit . t) (debug-on-error . t) (debugger . #f(compiled-function (&rest args) #<bytecode 0x15560c24f14d>))) :buffer nil :pos nil) #s(backtrace-frame :evald t :fun ert-run-test :args #0 :flags nil :locals ((ert--running-tests #1) (message-log-max . t) (ert--should-execution-observer . #f(compiled-function (form-description) #<bytecode 0x15560c2547f1>))) :buffer nil :pos nil) #s(backtrace-frame :evald t :fun ert-run-or-rerun-test :args (#s(ert--stats :selector t :tests ... :test-map #<hash-table eql 1/1 0x15560c4f68ad> :test-results ... :test-start-times ... :test-end-times ... :passed-expected 0 :passed-unexpected 0 :failed-expected 0 :failed-unexpected 1 :skipped 0 :start-time ... :end-time ... :aborted-p nil :current-test nil :next-redisplay 1586019421.4940612) #1 #f(compiled-function (event-type &rest event-args) #<bytecode 0x15560c4f68a1>)) :flags nil :locals ((ert--current-run-stats . ...)) :buffer nil :pos nil) #s(backtrace-frame :evald t :fun ert-run-tests :args (t #f(compiled-function (event-type &rest event-args) #<bytecode 0x15560c4f68a1>) t) :flags nil :locals ((ert--current-run-stats . ...)) :buffer nil :pos nil) #s(backtrace-frame :evald t :fun ert :args (t nil) :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun funcall-interactively :args (ert t nil) :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun call-interactively :args (ert record nil) :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun command-execute :args (ert record) :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun execute-extended-command :args (nil "ert" "ert") :flags nil :locals ((prefix-arg)) :buffer nil :pos nil) #s(backtrace-frame :evald t :fun funcall-interactively :args (execute-extended-command nil "ert" "ert") :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun call-interactively :args (execute-extended-command nil nil) :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun command-execute :args (execute-extended-command) :flags nil :locals nil :buffer nil :pos nil)) :infos nil) :expected-result-type :passed :tags nil))
  ert-run-or-rerun-test(#s(ert--stats :selector t :tests [#s(ert-test :name foo :documentation nil :body (closure ... nil ...) :most-recent-result #s(ert-test-failed :messages "\n" :should-forms ... :duration 1.045761238 :condition ... :backtrace ... :infos nil) :expected-result-type :passed :tags nil)] :test-map #<hash-table eql 1/1 0x15560c4f68ad> :test-results [#s(ert-test-failed :messages "\n" :should-forms (...) :duration 1.045761238 :condition (void-function cps-internal-yield) :backtrace (... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...) :infos nil)] :test-start-times [(24200 48220 301586 645000)] :test-end-times [(24200 48221 347347 883000)] :passed-expected 0 :passed-unexpected 0 :failed-expected 0 :failed-unexpected 1 :skipped 0 :start-time (24200 48220 161306 299000) :end-time (24200 48221 385475 311000) :aborted-p nil :current-test nil :next-redisplay 1586019421.4940612) #s(ert-test :name foo :documentation nil :body (closure (t) nil (let* (... ...) (let ... ... value-18))) :most-recent-result #s(ert-test-failed :messages "\n" :should-forms ((... :form ... :explanation ...)) :duration 1.045761238 :condition (void-function cps-internal-yield) :backtrace (#s(backtrace-frame :evald t :fun signal :args ... :flags nil :locals ... :buffer nil :pos nil) #s(backtrace-frame :evald t :fun apply :args ... :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald nil :fun setq :args ... :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald nil :fun unwind-protect :args ... :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald nil :fun if :args ... :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald nil :fun let :args ... :flags nil :locals ... :buffer nil :pos nil) #s(backtrace-frame :evald nil :fun let :args ... :flags nil :locals ... :buffer nil :pos nil) #s(backtrace-frame :evald nil :fun let* :args ... :flags nil :locals ... :buffer nil :pos nil) #s(backtrace-frame :evald t :fun ... :args nil :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun ert--run-test-internal :args ... :flags nil :locals ... :buffer nil :pos nil) #s(backtrace-frame :evald t :fun ert-run-test :args ... :flags nil :locals ... :buffer nil :pos nil) #s(backtrace-frame :evald t :fun ert-run-or-rerun-test :args #0 :flags nil :locals ... :buffer nil :pos nil) #s(backtrace-frame :evald t :fun ert-run-tests :args ... :flags nil :locals ... :buffer nil :pos nil) #s(backtrace-frame :evald t :fun ert :args ... :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun funcall-interactively :args ... :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun call-interactively :args ... :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun command-execute :args ... :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun execute-extended-command :args ... :flags nil :locals ... :buffer nil :pos nil) #s(backtrace-frame :evald t :fun funcall-interactively :args ... :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun call-interactively :args ... :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun command-execute :args ... :flags nil :locals nil :buffer nil :pos nil)) :infos nil) :expected-result-type :passed :tags nil) #f(compiled-function (event-type &rest event-args) #<bytecode 0x15560c4f68a1>))
  ert-run-tests(t #f(compiled-function (event-type &rest event-args) #<bytecode 0x15560c4f68a1>) t)
  ert(t nil)
  funcall-interactively(ert t nil)
  call-interactively(ert record nil)
  command-execute(ert record)
  execute-extended-command(nil "ert" "ert")
  funcall-interactively(execute-extended-command nil "ert" "ert")
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)



In GNU Emacs 27.0.90 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.12)
 of 2020-04-03
Repository revision: fa823653ffb0e3e893d30daa5abf68e909934e2e
Repository branch: emacs-27
Windowing system distributor 'The X.Org Foundation', version 11.0.12004000
System Description: Debian GNU/Linux rodete

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.

Configured using:
 'configure --enable-gcc-warnings=warn-only
 --enable-gtk-deprecation-warnings --without-pop --with-mailutils
 --enable-checking --enable-check-lisp-object-type --with-modules
 'CFLAGS=-O0 -ggdb3''

Configured features:
XPM JPEG TIFF GIF PNG SOUND DBUS GSETTINGS GLIB NOTIFY INOTIFY
LIBSELINUX GNUTLS FREETYPE HARFBUZZ XFT ZLIB TOOLKIT_SCROLL_BARS GTK3
X11 XDBE XIM MODULES THREADS PDUMPER GMP

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc dired dired-loaddefs
format-spec rfc822 mml easymenu mml-sec epa epg epg-config gnus-util
rmail rmail-loaddefs text-property-search time-date mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail
rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils phst skeleton
derived edmacro kmacro pcase ffap thingatpt url-parse auth-source cl-seq
eieio eieio-core cl-macs eieio-loaddefs password-cache json map url-vars
subr-x rx gnutls puny seq byte-opt gv bytecomp byte-compile cconv dbus
xml cl-loaddefs cl-lib tooltip eldoc electric uniquify ediff-hook
vc-hooks lisp-float-type mwheel term/x-win x-win term/common-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode elisp-mode lisp-mode prog-mode register page
tab-bar menu-bar rfn-eshadow isearch timer select scroll-bar mouse
jit-lock font-lock syntax facemenu font-core term/tty-colors frame
minibuffer cl-generic cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite charscript charprop case-table epa-hook jka-cmpr-hook help
simple abbrev obarray cl-preloaded nadvice loaddefs button faces
cus-face macroexp files text-properties overlay sha1 md5 base64 format
env code-pages mule custom widget hashtable-print-readable backquote
threads dbusbind inotify dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty
make-network-process emacs)

Memory information:
((conses 16 60656 8398)
 (symbols 48 8240 1)
 (strings 32 21019 1859)
 (string-bytes 1 684594)
 (vectors 16 12144)
 (vector-slots 8 169116 5888)
 (floats 8 25 25)
 (intervals 56 202 0)
 (buffers 1000 12))

-- 
Google Germany GmbH
Erika-Mann-Straße 33
80636 München

Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschäftsführer: Paul Manicle, Halimah DeLaine Prado

If you received this communication by mistake, please don’t forward it to
anyone else (it may contain confidential or privileged information), please
erase all copies of it, including all attachments, and please let the sender
know it went to the wrong person.  Thanks.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#40434: 27.0.90; Can't run ERT tests for edebugged generator functions
  2020-04-04 16:57 bug#40434: 27.0.90; Can't run ERT tests for edebugged generator functions Philipp Stephani
@ 2020-06-10 11:28 ` Philipp Stephani
  2020-06-10 17:04   ` bug#40434: [PATCH] Band-aid for edebugging generator bodies (Bug#40434) Philipp Stephani
  0 siblings, 1 reply; 4+ messages in thread
From: Philipp Stephani @ 2020-06-10 11:28 UTC (permalink / raw)
  To: 40434

Am Sa., 4. Apr. 2020 um 18:57 Uhr schrieb Philipp Stephani
<p.stephani2@gmail.com>:
>
>
> Insert into *scratch*:
>
> (require 'generator)
> (require 'ert)
> (iter-defun foo () (iter-yield 123))
> (ert-deftest foo () (should (equal (iter-next (foo)) 123)))
>
> Evaluate the first two forms.  Edebug the third form (C-u C-M-x).
> Evaluate the fourth form.  Then run the test using M-x ert RET RET.
> The test will reach `foo', then just hit space to continue.  The test
> will then fail with
>
> F foo
>     (void-function cps-internal-yield)

I think none of the macros in generator.el should use the 'body' or
'def-body' or 't' debug specifications. Generator functions don't
really have bodies in the edebug sense, as the CPS machinery rewrites
them completely. So probably these should all use 'form' for now,
until edebug grows functionality to instrument such functions.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#40434: [PATCH] Band-aid for edebugging generator bodies (Bug#40434).
  2020-06-10 11:28 ` Philipp Stephani
@ 2020-06-10 17:04   ` Philipp Stephani
  2020-06-14 18:03     ` Philipp Stephani via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 4+ messages in thread
From: Philipp Stephani @ 2020-06-10 17:04 UTC (permalink / raw)
  To: 40434; +Cc: Philipp Stephani

Edebug doesn't support them well.  Rather than trying to fix Edebug,
disable instrumentation for now to prevent annoying bugs.

* lisp/emacs-lisp/generator.el (iter-defun, iter-lambda, iter-make)
(iter-do): Don't attempt to instrument bodies that are mangled by the
CPS transformer.

* test/lisp/emacs-lisp/generator-tests.el
(generator-tests-edebug): New regression test.
---
 lisp/emacs-lisp/generator.el            | 8 ++++----
 test/lisp/emacs-lisp/generator-tests.el | 9 +++++++++
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/lisp/emacs-lisp/generator.el b/lisp/emacs-lisp/generator.el
index ba344eb515..c95c758a57 100644
--- a/lisp/emacs-lisp/generator.el
+++ b/lisp/emacs-lisp/generator.el
@@ -673,7 +673,7 @@ iter-defun
 encapsulates the state of a computation that produces a sequence
 of values.  Callers can retrieve each value using `iter-next'."
   (declare (indent defun)
-           (debug (&define name lambda-list lambda-doc def-body))
+           (debug (&define name lambda-list lambda-doc &rest sexp))
            (doc-string 3))
   (cl-assert lexical-binding)
   (let* ((parsed-body (macroexp-parse-body body))
@@ -687,14 +687,14 @@ iter-lambda
   "Return a lambda generator.
 `iter-lambda' is to `iter-defun' as `lambda' is to `defun'."
   (declare (indent defun)
-           (debug (&define lambda-list lambda-doc def-body)))
+           (debug (&define lambda-list lambda-doc &rest sexp)))
   (cl-assert lexical-binding)
   `(lambda ,arglist
      ,(cps-generate-evaluator body)))
 
 (defmacro iter-make (&rest body)
   "Return a new iterator."
-  (declare (debug t))
+  (declare (debug (&rest sexp)))
   (cps-generate-evaluator body))
 
 (defconst iter-empty (lambda (_op _val) (signal 'iter-end-of-sequence nil))
@@ -720,7 +720,7 @@ iter-do
 Evaluate BODY with VAR bound to each value from ITERATOR.
 Return the value with which ITERATOR finished iteration."
   (declare (indent 1)
-           (debug ((symbolp form) body)))
+           (debug ((symbolp form) &rest sexp)))
   (let ((done-symbol (cps--gensym "iter-do-iterator-done"))
         (condition-symbol (cps--gensym "iter-do-condition"))
         (it-symbol (cps--gensym "iter-do-iterator"))
diff --git a/test/lisp/emacs-lisp/generator-tests.el b/test/lisp/emacs-lisp/generator-tests.el
index bcfab20163..9b1a573ea6 100644
--- a/test/lisp/emacs-lisp/generator-tests.el
+++ b/test/lisp/emacs-lisp/generator-tests.el
@@ -304,4 +304,13 @@ iter-lambda-variable-shadowing
                                             (1+ it)))))))
                  -2)))
 
+(ert-deftest generator-tests-edebug ()
+  "Check that Bug#40434 is fixed."
+  (with-temp-buffer
+    (prin1 '(iter-defun generator-tests-edebug ()
+              (iter-yield 123))
+           (current-buffer))
+    (edebug-defun))
+  (should (eql (iter-next (generator-tests-edebug)) 123)))
+
 ;;; generator-tests.el ends here
-- 
2.27.0.278.ge193c7cf3a9-goog






^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#40434: [PATCH] Band-aid for edebugging generator bodies (Bug#40434).
  2020-06-10 17:04   ` bug#40434: [PATCH] Band-aid for edebugging generator bodies (Bug#40434) Philipp Stephani
@ 2020-06-14 18:03     ` Philipp Stephani via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 4+ messages in thread
From: Philipp Stephani via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2020-06-14 18:03 UTC (permalink / raw)
  To: Philipp Stephani; +Cc: 40434

Am Mi., 10. Juni 2020 um 19:04 Uhr schrieb Philipp Stephani
<p.stephani2@gmail.com>:
>
> Edebug doesn't support them well.  Rather than trying to fix Edebug,
> disable instrumentation for now to prevent annoying bugs.

Pushed as commit e96f78fca6. I'll leave the bug open for now to track
improvements for edebug support for generators.





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-06-14 18:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-04 16:57 bug#40434: 27.0.90; Can't run ERT tests for edebugged generator functions Philipp Stephani
2020-06-10 11:28 ` Philipp Stephani
2020-06-10 17:04   ` bug#40434: [PATCH] Band-aid for edebugging generator bodies (Bug#40434) Philipp Stephani
2020-06-14 18:03     ` Philipp Stephani via Bug reports for GNU Emacs, the Swiss army knife of text editors

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).