mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 08:11:12 +00:00
add debug assert for possible invariant
This commit is contained in:
parent
3ea748e532
commit
8a46765fee
1 changed files with 4 additions and 0 deletions
|
@ -117,6 +117,10 @@ pub fn check_patterns<'a>(
|
||||||
let bad_patterns = is_exhaustive(&matrix, 1);
|
let bad_patterns = is_exhaustive(&matrix, 1);
|
||||||
if !bad_patterns.is_empty() {
|
if !bad_patterns.is_empty() {
|
||||||
// TODO i suspect this is like a concat in in practice? code below can panic
|
// TODO i suspect this is like a concat in in practice? code below can panic
|
||||||
|
// if this debug_assert! ever fails, the theory is disproven
|
||||||
|
debug_assert!(
|
||||||
|
bad_patterns.iter().map(|v| v.len()).sum::<usize>() == bad_patterns.len()
|
||||||
|
);
|
||||||
let heads = bad_patterns.into_iter().map(|mut v| v.remove(0)).collect();
|
let heads = bad_patterns.into_iter().map(|mut v| v.remove(0)).collect();
|
||||||
errors.push(Error::Incomplete(region, context, heads));
|
errors.push(Error::Incomplete(region, context, heads));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue