From 200bed939aed2ef51b4dce74cec6f6720fe8f7d7 Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Wed, 25 Nov 2009 09:03:08 -0500 Subject: Better error message for link-handler conflicts --- src/tag.sml | 9 ++++++--- tests/both.ur | 9 +++++++++ tests/both.urp | 2 ++ tests/both2.ur | 14 ++++++++++++++ tests/both2.urp | 2 ++ 5 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 tests/both.ur create mode 100644 tests/both.urp create mode 100644 tests/both2.ur create mode 100644 tests/both2.urp diff --git a/src/tag.sml b/src/tag.sml index 30720ec9..582a3b8e 100644 --- a/src/tag.sml +++ b/src/tag.sml @@ -41,6 +41,10 @@ structure SM = BinaryMapFn(struct 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 @@ fun exp env (e, s) = 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 @@ fun tag file = (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 --git a/tests/both.ur b/tests/both.ur new file mode 100644 index 00000000..d1c9f40e --- /dev/null +++ b/tests/both.ur @@ -0,0 +1,9 @@ +fun main () : transaction page = return + +
+ + + +
+ +and submit r = return diff --git a/tests/both.urp b/tests/both.urp new file mode 100644 index 00000000..a29c8ea1 --- /dev/null +++ b/tests/both.urp @@ -0,0 +1,2 @@ + +both diff --git a/tests/both2.ur b/tests/both2.ur new file mode 100644 index 00000000..c3f25cc9 --- /dev/null +++ b/tests/both2.ur @@ -0,0 +1,14 @@ +fun main () : transaction page = + let + fun submit r = return + in + return + +
+ + + +
+ end + + diff --git a/tests/both2.urp b/tests/both2.urp new file mode 100644 index 00000000..8e85a838 --- /dev/null +++ b/tests/both2.urp @@ -0,0 +1,2 @@ + +both2 -- cgit v1.2.3