Move exhaustiveness checking to type solving phase with solve tests

This commit is contained in:
Ayaz Hafiz 2022-04-22 10:22:49 -04:00
parent 9602b3634c
commit 356616d834
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
13 changed files with 678 additions and 42 deletions

View file

@ -100,6 +100,7 @@ pub enum TypeError {
ErrorType,
Vec<IncompleteAbilityImplementation>,
),
Exhaustive(roc_exhaustive::Error),
}
use roc_types::types::Alias;
@ -1196,6 +1197,16 @@ fn solve(
}
}
}
Exhaustive(rows_index, context) => {
let sketched_rows = constraints.sketched_rows[rows_index.index()].clone();
let checked = roc_can::exhaustive::check(&subs, sketched_rows, *context);
if let Err(errors) = checked {
problems.extend(errors.into_iter().map(TypeError::Exhaustive));
}
state
}
};
}