A match, or the clauses of a function, must handle every possible value. Auk checks this at
compile time, so adding a variant to an enum points you at every place that must handle it.
The message lists a value that no arm or clause handles.
Wrong#
enum Shape { Circle(r: float), Rect(w: float, h: float) }
fn area(s: Shape): float = match s {
Circle(r) => 3.14 * r * r
}Fixed#
enum Shape { Circle(r: float), Rect(w: float, h: float) }
fn area(s: Shape): float = match s {
Circle(r) => 3.14 * r * r
Rect(w, h) => w * h
}Common causes#
- A new enum variant not yet handled everywhere.
- Arms with
whenguards: guarded arms don't count toward coverage; add an unguarded one. none/err(_)forgotten when matchingT?/T!.- Literal clauses like
fib(0),fib(1)without a generalfib(n: int)clause.