summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlasdair Armstrong2019-02-04 16:43:32 +0000
committerAlasdair Armstrong2019-02-04 16:43:32 +0000
commit4910e06ae9cf8f479c76fea39b4334407942da4e (patch)
tree6d39cecf2352b9584b48e61df24556b419df055e /test
parentebfed17b57993f034d1a334014a8b9c9a542c0d5 (diff)
Fix behavior for fallthrough cases in catch blocks
Make all backends behave the same when a catch block does not catch a specific exception.
Diffstat (limited to 'test')
-rw-r--r--test/c/fallthrough_exception.expect1
-rw-r--r--test/c/fallthrough_exception.sail20
2 files changed, 21 insertions, 0 deletions
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 <prelude.sail>
+
+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