add one more test

This commit is contained in:
Kasey White 2023-02-15 01:36:32 -05:00 committed by Kasey
parent 5e5a9dd25f
commit e15e725bfe
2 changed files with 11 additions and 3 deletions

View File

@ -1389,7 +1389,7 @@ impl<'a> CodeGenerator<'a> {
Pattern::Discard { .. } => None, Pattern::Discard { .. } => None,
a @ Pattern::List { elements, tail, .. } => { a @ Pattern::List { elements, tail, .. } => {
let item_name = format!("__list_item_id_{}", self.id_gen.next()); let item_name = format!("__list_item_id_{}", self.id_gen.next());
let new_tail_name = "__list_tail".to_string(); let new_tail_name = "__tail".to_string();
if elements.is_empty() { if elements.is_empty() {
pattern_vec.push(Air::ListClauseGuard { pattern_vec.push(Air::ListClauseGuard {
@ -1477,9 +1477,7 @@ impl<'a> CodeGenerator<'a> {
inverse: true, inverse: true,
}); });
pattern_vec.push(Air::Void { scope: scope.clone() }); pattern_vec.push(Air::Void { scope: scope.clone() });
}; };
} }
} }

View File

@ -5,3 +5,13 @@ test foo() {
_ -> False _ -> False
} }
} }
test sort_by_1() {
let xs = [[4, 3], [2, 3]]
let g = when xs is {
[[x, xs2], [y, ys2]] -> True
_ -> False
}
g == True
}