Use Delay error directly when casting from data without traces

This commit is contained in:
microproofs
2024-09-01 20:10:59 -04:00
committed by Kasey
parent 575f0f9a9a
commit 2be76d7cda
2 changed files with 37 additions and 18 deletions

View File

@@ -981,7 +981,11 @@ pub fn unknown_data_to_type(term: Term<Name>, field_type: &Type) -> Term<Name> {
.lambda("__list_data")
.apply(Term::unlist_data().apply(term)),
Some(UplcType::Bool) => Term::unwrap_bool_or(term, |result| result, &Term::Error.delay()),
Some(UplcType::Unit) => Term::unwrap_void_or(term, |result| result, &Term::Error.delay()),
Some(UplcType::Unit) => Term::unwrap_void_or(
term.as_var("val", |val| Term::Var(val)),
|result| result,
&Term::Error.delay(),
),
Some(UplcType::Data) | None => term,
}