chicken-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-hackers] [PATCH] Avoid building unnecessary forall types during


From: Evan Hanson
Subject: [Chicken-hackers] [PATCH] Avoid building unnecessary forall types during simplification when no typevars are used
Date: Tue, 9 Sep 2014 21:47:08 +1200

Previously, if typevars were given in a polymorphic type specification
but none of them were actually used within its body, type simplification
would still produce a "forall" type, e.g. `(forall () list)` where
simply a `list` would do. This patch fixes these cases by only keeping
the "forall" when at least one typevar is used within a type's body.
---
 scrutinizer.scm |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scrutinizer.scm b/scrutinizer.scm
index c437933..77b14f5 100644
--- a/scrutinizer.scm
+++ b/scrutinizer.scm
@@ -1389,7 +1389,7 @@
                  (cdr e)))
               (else t)))))
     (let ((t2 (simplify t)))
-      (when (pair? typeenv)
+      (when (pair? used)
        (set! t2 
          `(forall ,(filter-map
                     (lambda (e)
-- 
1.7.10.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]