[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 15/58: Fix eta-conversion edge cases in peval.
From: |
Andy Wingo |
Subject: |
[Guile-commits] 15/58: Fix eta-conversion edge cases in peval. |
Date: |
Tue, 7 Aug 2018 06:58:30 -0400 (EDT) |
wingo pushed a commit to branch lightning
in repository guile.
commit 6708acbf66fb7e92b81853b34a183e93aebbbd2a
Author: Mark H Weaver <address@hidden>
Date: Thu Mar 15 23:22:26 2018 -0400
Fix eta-conversion edge cases in peval.
Fixes <https://bugs.gnu.org/29520>.
Reported by Stefan Israelsson Tampe <address@hidden>.
* 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.
---
module/language/tree-il/peval.scm | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/module/language/tree-il/peval.scm
b/module/language/tree-il/peval.scm
index c3df1a7..b8a0fe9 100644
--- a/module/language/tree-il/peval.scm
+++ b/module/language/tree-il/peval.scm
@@ -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))
- [Guile-commits] branch lightning updated (0a01963 -> 0d00164), Andy Wingo, 2018/08/07
- [Guile-commits] 02/58: doc: Update LALR URL., Andy Wingo, 2018/08/07
- [Guile-commits] 06/58: Make sure the return value of 'scm_crypt' is always initialized., Andy Wingo, 2018/08/07
- [Guile-commits] 03/58: Fix 'crypt' deadlock upon error., Andy Wingo, 2018/08/07
- [Guile-commits] 01/58: Update NEWS for 2.2.3, Andy Wingo, 2018/08/07
- [Guile-commits] 07/58: No tabs in C code., Andy Wingo, 2018/08/07
- [Guile-commits] 04/58: 'load-thunk-from-memory' reports the correct error., Andy Wingo, 2018/08/07
- [Guile-commits] 13/58: srfi-18: 'thread-sleep!' timeout-as-a-number is relative., Andy Wingo, 2018/08/07
- [Guile-commits] 18/58: Fix typo in comment within numbers.c, Andy Wingo, 2018/08/07
- [Guile-commits] 08/58: Revert "Honor '%fresh-auto-compile'.", Andy Wingo, 2018/08/07
- [Guile-commits] 15/58: Fix eta-conversion edge cases in peval.,
Andy Wingo <=
- [Guile-commits] 17/58: Fix minor typo in the PEG documentation., Andy Wingo, 2018/08/07
- [Guile-commits] 20/58: Avoid inexact arithmetic in the type inferrer for 'sqrt'., Andy Wingo, 2018/08/07
- [Guile-commits] 16/58: Fix a few typos in the manual., Andy Wingo, 2018/08/07
- [Guile-commits] 05/58: compile: Load language modules upfront., Andy Wingo, 2018/08/07
- [Guile-commits] 11/58: doc: Fix typo about SRFI-4 syntax., Andy Wingo, 2018/08/07
- [Guile-commits] 09/58: 'select' returns empty sets upon EINTR and EAGAIN., Andy Wingo, 2018/08/07
- [Guile-commits] 14/58: Recognize RISC-V compilation targets., Andy Wingo, 2018/08/07
- [Guile-commits] 21/58: goops: Fix 'instance?' to work on objects that aren't structs., Andy Wingo, 2018/08/07
- [Guile-commits] 10/58: build: Use 'sed' invocation compatible with BSD sed., Andy Wingo, 2018/08/07
- [Guile-commits] 24/58: Add copyright header for (language elisp falias), and fix typo., Andy Wingo, 2018/08/07