* module/language/tree-il/peval.scm (peval): let-values with a consumer
that has only one argument is the same as let.
* test-suite/tests/peval.test ("partial evaluation"): Add test.
;; 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)))
(($ <lambda-case> src req opt rest #f inits gensyms body #f)
(let* ((nmin (length req))
(nmax (and (not rest) (+ nmin (if opt (length opt) 0)))))
(call-with-prompt t
(lambda () (abort-to-prompt t 1 2 3))
(lambda (k x y z) (list x y z))))
- (primcall list (const 1) (const 2) (const 3))))
+ (primcall list (const 1) (const 2) (const 3)))
+
+ (pass-if-peval
+ (call-with-values foo (lambda (x) (bar x)))
+ (let (x) (_) ((call (toplevel foo)))
+ (call (toplevel bar) (lexical x _)))))