mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 03:40:34 +02:00
peval fix: (cons 1 #nil) is not (list 1)
* module/language/tree-il/peval.scm (peval): (cons FOO #nil) is not (cons FOO '()). * test-suite/tests/tree-il.test ("partial evaluation"): Add a test.
This commit is contained in:
parent
fff39e1aa5
commit
cc8afa2b36
2 changed files with 6 additions and 1 deletions
|
@ -1040,7 +1040,7 @@ top-level bindings from ENV and return the resulting expression."
|
|||
(match (cons name (map for-value orig-args))
|
||||
(('cons head tail)
|
||||
(match tail
|
||||
(($ <const> src ())
|
||||
(($ <const> src (? (cut eq? <> '())))
|
||||
(make-application src (make-primitive-ref #f 'list)
|
||||
(list head)))
|
||||
(($ <application> src ($ <primitive-ref> _ 'list) elts)
|
||||
|
|
|
@ -1419,6 +1419,11 @@
|
|||
(((x) #f #f #f () (_))
|
||||
(apply (toplevel top) (lexical x _)))))))
|
||||
|
||||
(pass-if-peval
|
||||
;; Constant folding: cons of #nil does not make list
|
||||
(cons 1 #nil)
|
||||
(apply (primitive cons) (const 1) (const '#nil)))
|
||||
|
||||
(pass-if-peval
|
||||
;; Constant folding: cons
|
||||
(begin (cons 1 2) #f)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue