fix: needed a stricter check for expect_pattern func on discard pattern

This commit is contained in:
microproofs 2023-06-28 15:54:59 -04:00
parent 1c7b8e0286
commit d641f731b7
1 changed files with 7 additions and 4 deletions

View File

@ -1765,16 +1765,19 @@ impl<'a> CodeGenerator<'a> {
); );
} }
Pattern::Discard { .. } => { Pattern::Discard { .. } => {
if matches!(assignment_properties.kind, AssignmentKind::Let) { if matches!(assignment_properties.kind, AssignmentKind::Expect)
pattern_stack.let_assignment("_", value_stack); && assignment_properties.value_type.is_data()
} else { && !tipo.is_data()
{
self.expect_pattern( self.expect_pattern(
pattern, pattern,
pattern_stack, pattern_stack,
value_stack, value_stack,
tipo, tipo,
assignment_properties, assignment_properties,
) );
} else {
pattern_stack.let_assignment("_", value_stack);
} }
} }
list @ Pattern::List { .. } => { list @ Pattern::List { .. } => {