Skip to content

TP0204

Error: non-exhaustive match (missing: …)

  • non-exhaustive match (missing: <a>, <b>), each a variant, literal or, since M29, a pattern such as Degraded(0, _) or [_, *_] (§5.1)

From the golden case tests/cases/m38/tp0204_guard.tpn:

tp0204_guard.tpn
def pick(b: bool, flag: bool) -> int:
match b:
True if flag:
return 1
False:
return 0

The compiler reports:

tp0204_guard.tpn:2:5: error TP0204: non-exhaustive match (missing: True)

The specification lists every code.