morphir-elm
morphir-elm copied to clipboard
Morphir elm compiler does not enforce pattern match completeness
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