Skip to content

Commit

Permalink
fix(ssa refactor): Fix recursive call to create_value_from_type (#1815
Browse files Browse the repository at this point in the history
)

Fix 'missing assignment for witness index' error
  • Loading branch information
jfecher authored Jun 23, 2023
1 parent d0110e2 commit 890a63b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions crates/noirc_evaluator/src/ssa_refactor/acir_gen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,13 @@ impl Context {
}

fn convert_ssa_block_param(&mut self, param_type: &Type) -> AcirValue {
self.create_value_from_type(param_type, |this, typ| this.add_numeric_input_var(&typ))
self.create_value_from_type(param_type, &mut |this, typ| this.add_numeric_input_var(&typ))
}

fn create_value_from_type(
&mut self,
param_type: &Type,
mut make_var: impl FnMut(&mut Self, NumericType) -> AcirVar,
make_var: &mut impl FnMut(&mut Self, NumericType) -> AcirVar,
) -> AcirValue {
match param_type {
Type::Numeric(numeric_type) => {
Expand All @@ -149,7 +149,7 @@ impl Context {

for _ in 0..*length {
for element in element_types.iter() {
elements.push_back(self.convert_ssa_block_param(element));
elements.push_back(self.create_value_from_type(element, make_var));
}
}

Expand Down Expand Up @@ -731,7 +731,7 @@ impl Context {

/// Creates a default, meaningless value meant only to be a valid value of the given type.
fn create_default_value(&mut self, param_type: &Type) -> AcirValue {
self.create_value_from_type(param_type, |this, _| {
self.create_value_from_type(param_type, &mut |this, _| {
this.acir_context.add_constant(FieldElement::zero())
})
}
Expand Down

0 comments on commit 890a63b

Please sign in to comment.