Skip to content

TP0300

Warning: warning: unreachable code (a statement, match arm or except clause)

  • unreachable match arm
  • unreachable except clause, with help '<B>' is already caught above
  • unreachable code (M16)

From the golden case tests/cases/m19/tp0300_match_expr.tpn:

tp0300_match_expr.tpn
# An unreachable arm is a warning, and doesn't count toward the result type (SPEC §5.1.1).
let n = 2
let s = match n:
_: "any"
1: 5
print(s)

The compiler reports:

tp0300_match_expr.tpn:5:5: warning TP0300: unreachable match arm

The specification lists every code.