roc
roc copied to clipboard
Pattern matching tuple of closed tag unions does not recognise all possibilities are covered
Setup
In the REPL, input the following:
Union : [A, B]
checkTuple : Union, Union -> Nat
checkTuple = \a, b ->
when (a, b) is
(A, _) -> 0
(B, A) -> 1
(B, B) -> 2
Expected
The pattern matching covers all cases and compiles.
Actual
── UNSAFE PATTERN ──────────────────────────────────────────────────────────────
This when does not cover all the possibilities:
8│> when (a, b) is
9│> (A, _) -> 0
10│> (B, A) -> 1
11│> (B, B) -> 2
Other possibilities include:
( B, _ )
Thanks for reporting this @kwirke! This appears to be identical to #5530. But we can keep this issue open as an extra test case, to make sure the #5530 fix is solid when it lands.
Sorry for the duplicity, then! I did a fast search but couldn't find a similar issue. I can only imagine the data storm you have to deal with, now that Roc is announced. Feel free to close this one whenever fits you best.
Sorry for the duplicity, then!
No problem at all :)