From fff013215fb1a5d211df5037dcf52c92063050a8 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Mon, 20 Jun 2016 22:04:45 +0200 Subject: [PATCH] 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. --- module/language/tree-il/peval.scm | 4 ---- test-suite/tests/peval.test | 6 ++++-- 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 - (($ 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 ($ 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)