Mercurial > urweb
changeset 1046:a5eb8f87bc17
Better error message for link-handler conflicts
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Wed, 25 Nov 2009 09:03:08 -0500 |
parents | 36efaf119b85 |
children | 609ab3947a08 |
files | src/tag.sml tests/both.ur tests/both.urp tests/both2.ur tests/both2.urp |
diffstat | 5 files changed, 33 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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 | _ =>
--- /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 <xml> + <body> + <form> + <textbox{#Text}/><submit action={submit}/> + </form> + </body> +</xml> + +and submit r = return <xml/>
--- /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
--- /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 <xml/> + in + return <xml> + <body> + <form> + <textbox{#Text}/><submit action={submit}/> + </form> + </body> + </xml> + end + +