mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-19 19:20:23 +02:00
peval: Always visit prompt bodies in values context
* module/language/tree-il/peval.scm (peval): Always evaluate the body in values context, as a captured continuation could continue to a continuation of any arity. However the handler, if it returns, does return to the prompt's continuation. Fixes #14347. Thanks to Jussi Piitulainen for the report. * test-suite/tests/control.test ("shift and reset"): Add a test.
This commit is contained in:
parent
ee3381c94d
commit
a192c336a2
2 changed files with 13 additions and 3 deletions
|
@ -427,3 +427,13 @@
|
|||
(cons (car xs) (k (cdr xs))))))))
|
||||
(reset* (lambda () (visit xs))))
|
||||
(traverse '(1 2 3 4 5))))))
|
||||
|
||||
(with-test-prefix/c&e "shift/reset optimization"
|
||||
;; Although a call-with-prompt continuation might accept only a single
|
||||
;; value, it doesn't mean that the body can't provide a possibly
|
||||
;; different number of values to other continuations.
|
||||
(pass-if-equal "bug #14347"
|
||||
'(3.1 2 3)
|
||||
(call-with-values
|
||||
(lambda () (let ((k (reset (shift k k) (values 3.1 2 3)))) (k)))
|
||||
list)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue