summaryrefslogtreecommitdiff
path: root/test/mono/varmatch.sail
blob: 7d2b9b73ca4d92fcb387c7fc891ed9a5a819255f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
(* Check that when we case split on a variable that the constant propagation
   handles the default case correctly. *)

typedef AnEnum = enumerate { One; Two; Three }

function AnEnum foo((AnEnum) x) = {
  switch (x) {
  case One -> Two
  case y -> y
  }
}

val unit -> bool effect pure run

function run () = {
  foo(One) == Two &
  foo(Two) == Two &
  foo(Three) == Three
}