mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-26 05:00:28 +02:00
peval: Truncate multiple values when extending the environment.
Reported by Cédric Cellier <rixed@happyleptic.org>. * module/language/tree-il/peval.scm (truncate-values): New procedure. (make-operand): Call `truncate-values' SOURCE. * test-suite/tests/tree-il.test ("partial evaluation"): New tests for multiple value truncation.
This commit is contained in:
parent
679eea4f0e
commit
bcec8858a8
2 changed files with 61 additions and 1 deletions
|
@ -664,6 +664,23 @@
|
|||
(+ a b))))
|
||||
(const 3))
|
||||
|
||||
(pass-if-peval resolve-primitives
|
||||
;; First order, multiple values.
|
||||
(let ((x 1) (y 2))
|
||||
(values x y))
|
||||
(apply (primitive values) (const 1) (const 2)))
|
||||
|
||||
(pass-if-peval resolve-primitives
|
||||
;; First order, multiple values truncated.
|
||||
(let ((x (values 1 'a)) (y 2))
|
||||
(values x y))
|
||||
(apply (primitive values) (const 1) (const 2)))
|
||||
|
||||
(pass-if-peval resolve-primitives
|
||||
;; First order, multiple values truncated.
|
||||
(or (values 1 2) 3)
|
||||
(const 1))
|
||||
|
||||
(pass-if-peval
|
||||
;; First order, coalesced, mutability preserved.
|
||||
(cons 0 (cons 1 (cons 2 (list 3 4 5))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue