From 36a2d026472e305417dba4d7c38b21b8db34d2e6 Mon Sep 17 00:00:00 2001 From: Maddiaa0 <47148561+Maddiaa0@users.noreply.github.com> Date: Wed, 13 Sep 2023 11:00:26 +0000 Subject: [PATCH] fix(aztec_noir): support bools as input types --- compiler/noirc_frontend/src/hir/def_map/aztec_library.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/compiler/noirc_frontend/src/hir/def_map/aztec_library.rs b/compiler/noirc_frontend/src/hir/def_map/aztec_library.rs index ef8c1872f1d..b64ad623c7e 100644 --- a/compiler/noirc_frontend/src/hir/def_map/aztec_library.rs +++ b/compiler/noirc_frontend/src/hir/def_map/aztec_library.rs @@ -327,7 +327,9 @@ fn create_context(ty: &str, params: &[(Pattern, UnresolvedType, Visibility)]) -> UnresolvedTypeData::FieldElement => add_field_to_hasher(identifier), // Add the integer to the hasher, casted to a field // `hasher.add({ident} as Field)` - UnresolvedTypeData::Integer(..) => add_int_to_hasher(identifier), + UnresolvedTypeData::Integer(..) | UnresolvedTypeData::Bool => { + add_cast_to_hasher(identifier) + } _ => unreachable!("[Aztec Noir] Provided parameter type is not supported"), }; injected_expressions.push(expression); @@ -613,7 +615,7 @@ fn add_field_to_hasher(identifier: &Ident) -> Statement { )) } -fn add_int_to_hasher(identifier: &Ident) -> Statement { +fn add_cast_to_hasher(identifier: &Ident) -> Statement { // `hasher.add({ident} as Field)` // `{ident} as Field` let cast_operation = cast(