From bbdb011b8364ceaed867abb9d6b580ba8b2a60e8 Mon Sep 17 00:00:00 2001 From: Brian Campbell Date: Fri, 18 Aug 2017 16:36:52 +0100 Subject: Bit more monomorphisation testing --- test/mono/varmatch.sail | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 test/mono/varmatch.sail (limited to 'test/mono/varmatch.sail') diff --git a/test/mono/varmatch.sail b/test/mono/varmatch.sail new file mode 100644 index 00000000..7d2b9b73 --- /dev/null +++ b/test/mono/varmatch.sail @@ -0,0 +1,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 +} -- cgit v1.2.3