From 4910e06ae9cf8f479c76fea39b4334407942da4e Mon Sep 17 00:00:00 2001 From: Alasdair Armstrong Date: Mon, 4 Feb 2019 16:43:32 +0000 Subject: Fix behavior for fallthrough cases in catch blocks Make all backends behave the same when a catch block does not catch a specific exception. --- test/c/fallthrough_exception.expect | 1 + test/c/fallthrough_exception.sail | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 test/c/fallthrough_exception.expect create mode 100644 test/c/fallthrough_exception.sail (limited to 'test') diff --git a/test/c/fallthrough_exception.expect b/test/c/fallthrough_exception.expect new file mode 100644 index 00000000..6d9de85e --- /dev/null +++ b/test/c/fallthrough_exception.expect @@ -0,0 +1 @@ +E2 diff --git a/test/c/fallthrough_exception.sail b/test/c/fallthrough_exception.sail new file mode 100644 index 00000000..6260a603 --- /dev/null +++ b/test/c/fallthrough_exception.sail @@ -0,0 +1,20 @@ +default Order dec + +$include + +val print = "print_endline" : string -> unit + +union exception = { + E1 : unit, + E2 : unit +} + +function main((): unit) -> unit = { + try { + try throw(E2()) catch { + E1() => print("E1") + } + } catch { + E2() => print("E2") + } +} \ No newline at end of file -- cgit v1.2.3