Navigation

Case::type-mismatch

Key: Case::type-mismatch

Category: elimination · Severity: error

Source: src/diag/hints.nix:910

this case-body's inferred type does not match the type the eliminator's motive requires

Example

Hint::Case::type-mismatch means the Case position supplies a term whose type does not match the expected type. The example shows the failing form first, then one way to give the checker the missing structure.

# Bad: one case branch returns the wrong type.
caseOf scrutinee { left = x: true_; right = y: natLit 0; }

# Better: all branches return the motive's type.
caseOf scrutinee { left = x: natLit 1; right = y: natLit 0; }

← All diagnostic hints