Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Morphir elm compiler does not enforce pattern match completeness #1148

Open
edwardpeters opened this issue Feb 21, 2024 · 0 comments
Open

Morphir elm compiler does not enforce pattern match completeness #1148

edwardpeters opened this issue Feb 21, 2024 · 0 comments
Labels
task Task level project item

Comments

@edwardpeters
Copy link

edwardpeters commented Feb 21, 2024

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 edwardpeters added the task Task level project item label Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
task Task level project item
Projects
None yet
Development

No branches or pull requests

1 participant