fix: switch from unwrap to if let to allow boolean when
fix: test 67 fixed to take in ByteArray instead of string literal
This commit is contained in:
parent
2394438a91
commit
70164282f8
|
@ -756,16 +756,29 @@ impl<'a> CodeGenerator<'a> {
|
||||||
scope.clone(),
|
scope.clone(),
|
||||||
);
|
);
|
||||||
|
|
||||||
let data_type =
|
let data_type = lookup_data_type_by_tipo(self.data_types.clone(), subject_type);
|
||||||
lookup_data_type_by_tipo(self.data_types.clone(), subject_type).unwrap();
|
|
||||||
|
|
||||||
if data_type.constructors.len() > 1 {
|
if let Some(data_type) = data_type {
|
||||||
ir_stack.push(Air::Clause {
|
if data_type.constructors.len() > 1 {
|
||||||
scope,
|
ir_stack.push(Air::Clause {
|
||||||
tipo: subject_type.clone(),
|
scope,
|
||||||
complex_clause: *clause_properties.is_complex_clause(),
|
tipo: subject_type.clone(),
|
||||||
subject_name,
|
complex_clause: *clause_properties.is_complex_clause(),
|
||||||
});
|
subject_name,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
ir_stack.push(Air::Clause {
|
||||||
|
scope: scope.clone(),
|
||||||
|
tipo: subject_type.clone(),
|
||||||
|
complex_clause: *clause_properties.is_complex_clause(),
|
||||||
|
subject_name,
|
||||||
|
});
|
||||||
|
|
||||||
|
ir_stack.push(Air::Int {
|
||||||
|
scope,
|
||||||
|
value: "0".to_string(),
|
||||||
|
});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ir_stack.push(Air::Clause {
|
ir_stack.push(Air::Clause {
|
||||||
scope: scope.clone(),
|
scope: scope.clone(),
|
||||||
|
@ -773,11 +786,6 @@ impl<'a> CodeGenerator<'a> {
|
||||||
complex_clause: *clause_properties.is_complex_clause(),
|
complex_clause: *clause_properties.is_complex_clause(),
|
||||||
subject_name,
|
subject_name,
|
||||||
});
|
});
|
||||||
|
|
||||||
ir_stack.push(Air::Int {
|
|
||||||
scope,
|
|
||||||
value: "0".to_string(),
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ClauseProperties::ListClause {
|
ClauseProperties::ListClause {
|
||||||
|
|
|
@ -3,11 +3,11 @@
|
||||||
|
|
||||||
[[requirements]]
|
[[requirements]]
|
||||||
name = "aiken-lang/stdlib"
|
name = "aiken-lang/stdlib"
|
||||||
version = "3b47c89006e7580c2213370d7426ed2a38d2836e"
|
version = "main"
|
||||||
source = "github"
|
source = "github"
|
||||||
|
|
||||||
[[packages]]
|
[[packages]]
|
||||||
name = "aiken-lang/stdlib"
|
name = "aiken-lang/stdlib"
|
||||||
version = "3b47c89006e7580c2213370d7426ed2a38d2836e"
|
version = "main"
|
||||||
requirements = []
|
requirements = []
|
||||||
source = "github"
|
source = "github"
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
name = "aiken-lang/acceptance_test_067"
|
name = "aiken-lang/acceptance_test_067"
|
||||||
version = "0.0.0"
|
version = '0.0.0'
|
||||||
|
description = ''
|
||||||
|
|
||||||
dependencies = [
|
[[dependencies]]
|
||||||
{ name = "aiken-lang/stdlib", version = "3b47c89006e7580c2213370d7426ed2a38d2836e", source = "github" },
|
name = 'aiken-lang/stdlib'
|
||||||
]
|
version = 'main'
|
||||||
|
source = 'github'
|
||||||
|
|
|
@ -54,7 +54,7 @@ test to_list_1() {
|
||||||
// Function returning a hash of a given Merkle Tree element
|
// Function returning a hash of a given Merkle Tree element
|
||||||
pub fn root_hash(self: MerkleTree<a>) -> Hash<Sha2_256, ByteArray> {
|
pub fn root_hash(self: MerkleTree<a>) -> Hash<Sha2_256, ByteArray> {
|
||||||
when self is {
|
when self is {
|
||||||
Empty -> #""
|
Empty -> ""
|
||||||
Leaf { hash, .. } -> hash
|
Leaf { hash, .. } -> hash
|
||||||
Node { hash, .. } -> hash
|
Node { hash, .. } -> hash
|
||||||
}
|
}
|
||||||
|
@ -579,6 +579,6 @@ fn get_proof_item_value(proof_item: ProofItem) -> Hash<Sha2_256, ByteArray> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_string_item_hash_fn() -> fn(String) -> Hash<Sha2_256, String> {
|
fn create_string_item_hash_fn() -> fn(ByteArray) -> Hash<Sha2_256, String> {
|
||||||
fn(x: String) { sha2_256(from_string(x)) }
|
fn(x: ByteArray) { sha2_256(x) }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue