Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(aztec_noir): support bools as input types #2674

Merged
merged 1 commit into from
Sep 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions compiler/noirc_frontend/src/hir/def_map/aztec_library.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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(
Expand Down