summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlasdair2020-11-01 15:00:11 +0000
committerAlasdair2020-11-01 15:01:05 +0000
commit12edcd22c20f480ca73bcfdfb08477fb0480657d (patch)
tree1dc46bb7708edfa3c377c55b145facfa2fabb7d6 /test
parent29137641777155badb5863fd38ecb422e23cd1ca (diff)
Fix interpreter pattern matching bug
Diffstat (limited to 'test')
-rw-r--r--test/c/empty_list.expect5
-rw-r--r--test/c/empty_list.sail21
2 files changed, 26 insertions, 0 deletions
diff --git a/test/c/empty_list.expect b/test/c/empty_list.expect
new file mode 100644
index 00000000..e9c361a4
--- /dev/null
+++ b/test/c/empty_list.expect
@@ -0,0 +1,5 @@
+end
+.
+.
+.
+end
diff --git a/test/c/empty_list.sail b/test/c/empty_list.sail
new file mode 100644
index 00000000..a6ce0a91
--- /dev/null
+++ b/test/c/empty_list.sail
@@ -0,0 +1,21 @@
+default Order dec
+$include <prelude.sail>
+$include <string.sail>
+
+val list_test : list(int) -> unit
+
+function list_test(xs) =
+ match xs {
+ x :: xs => {
+ print_endline(".");
+ list_test(xs)
+ },
+ [||] => print_endline("end")
+ }
+
+val main : unit -> unit
+
+function main() = {
+ list_test([||]);
+ list_test([|1, 2, 3|])
+}