summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2016-06-20 22:04:45 +0200
committerAndy Wingo <wingo@pobox.com>2016-06-20 22:04:45 +0200
commitfff013215fb1a5d211df5037dcf52c92063050a8 (patch)
treeb8fdd2238a8449a010bead2aca2ee1384479414d
parent5b6eaa91d23199f9266a3c338b8be8dcad5ecc38 (diff)
downloadguile-fff013215fb1a5d211df5037dcf52c92063050a8.tar.gz
Fix peval on (call-with-values foo (lambda (x) x))
* module/language/tree-il/peval.scm (peval): Don't inline (call-with-values foo (lambda (x) exp)) to (let ((x (foo))) exp). The idea is that call-with-values sets up an explicit context in which we are requesting an explicit return arity, and that dropping extra values when there's not a rest argument is the wrong thing. Fixes #13966. * test-suite/tests/peval.test ("partial evaluation"): Update test.
-rw-r--r--module/language/tree-il/peval.scm4
-rw-r--r--test-suite/tests/peval.test6
2 files changed, 4 insertions, 6 deletions
diff --git a/module/language/tree-il/peval.scm b/module/language/tree-il/peval.scm
index 1cf2cb1a8..8e1069d38 100644
--- a/module/language/tree-il/peval.scm
+++ b/module/language/tree-il/peval.scm
@@ -1014,10 +1014,6 @@ top-level bindings from ENV and return the resulting expression."
;; reconstruct the let-values, pevaling the consumer.
(let ((producer (for-values producer)))
(or (match consumer
- (($ <lambda-case> src (req-name) #f #f #f () (req-sym) body #f)
- (for-tail
- (make-let src (list req-name) (list req-sym) (list producer)
- body)))
((and ($ <lambda-case> src () #f rest #f () (rest-sym) body #f)
(? (lambda _ (singly-valued-expression? producer))))
(let ((tmp (gensym "tmp ")))
diff --git a/test-suite/tests/peval.test b/test-suite/tests/peval.test
index 547510311..340780873 100644
--- a/test-suite/tests/peval.test
+++ b/test-suite/tests/peval.test
@@ -1354,8 +1354,10 @@
(pass-if-peval
(call-with-values foo (lambda (x) (bar x)))
- (let (x) (_) ((call (toplevel foo)))
- (call (toplevel bar) (lexical x _))))
+ (let-values (call (toplevel foo))
+ (lambda-case
+ (((x) #f #f #f () (_))
+ (call (toplevel bar) (lexical x _))))))
(pass-if-peval
((lambda (foo)