E1045: case does not cover every value
A case expression must handle every possible value of its subject (ADR-0013).
A case expression must handle every possible value of its subject (ADR-0013).
For an enum, each variant needs a branch, or a _ branch must catch the rest.
For a Bool subject, unguarded true and false branches cover it and no
_ is needed; with one of them missing, the message names the missing value
(missing: false). For an integer or String subject, a _ branch is
required. A branch with a guard does not count, because the guard may fail.
The message lists the missing variants. For an integer subject it names the
subject type and shows _. The error points at the case.
Example
A Bool needs both of its values:
Fix
Add a branch for each missing variant, or a _ branch.
A Bool is covered by true and false, without a _.
Run actus explain E1045 in your terminal to read this entry offline. Browse Ownership & types or all error codes.