diff --git a/crates/aiken-lang/src/gen_uplc/builder.rs b/crates/aiken-lang/src/gen_uplc/builder.rs index e0246a15..519ce5fc 100644 --- a/crates/aiken-lang/src/gen_uplc/builder.rs +++ b/crates/aiken-lang/src/gen_uplc/builder.rs @@ -1192,6 +1192,8 @@ pub fn unknown_data_to_type_debug( .apply(term) } else if field_type.is_ml_result() { panic!("ML Result not supported") + } else if field_type.is_data() { + term } else { Term::var("__val") .delayed_choose_data( diff --git a/examples/acceptance_tests/099/lib/other.ak b/examples/acceptance_tests/099/lib/other.ak new file mode 100644 index 00000000..21cf1094 --- /dev/null +++ b/examples/acceptance_tests/099/lib/other.ak @@ -0,0 +1,32 @@ +pub type PublicKeyHash = + ByteArray + +pub type ByteArrayDataPair { + key: ByteArray, + value: Data, +} + +pub type ReferenceDatum { + data: List, + controller: PublicKeyHash, +} + +pub fn find_data(datas: List, key: ByteArray) -> Data { + when datas is { + [] -> fail @"Data Structure Not Found" + [d, ..ds] -> + if d.key == key { + d.value + } else { + find_data(ds, key) + } + } +} + +test thing() { + let stuff: Data = + ReferenceDatum([ByteArrayDataPair("key", "value")], "controller") + + expect other: ReferenceDatum = stuff + other == other +}