Enable 'mk_pair_data' builtin.

This commit is contained in:
KtorZ 2024-07-27 14:09:45 +02:00 committed by Kasey
parent 643e43f8aa
commit 86aed1baa5
2 changed files with 31 additions and 5 deletions

View File

@ -4486,11 +4486,6 @@ impl<'a> CodeGenerator<'a> {
DefaultFunction::HeadList if !tipo.is_pair() => { DefaultFunction::HeadList if !tipo.is_pair() => {
builder::undata_builtin(&func, count, ret_tipo, arg_vec) builder::undata_builtin(&func, count, ret_tipo, arg_vec)
} }
DefaultFunction::MkPairData => {
unimplemented!(
"MkPairData should be handled by an anon function ( a, b, .., z).\n"
)
}
_ => { _ => {
let mut term: Term<Name> = func.into(); let mut term: Term<Name> = func.into();

View File

@ -6600,3 +6600,34 @@ fn mk_nil_list_data() {
false, false,
) )
} }
#[test]
fn mk_pair_data() {
let src = r#"
use aiken/builtin.{i_data}
test nil_equals() {
builtin.mk_pair_data(i_data(1), i_data(2)).1st == i_data(1)
}
"#;
assert_uplc(
src,
Term::equals_data()
.apply(
Term::fst_pair().apply(
Term::mk_pair_data()
.apply(Term::Constant(
Constant::Data(Data::integer(1.into())).into(),
))
.apply(Term::Constant(
Constant::Data(Data::integer(2.into())).into(),
)),
),
)
.apply(Term::Constant(
Constant::Data(Data::integer(1.into())).into(),
)),
false,
)
}