Gracefully abort on type incompatibility
Since the only use of `TypeCx::bug` is in `Constructor::is_covered_by`, it is tempting to return `false` instead of `Err()`, but that would cause "non-exhaustive match" false positives.
This commit is contained in:
parent
11f32b73e0
commit
400dc46a05
5 changed files with 18 additions and 14 deletions
|
@ -78,7 +78,7 @@ impl<'p, Cx: TypeCx> PatternColumn<'p, Cx> {
|
|||
let mut specialized_columns: Vec<_> =
|
||||
(0..arity).map(|_| Self { patterns: Vec::new() }).collect();
|
||||
let relevant_patterns =
|
||||
self.patterns.iter().filter(|pat| ctor.is_covered_by(cx, pat.ctor()));
|
||||
self.patterns.iter().filter(|pat| ctor.is_covered_by(cx, pat.ctor()).unwrap_or(false));
|
||||
for pat in relevant_patterns {
|
||||
let specialized = pat.specialize(ctor, arity);
|
||||
for (subpat, column) in specialized.into_iter().zip(&mut specialized_columns) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue