Error codes · Matching
PW0305
non_exhaustive_match
The program must hold to this: a match must cover every value its scrutinee can take.
A program the compiler refuses with it
module shapes
type Shape =
| Circle(Int)
| Square(Int)
| Point
fn area(s: Shape) -> Int !{} {
match s {
Circle(r) => 3 * r * r,
Square(side) => side * side,
}
}From A case forgotten, in Why Pleris. A test holds the guide's examples to the compiler.
Reading the diagnostic
pw check prints the code in brackets, [PW0305], with the sentence above and the place in your program. Errors and diagnostics explains how to read one, and every code is listed with its rule.