Skip to content

Commit

Permalink
fix: redundant might be wildcard which doesn't match technically
Browse files Browse the repository at this point in the history
  • Loading branch information
rvcas committed Aug 1, 2023
1 parent 5ce73a3 commit 7230bf0
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions crates/aiken-lang/src/tipo/environment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1451,18 +1451,16 @@ impl<'a> Environment<'a> {
if matrix.is_useful(&pattern_stack) {
matrix.push(pattern_stack);
} else {
let index = matrix
let original = matrix
.flatten()
.into_iter()
.enumerate()
.find(|(_, p)| p == pattern_stack.head())
.map(|(i, _)| i)
.expect("should find index");

let typed_pattern = unchecked_patterns[index];
.and_then(|(index, _)| unchecked_patterns.get(index))
.map(|typed_pattern| typed_pattern.location());

return Err(Error::RedundantMatchClause {
original: typed_pattern.location(),
original,
redundant: unchecked_pattern.location(),
});
}
Expand Down

0 comments on commit 7230bf0

Please sign in to comment.