~ chicken-core (chicken-5) 38483b82007792d3a42d2bfa1938feff6c459c22


commit 38483b82007792d3a42d2bfa1938feff6c459c22
Author:     Evan Hanson <evhan@foldling.org>
AuthorDate: Tue Sep 9 21:47:08 2014 +1200
Commit:     Christian Kellermann <ckeen@pestilenz.org>
CommitDate: Wed Sep 10 09:48:00 2014 +0200

    Avoid building unnecessary forall types during simplification when no typevars are used
    
    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.
    
    Signed-off-by: Christian Kellermann <ckeen@pestilenz.org>

diff --git a/scrutinizer.scm b/scrutinizer.scm
index c4379331..77b14f58 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)
Trap