Skip to content

Commit

Permalink
don't use generic data type lookup when you have a Record Variant as …
Browse files Browse the repository at this point in the history
…a function
  • Loading branch information
MicroProofs committed May 6, 2024
1 parent 8c8448b commit 465efe8
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions crates/aiken-lang/src/gen_uplc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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)
Expand Down

0 comments on commit 465efe8

Please sign in to comment.