# HG changeset patch # User Adam Chlipala # Date 1325541258 18000 # Node ID b694f9153faa38e223862b716cff73f240a11eed # Parent 570636457047347f0a39f63e0f45c7c00057047a Adapt Monoize serialization to handle freshly created variant types diff -r 570636457047 -r b694f9153faa src/monoize.sml --- a/src/monoize.sml Mon Jan 02 15:38:52 2012 -0500 +++ b/src/monoize.sml Mon Jan 02 16:54:18 2012 -0500 @@ -531,7 +531,20 @@ let fun makeDecl n fm = let - val (x, _, xncs) = Env.lookupDatatype env i + val (x, xncs) = + case ListUtil.search (fn (L'.DDatatype [(x, i', xncs)], _) => + if i' = i then + SOME (x, xncs) + else + NONE + | _ => NONE) (!pvarDefs) of + NONE => + let + val (x, _, xncs) = Env.lookupDatatype env i + in + (x, map (fn (x, n, c) => (x, n, Option.map (monoType env) c)) xncs) + end + | SOME v => v val (branches, fm) = ListUtil.foldlMap @@ -543,7 +556,6 @@ fm) | SOME t => let - val t = monoType env t val (arg, fm) = fooify fm ((L'.ERel 0, loc), t) in (((L'.PCon (dk, L'.PConVar n, SOME (L'.PVar ("a", t), loc)), loc),