1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-19 19:20:23 +02:00

Fix bug compiling fixpoint combinator

* module/language/tree-il/peval.scm (<operand>): Rename "alias-value"
  field to "alias", which is now an operand and not an expression.
  This allows the operand to capture its environment; before, the
  alias was being visited in its use environment instead of its
  definition environment.
  (peval): Adapt to operand change.
* test-suite/tests/peval.test ("partial evaluation"): New test.
This commit is contained in:
Andy Wingo 2015-05-20 17:20:25 +02:00
parent 2d6e224003
commit c691c0e15a
2 changed files with 31 additions and 11 deletions

View file

@ -1329,4 +1329,26 @@
(pass-if-peval
(eqv? '(a b) '(a b))
(const #t)))
(const #t))
(pass-if-peval
(lambda (f x)
(let lp ((x x))
(let ((x* (f x)))
(if (eq? x x*) x* (lp x*)))))
(lambda ()
(lambda-case
(((f x) #f #f #f () (_ _))
(letrec (lp)
(_)
((lambda ((name . lp))
(lambda-case
(((x) #f #f #f () (_))
(let (x*)
(_)
((apply (lexical f _) (lexical x _)))
(if (apply (primitive eq?) (lexical x _) (lexical x* _))
(lexical x* _)
(apply (lexical lp _) (lexical x* _))))))))
(apply (lexical lp _)
(lexical x _))))))))