summaryrefslogtreecommitdiff
path: root/test/coq
diff options
context:
space:
mode:
authorBrian Campbell2019-05-24 16:08:14 +0100
committerBrian Campbell2019-05-24 16:08:14 +0100
commitfeb7562e12659bc6e112ca9e9165b8abf6bf62bb (patch)
treeb249ba21bf449f508e8fa1fc5a24d4849c085d5d /test/coq
parente4498f776de81dd84bb6e8235e279fdeb3350253 (diff)
Coq: support if-then-throw typechecking special case
Diffstat (limited to 'test/coq')
-rw-r--r--test/coq/pass/throw_fact.sail25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/coq/pass/throw_fact.sail b/test/coq/pass/throw_fact.sail
new file mode 100644
index 00000000..e40267b1
--- /dev/null
+++ b/test/coq/pass/throw_fact.sail
@@ -0,0 +1,25 @@
+default Order dec
+$include <prelude.sail>
+
+union exception = {
+ BadInput : int
+}
+
+val test1 : int -> nat effect {escape}
+
+function test1(n) = {
+ if (n < 0) then {
+ throw (BadInput(n))
+ };
+ n
+}
+
+val test2 : int -> nat effect {escape}
+
+function test2(n) = {
+ m : nat = 0;
+ if (n < 0) then {
+ throw (BadInput(n))
+ } else { m = 1 };
+ n+m
+}