Hi, as I understand, closed tag unions can only have the values described in the tag.
If that is correct, I think this must be a bug in Roc:
» Union : [A, B]
» checkTuple : Union, Union -> Nat
… checkTuple = \a, b ->
… when (a, b) is
… (A, _) -> 0
… (B, A) -> 1
… (B, B) -> 2
── 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, _ )
Yeah, this is a bug. Thanks for the report! Do you mind making a github issue?
Thank you! I'll open one now.
Last updated: Jul 06 2025 at 12:14 UTC