feat: fix nil equals nil, and fix funcs with discard params

This commit is contained in:
Kasey White 2022-12-20 03:02:33 -05:00 committed by Lucas
parent 9177267570
commit ac14512706
2 changed files with 13 additions and 4 deletions

View File

@ -1837,7 +1837,9 @@ impl<'a> CodeGenerator<'a> {
| ArgName::NamedLabeled { name, .. } => {
args.push(name.clone());
}
_ => {}
_ => {
args.push("_".to_string());
}
}
}
let recursive = if let Ok(index) =
@ -2596,6 +2598,9 @@ impl<'a> CodeGenerator<'a> {
};
arg_stack.push(term);
return;
} else if tipo.is_nil() {
arg_stack.push(Term::Constant(UplcConstant::Bool(true)));
return;
}
Term::Apply {
@ -2705,9 +2710,7 @@ impl<'a> CodeGenerator<'a> {
// arg_stack.push(term);
// return;
todo!()
} else if tipo.is_list()
|| matches!(tipo.get_uplc_type(), UplcType::List(_))
{
} else if tipo.is_list() {
let term = Term::Apply {
function: Term::Apply {
function: Term::Apply {
@ -2745,6 +2748,9 @@ impl<'a> CodeGenerator<'a> {
arg_stack.push(term);
return;
} else if tipo.is_nil() {
arg_stack.push(Term::Constant(UplcConstant::Bool(false)));
return;
}
Term::Apply {

View File

@ -1,3 +1,6 @@
// Should this fail or equal true?
// Should != be false or true?
test nil_1() {
Nil == Nil
}