roc icon indicating copy to clipboard operation
roc copied to clipboard

Pattern matching tuple of closed tag unions does not recognise all possibilities are covered

Open pinyotensor opened this issue 1 year ago • 3 comments

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, _ )

pinyotensor avatar Dec 02 '23 16:12 pinyotensor

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.

Anton-4 avatar Dec 02 '23 16:12 Anton-4

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.

pinyotensor avatar Dec 02 '23 23:12 pinyotensor

Sorry for the duplicity, then!

No problem at all :)

Anton-4 avatar Dec 04 '23 11:12 Anton-4