Improve non-exhaustive typechecking errors

We will replace this with proper exhaustiveness checking when we have
that in the typechecking phase, but for now this should do.
This commit is contained in:
Ayaz Hafiz 2022-04-21 10:10:50 -04:00
parent 87245def0a
commit 9a341e3d75
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
3 changed files with 99 additions and 60 deletions

View file

@ -708,7 +708,9 @@ pub fn constrain_expr(
// After solving the condition variable with what's expected from the branch patterns,
// check it against the condition expression.
// This is basically exhaustiveness checking, but doesn't check for redundancy.
// TODO: when we have exhaustiveness checking during the typechecking phase, perform
// exhaustiveness checking when this expectation fails. That will produce better error
// messages.
let cond_constraint = constrain_expr(
constraints,
env,