From dcb3a9b45beaf2ac2f2fdc0562966c0ad30aa627 Mon Sep 17 00:00:00 2001 From: microproofs Date: Wed, 26 Jul 2023 18:41:57 -0400 Subject: [PATCH] some type and expect fixes --- crates/aiken-lang/src/gen_uplc.rs | 13 +++++++------ crates/aiken-lang/src/gen_uplc/tree.rs | 15 --------------- 2 files changed, 7 insertions(+), 21 deletions(-) diff --git a/crates/aiken-lang/src/gen_uplc.rs b/crates/aiken-lang/src/gen_uplc.rs index a729865e..54423dd6 100644 --- a/crates/aiken-lang/src/gen_uplc.rs +++ b/crates/aiken-lang/src/gen_uplc.rs @@ -737,7 +737,7 @@ impl<'a> CodeGenerator<'a> { Pattern::Assign { name, .. } => name.to_string(), Pattern::Discard { name, .. } => { if props.full_check { - format!("__discard_{}", name) + format!("__discard_{}_{}", name, index) } else { "_".to_string() } @@ -779,7 +779,7 @@ impl<'a> CodeGenerator<'a> { && props.value_type.is_data() && !tipo.is_data() { - format!("__discard_{}", name) + format!("__discard_{}_tail", name) } else { "_".to_string() } @@ -827,6 +827,7 @@ impl<'a> CodeGenerator<'a> { arguments, constructor, name, + tipo: constr_tipo, .. } => { let mut sequence = vec![]; @@ -882,7 +883,7 @@ impl<'a> CodeGenerator<'a> { let mut type_map: IndexMap> = IndexMap::new(); - for (index, arg) in tipo.arg_types().unwrap().iter().enumerate() { + for (index, arg) in constr_tipo.arg_types().unwrap().iter().enumerate() { let field_type = arg.clone(); type_map.insert(index, field_type); } @@ -904,7 +905,7 @@ impl<'a> CodeGenerator<'a> { Pattern::Assign { name, .. } => name.to_string(), Pattern::Discard { name, .. } => { if props.full_check { - format!("__discard_{}", name) + format!("__discard_{}_{}", name, index) } else { "_".to_string() } @@ -935,7 +936,7 @@ impl<'a> CodeGenerator<'a> { val, arg_type, AssignmentProperties { - value_type: props.value_type.clone(), + value_type: arg_type.clone(), kind: props.kind, remove_unused: true, full_check: props.full_check, @@ -985,7 +986,7 @@ impl<'a> CodeGenerator<'a> { Pattern::Assign { name, .. } => name.to_string(), Pattern::Discard { name, .. } => { if props.full_check { - format!("__discard_{}", name) + format!("__discard_{}_{}", name, index) } else { "_".to_string() } diff --git a/crates/aiken-lang/src/gen_uplc/tree.rs b/crates/aiken-lang/src/gen_uplc/tree.rs index efceab07..14eb7d18 100644 --- a/crates/aiken-lang/src/gen_uplc/tree.rs +++ b/crates/aiken-lang/src/gen_uplc/tree.rs @@ -834,21 +834,6 @@ impl AirTree { ), void(), vec![ - AirTree::var( - ValueConstructor::public( - void(), - ValueConstructorVariant::ModuleFn { - name: EXPECT_ON_LIST.to_string(), - field_map: None, - module: "".to_string(), - arity: 1, - location: Span::empty(), - builtin: None, - }, - ), - EXPECT_ON_LIST, - "", - ), AirTree::builtin( DefaultFunction::TailList, list(data()),