From 7655a6ecbe541086b3b6c82f0ac599819c749dfd Mon Sep 17 00:00:00 2001 From: microproofs Date: Tue, 29 Oct 2024 14:31:55 -0400 Subject: [PATCH] Fix test issues --- crates/aiken-lang/src/gen_uplc.rs | 4 +--- crates/aiken-lang/src/gen_uplc/decision_tree.rs | 12 +++++++++--- ...iken_project__export__tests__recursive_types.snap | 4 ++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/crates/aiken-lang/src/gen_uplc.rs b/crates/aiken-lang/src/gen_uplc.rs index 130940e3..132481d6 100644 --- a/crates/aiken-lang/src/gen_uplc.rs +++ b/crates/aiken-lang/src/gen_uplc.rs @@ -4639,9 +4639,7 @@ impl<'a> CodeGenerator<'a> { .apply(Term::var(subject_name)), }; - condition - .delay_true_if_then_else(body, other_clauses) - .force() + condition.delay_true_if_then_else(body, other_clauses) }; if complex_clause { diff --git a/crates/aiken-lang/src/gen_uplc/decision_tree.rs b/crates/aiken-lang/src/gen_uplc/decision_tree.rs index 16fef8d4..76c3c071 100644 --- a/crates/aiken-lang/src/gen_uplc/decision_tree.rs +++ b/crates/aiken-lang/src/gen_uplc/decision_tree.rs @@ -7,7 +7,7 @@ use itertools::{Itertools, Position}; use crate::{ ast::{DataTypeKey, Pattern, TypedClause, TypedDataType, TypedPattern}, - expr::{lookup_data_type_by_tipo, Type, TypedExpr}, + expr::{lookup_data_type_by_tipo, Type, TypeVar, TypedExpr}, }; use super::{interner::AirInterner, tree::AirTree}; @@ -1041,7 +1041,7 @@ impl<'a, 'b> TreeGen<'a, 'b> { PAIR_NEW_COLUMNS } else if current_tipo.is_tuple() { let Type::Tuple { elems, .. } = current_tipo.as_ref() else { - unreachable!() + unreachable!("{:#?}", current_tipo) }; elems.len() } else if let Some(data) = lookup_data_type_by_tipo(self.data_types, subject_tipo) { @@ -1206,7 +1206,13 @@ pub fn get_tipo_by_path(mut subject_tipo: Rc, mut path: &[Path]) -> Rc match &*tipo.borrow() { + TypeVar::Unbound { .. } | TypeVar::Generic { .. } => subject_tipo.clone(), + TypeVar::Link { tipo } => get_tipo_by_path(tipo.clone(), &[]), + }, + _ => subject_tipo, + } } fn match_wild_card(pattern: &TypedPattern) -> bool { diff --git a/crates/aiken-project/src/snapshots/aiken_project__export__tests__recursive_types.snap b/crates/aiken-project/src/snapshots/aiken_project__export__tests__recursive_types.snap index 1ad945d3..e15b7e66 100644 --- a/crates/aiken-project/src/snapshots/aiken_project__export__tests__recursive_types.snap +++ b/crates/aiken-project/src/snapshots/aiken_project__export__tests__recursive_types.snap @@ -18,8 +18,8 @@ description: "Code:\n\npub type Foo {\n Empty\n Bar(a, Foo)\n}\n\npub fn } } ], - "compiledCode": "5901d501010032323232323222323232323253330083002300937540062a666010600460126ea801052000001001132323232533300b3004300c375400c2646464a66601c600e601e6ea80284c8cdc019b80003375a60260026600c0046026602800260206ea8028010c044c048008dd6980800098069baa006001132533300b3005300c375400c2a666016600860186ea801c4c8cdc01bad3010001330034c103d879800030103011001300d375400e00200226466e00dd698078009980118079808000a60103d8798000300c375400a600200244464646464a66601e601260206ea800854ccc03cc024c040dd50018a4000002002264a66601e601060206ea80084c8c8c94ccc048c02cc04cdd500309919b80337000066eb4c05c004ccc02c02c008c05cc060004c050dd5003002180a980b0011bad301400130113754004002264a66601e601260206ea800854ccc03cc020c040dd500189919b80375a6028002666010010980103d8798000301430150013011375400600200226466e00dd698098009998038039809980a000a60103d8798000301037540026022004602060220026601c0046601c00297ae0370e90011b8748000c024008c020c024004cc018008cc0180052f5c0ae6955ceaab9e5740ae855d101", - "hash": "46254b889c878fb25e55ad7e9eb3d331770a55defec65749c9504581", + "compiledCode": "59017d0101003232323232322232323232325333008300430093754002264a666012600a60146ea800452000132337006eb4c038004cc011300103d8798000300e300f001300b37540026018601a00a264a66601266e1d2002300a37540022646466e00cdc01bad300f002375a601e0026600a601e6020004601e602000260186ea8008c02cdd500109919b80375a601c00266008601c601e002980103d8798000300b37540046018601a00a601600860020024446464a666014600c60166ea80044c94ccc02cc01cc030dd50008a400026466e00dd69808000999803803a60103d879800030103011001300d3754002601c601e004264a66601666e1d2002300c37540022646466e00cdc01bad3011002375a60220026660100106022602400460226024002601c6ea8008c034dd500109919b80375a602000266600e00e60206022002980103d8798000300d3754004601c601e004601a002660160046601600297ae0370e90001980300119803000a5eb815cd2ab9d5573cae815d0aba201", + "hash": "c6af3f04e300cb8c1d0429cc0d8e56a0413eef9fcb338f72076b426c", "definitions": { "Int": { "dataType": "integer"