mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 11:40:18 +02:00
Fix eta-conversion edge cases in peval.
Fixes <https://bugs.gnu.org/29520>. Reported by Stefan Israelsson Tampe <stefan.itampe@gmail.com>. * module/language/tree-il/peval.scm (peval)[lift-applied-lambda]: Before performing eta-conversion, check that the variable(s) passed to the inner 'apply' are not referenced from the inner lambda, and that the number of required arguments would not be reduced by the conversion.
This commit is contained in:
parent
2662cafd6a
commit
6708acbf66
1 changed files with 5 additions and 1 deletions
|
@ -1591,11 +1591,15 @@ top-level bindings from ENV and return the resulting expression."
|
|||
(and (not opt) rest (not kw)
|
||||
(match body
|
||||
(($ <primcall> _ 'apply
|
||||
(($ <lambda> _ _ (and lcase ($ <lambda-case>)))
|
||||
(($ <lambda> _ _ (and lcase ($ <lambda-case> _ req1)))
|
||||
($ <lexical-ref> _ _ sym)
|
||||
...))
|
||||
(and (equal? sym gensyms)
|
||||
(not (lambda-case-alternate lcase))
|
||||
(<= (length req) (length req1))
|
||||
(every (lambda (s)
|
||||
(= (lexical-refcount s) 1))
|
||||
sym)
|
||||
lcase))
|
||||
(_ #f))))
|
||||
(let* ((vars (map lookup-var gensyms))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue