From cbda10a2d0c31f366d34e059d25751fa66c3b5e5 Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Sat, 6 Mar 2010 19:14:48 -0500 Subject: Got split1 working, but noticed a nasty type inference bug with transplanted unification variables --- src/especialize.sml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/especialize.sml') diff --git a/src/especialize.sml b/src/especialize.sml index 4936cc61..b0a4a8c2 100644 --- a/src/especialize.sml +++ b/src/especialize.sml @@ -43,6 +43,13 @@ structure KM = BinaryMapFn(K) 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 @@ fun specialize' (funcs, specialized) file = 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 @@ fun specialize' (funcs, specialized) file = 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), -- cgit v1.2.3