summaryrefslogtreecommitdiff
path: root/test/typecheck
diff options
context:
space:
mode:
authorAlasdair Armstrong2017-08-15 13:50:21 +0100
committerAlasdair Armstrong2017-08-15 13:50:21 +0100
commit609a48d32a316fc2cb0578ebe84bc479c729cc66 (patch)
tree97ca05d4097be6ea4711ff03679109c8ad49c04c /test/typecheck
parentf05423c1947df0432362172ba9cfd00c4b8680c0 (diff)
Added exceptions and try/catch blocks to AST and typechecker in order
to translate exceptions in ASL. See test/typecheck/pass/trycatch.sail.
Diffstat (limited to 'test/typecheck')
-rw-r--r--test/typecheck/pass/trycatch.sail20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/typecheck/pass/trycatch.sail b/test/typecheck/pass/trycatch.sail
new file mode 100644
index 00000000..b7f97dd0
--- /dev/null
+++ b/test/typecheck/pass/trycatch.sail
@@ -0,0 +1,20 @@
+
+scattered typedef exception = const union
+
+union exception member int IntEx
+
+val unit -> unit effect {escape} test2
+
+function test2 () = throw (IntEx(3))
+
+val unit -> unit effect {escape} test
+
+function test () =
+ try {
+ test2();
+ ()
+ } catch {
+ case (IntEx(_)) -> ()
+ }
+
+end exception