fix: casting a field type to Data with expect and traces on was assuming the raw Data was of type constr
This commit is contained in:
@@ -1192,6 +1192,8 @@ pub fn unknown_data_to_type_debug(
|
|||||||
.apply(term)
|
.apply(term)
|
||||||
} else if field_type.is_ml_result() {
|
} else if field_type.is_ml_result() {
|
||||||
panic!("ML Result not supported")
|
panic!("ML Result not supported")
|
||||||
|
} else if field_type.is_data() {
|
||||||
|
term
|
||||||
} else {
|
} else {
|
||||||
Term::var("__val")
|
Term::var("__val")
|
||||||
.delayed_choose_data(
|
.delayed_choose_data(
|
||||||
|
|||||||
32
examples/acceptance_tests/099/lib/other.ak
Normal file
32
examples/acceptance_tests/099/lib/other.ak
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
pub type PublicKeyHash =
|
||||||
|
ByteArray
|
||||||
|
|
||||||
|
pub type ByteArrayDataPair {
|
||||||
|
key: ByteArray,
|
||||||
|
value: Data,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type ReferenceDatum {
|
||||||
|
data: List<ByteArrayDataPair>,
|
||||||
|
controller: PublicKeyHash,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn find_data(datas: List<ByteArrayDataPair>, 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
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user