From 609a48d32a316fc2cb0578ebe84bc479c729cc66 Mon Sep 17 00:00:00 2001 From: Alasdair Armstrong Date: Tue, 15 Aug 2017 13:50:21 +0100 Subject: Added exceptions and try/catch blocks to AST and typechecker in order to translate exceptions in ASL. See test/typecheck/pass/trycatch.sail. --- test/typecheck/pass/trycatch.sail | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 test/typecheck/pass/trycatch.sail (limited to 'test') 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 -- cgit v1.2.3