summaryrefslogtreecommitdiff
path: root/test/mono/varmatch.sail
blob: 479abea2e836eea377652336a28af7f39219c307 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
$include <flow.sail>

val eq_all = {ocaml: "(fun (x, y) -> x = y)", lem: "eq"} : forall ('a : Type). ('a, 'a) -> bool
overload operator == = {eq_all}


/* Check that when we case split on a variable that the constant propagation
   handles the default case correctly. */

enum AnEnum = One | Two | Three

val foo : AnEnum -> AnEnum

function foo(x) = {
  match (x) {
  One => Two,
  y => y
  }
}

val run : unit -> unit effect {escape}

function run () = {
  assert(foo(One) == Two);
  assert(foo(Two) == Two);
  assert(foo(Three) == Three);
}