Skip to content

Commit

Permalink
chore: add assertion to catch regressions
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAFrench committed Feb 7, 2024
1 parent faed734 commit eec726d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ impl GeneratedAcir {
}
}

pub(crate) fn opcodes(&self) -> &[AcirOpcode] {
&self.opcodes
}

pub(crate) fn take_opcodes(&mut self) -> Vec<AcirOpcode> {
std::mem::take(&mut self.opcodes)
}
Expand Down
6 changes: 5 additions & 1 deletion compiler/noirc_evaluator/src/ssa/acir_gen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,11 @@ impl Context {
}

warnings.extend(self.convert_ssa_return(entry_block.unwrap_terminator(), dfg)?);
Ok(self.acir_context.finish(input_witness, warnings))
let generated_acir = self.acir_context.finish(input_witness, warnings);

assert_eq!(generated_acir.opcodes().len(), 1, "Unconstrained programs should only generate a single opcode but multiple were emitted");

Ok(generated_acir)
}

fn convert_brillig_main(
Expand Down

0 comments on commit eec726d

Please sign in to comment.