# HG changeset patch # User Adam Chlipala # Date 1335627312 14400 # Node ID 02533f681ad2752dd58fac1a67131d05966a2e53 # Parent 6817ddd6cf1ff9ac0a443337eda9bd560f1482e2 Fix urlification of recursive polymorphic variants diff -r 6817ddd6cf1f -r 02533f681ad2 src/monoize.sml --- a/src/monoize.sml Fri Apr 27 09:52:16 2012 -0400 +++ b/src/monoize.sml Sat Apr 28 11:35:12 2012 -0400 @@ -357,13 +357,15 @@ Attr => "attr" | Url => "url" +type vr = string * int * L'.typ * L'.exp * string + structure Fm :> sig type t val empty : int -> t - val lookup : t -> foo_kind -> int -> (int -> t -> L'.decl * t) -> t * int - val lookupList : t -> foo_kind -> L'.typ -> (int -> t -> L'.decl * t) -> t * int + val lookup : t -> foo_kind -> int -> (int -> t -> vr * t) -> t * int + val lookupList : t -> foo_kind -> L'.typ -> (int -> t -> vr * t) -> t * int val enter : t -> t val decls : t -> L'.decl list @@ -390,7 +392,7 @@ count : int, map : int IM.map M.map, listMap : int TM.map M.map, - decls : L'.decl list + decls : vr list } fun empty count = { @@ -418,7 +420,10 @@ in (next, {count = count , map = map, listMap = listMap, decls = decls}) end -fun decls ({decls, ...} : t) = decls +fun decls ({decls, ...} : t) = + case decls of + [] => [] + | _ => [(L'.DValRec decls, ErrorMsg.dummySpan)] fun lookup (t as {count, map, listMap, decls}) k n thunk = let @@ -567,17 +572,17 @@ val dom = tAll val ran = (L'.TFfi ("Basis", "string"), loc) in - ((L'.DValRec [(fk2s fk ^ "ify_" ^ x, - n, - (L'.TFun (dom, ran), loc), - (L'.EAbs ("x", - dom, - ran, - (L'.ECase ((L'.ERel 0, loc), - branches, - {disc = dom, - result = ran}), loc)), loc), - "")], loc), + ((fk2s fk ^ "ify_" ^ x, + n, + (L'.TFun (dom, ran), loc), + (L'.EAbs ("x", + dom, + ran, + (L'.ECase ((L'.ERel 0, loc), + branches, + {disc = dom, + result = ran}), loc)), loc), + ""), fm) end @@ -618,17 +623,17 @@ val dom = tAll val ran = (L'.TFfi ("Basis", "string"), loc) in - ((L'.DValRec [(fk2s fk ^ "ify_list", - n, - (L'.TFun (dom, ran), loc), - (L'.EAbs ("x", - dom, - ran, - (L'.ECase ((L'.ERel 0, loc), - branches, - {disc = dom, - result = ran}), loc)), loc), - "")], loc), + ((fk2s fk ^ "ify_list", + n, + (L'.TFun (dom, ran), loc), + (L'.EAbs ("x", + dom, + ran, + (L'.ECase ((L'.ERel 0, loc), + branches, + {disc = dom, + result = ran}), loc)), loc), + ""), fm) end diff -r 6817ddd6cf1f -r 02533f681ad2 tests/urlifyVariant.ur --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/urlifyVariant.ur Sat Apr 28 11:35:12 2012 -0400 @@ -0,0 +1,5 @@ +datatype t = T of variant [A = t] + +fun main (x : t) : transaction page = return + Go +