don't use generic data type lookup when you have a Record Variant as a function

This commit is contained in:
microproofs 2024-05-05 23:45:13 -04:00 committed by Kasey
parent 967f4348ed
commit 878298cc8e
1 changed files with 12 additions and 11 deletions

View File

@ -4213,15 +4213,18 @@ impl<'a> CodeGenerator<'a> {
term = evaluated_term.try_into().unwrap();
} else {
for (index, arg) in constr_type.arguments.iter().enumerate().rev() {
for (index, arg) in constructor
.tipo
.arg_types()
.unwrap()
.iter()
.enumerate()
.rev()
{
term = Term::mk_cons()
.apply(convert_type_to_data(
Term::var(
arg.label
.clone()
.unwrap_or_else(|| format!("arg_{index}")),
),
&arg.tipo,
Term::var(format!("arg_{index}")),
arg,
))
.apply(term);
}
@ -4230,10 +4233,8 @@ impl<'a> CodeGenerator<'a> {
.apply(Term::integer(constr_index.into()))
.apply(term);
for (index, arg) in constr_type.arguments.iter().enumerate().rev() {
term = term.lambda(
arg.label.clone().unwrap_or_else(|| format!("arg_{index}")),
)
for (index, _) in constr_type.arguments.iter().enumerate().rev() {
term = term.lambda(format!("arg_{index}"))
}
}
Some(term)