diff options
| author | Alasdair Armstrong | 2019-03-22 16:14:23 +0000 |
|---|---|---|
| committer | Alasdair Armstrong | 2019-03-22 16:16:16 +0000 |
| commit | c9471630ad64af00a58a3c92f4b6a22f2194e9ee (patch) | |
| tree | b3ccdf6840378de84943fc6f48b96afa33aa3422 /test | |
| parent | 2b0a4e2746e632d3f823baade49b560f79317497 (diff) | |
C: Fix as-patterns in C output
Most such patterns are re-written away by various re-writing steps,
but for those that arn't they are fairly easy to handle by just having
as patterns directly in the ANF-patterns.
Fixes #39
Diffstat (limited to 'test')
| -rw-r--r-- | test/c/anf_as_pattern.expect | 1 | ||||
| -rw-r--r-- | test/c/anf_as_pattern.sail | 19 |
2 files changed, 20 insertions, 0 deletions
diff --git a/test/c/anf_as_pattern.expect b/test/c/anf_as_pattern.expect new file mode 100644 index 00000000..9766475a --- /dev/null +++ b/test/c/anf_as_pattern.expect @@ -0,0 +1 @@ +ok diff --git a/test/c/anf_as_pattern.sail b/test/c/anf_as_pattern.sail new file mode 100644 index 00000000..9b9196b1 --- /dev/null +++ b/test/c/anf_as_pattern.sail @@ -0,0 +1,19 @@ +default Order dec + +$include <prelude.sail> + +val "print_endline" : string -> unit + +function test () : unit -> option(int) = { + match Some(3) { + Some(_) as x => x, + _ => None() + } +} + +function main() : unit -> unit = { + match test() { + Some(3) => print_endline("ok"), + _ => print_endline("fail") + } +}
\ No newline at end of file |
