# HG changeset patch # User Adam Chlipala # Date 1259157788 18000 # Node ID a5eb8f87bc17e642e78a82682505d32cfc819ddc # Parent 36efaf119b8513d114b731e984a0e0cedb46275c Better error message for link-handler conflicts diff -r 36efaf119b85 -r a5eb8f87bc17 src/tag.sml --- a/src/tag.sml Wed Nov 25 08:52:32 2009 -0500 +++ b/src/tag.sml Wed Nov 25 09:03:08 2009 -0500 @@ -41,6 +41,10 @@ fun kind (k, s) = (k, s) fun con (c, s) = (c, s) +fun both (loc, f) = (ErrorMsg.errorAt loc ("Function " ^ f ^ " needed for both a link and a form"); + TextIO.output (TextIO.stdErr, + "Make sure that the signature of the containing module hides any form handlers.\n")) + fun exp env (e, s) = case e of EApp ( @@ -105,8 +109,7 @@ if ek = ek' then () else - ErrorMsg.errorAt loc - "Function needed as both a link and a form "; + both (loc, s); byTag) val e = (EClosure (cn, args), loc) @@ -166,7 +169,7 @@ (if ek = ek' then () else - ErrorMsg.errorAt loc "Function needed for both a link and a form"; + both (loc, s); ([], (env, count, tags, byTag))) end | _ => diff -r 36efaf119b85 -r a5eb8f87bc17 tests/both.ur --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/both.ur Wed Nov 25 09:03:08 2009 -0500 @@ -0,0 +1,9 @@ +fun main () : transaction page = return + +
+ + + +
+ +and submit r = return diff -r 36efaf119b85 -r a5eb8f87bc17 tests/both.urp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/both.urp Wed Nov 25 09:03:08 2009 -0500 @@ -0,0 +1,2 @@ + +both diff -r 36efaf119b85 -r a5eb8f87bc17 tests/both2.ur --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/both2.ur Wed Nov 25 09:03:08 2009 -0500 @@ -0,0 +1,14 @@ +fun main () : transaction page = + let + fun submit r = return + in + return + +
+ + + +
+ end + + diff -r 36efaf119b85 -r a5eb8f87bc17 tests/both2.urp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/both2.urp Wed Nov 25 09:03:08 2009 -0500 @@ -0,0 +1,2 @@ + +both2