diff src/especialize.sml @ 1181:618f9f458da9

Got split1 working, but noticed a nasty type inference bug with transplanted unification variables
author Adam Chlipala <adamc@hcoop.net>
date Sat, 06 Mar 2010 19:14:48 -0500
parents ac3dbbc85c6e
children 338be96f8533
line wrap: on
line diff
--- a/src/especialize.sml	Sat Mar 06 16:15:26 2010 -0500
+++ b/src/especialize.sml	Sat Mar 06 19:14:48 2010 -0500
@@ -43,6 +43,13 @@
 structure IM = IntBinaryMap
 structure IS = IntBinarySet
 
+val isOpen = U.Exp.exists {kind = fn _ => false,
+                           con = fn c =>
+                                    case c of
+                                        CRel _ => true
+                                      | _ => false,
+                           exp = fn _ => false}
+
 val freeVars = U.Exp.foldB {kind = fn (_, _, xs) => xs,
                             con = fn (_, _, xs) => xs,
                             exp = fn (bound, e, xs) =>
@@ -221,7 +228,12 @@
                         in
                             ((ECApp (e, c), loc), st)
                         end
-                      | ECAbs _ => (e, st)
+                      | ECAbs (x, k, e) =>
+                        let
+                            val (e, st) = exp (env, e, st)
+                        in
+                            ((ECAbs (x, k, e), loc), st)
+                        end
                       | EKAbs _ => (e, st)
                       | EKApp (e, k) =>
                         let
@@ -349,6 +361,7 @@
                             if not fin
                                orelse List.all (fn (ERel _, _) => true
                                                  | _ => false) fxs'
+                               orelse List.exists isOpen fxs'
                                orelse (IS.numItems fvs >= length fxs
                                        andalso IS.exists (fn n => functionInside (#2 (List.nth (env, n)))) fvs) then
                                 ((*Print.prefaces "No" [("name", Print.PD.string name),