morphir-elm icon indicating copy to clipboard operation
morphir-elm copied to clipboard

Morphir elm compiler does not enforce pattern match completeness

Open edwardpeters opened this issue 1 year ago • 0 comments

Describe the bug Morphir elm will compile code with incomplete pattern matching. This can result in runtime errors.

To Reproduce The following code compiles:

type MyUnion = A | B

foo : MyUnion -> String
foo x = case x of
    A -> "A"

bar : Int -> String
bar i = foo B

When bar is run, it results in "Unable to compute", as makes sense given that the pattern match does not handle that case.

Expected behavior Type checking should enforce that pattern matching is exhaustive.

Desktop (please complete the following information):

  • OS: OSX
  • Version: 2.89.0

edwardpeters avatar Feb 21 '24 14:02 edwardpeters