[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 01/01: Fix peval on (call-with-values foo (lambda (x) x)
From: |
Andy Wingo |
Subject: |
[Guile-commits] 01/01: Fix peval on (call-with-values foo (lambda (x) x)) |
Date: |
Mon, 20 Jun 2016 20:07:02 +0000 (UTC) |
wingo pushed a commit to branch master
in repository guile.
commit fff013215fb1a5d211df5037dcf52c92063050a8
Author: Andy Wingo <address@hidden>
Date: Mon Jun 20 22:04:45 2016 +0200
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 1cf2cb1..8e1069d 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 5475103..3407808 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)