diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 710e88b34df..1fb1def7ce1 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -7,7 +7,9 @@ "jnoortheen.nix-ide", "rust-lang.rust-analyzer", "redhat.vscode-yaml", - "esbenp.prettier-vscode" + "esbenp.prettier-vscode", + // Spell checking + "streetsidesoftware.code-spell-checker", ], // List of extensions recommended by VS Code that should not be recommended for users of this workspace. "unwantedRecommendations": [] diff --git a/acvm-repo/acvm_js/src/execute.rs b/acvm-repo/acvm_js/src/execute.rs index eff9dcf8c25..ebbfc4297c3 100644 --- a/acvm-repo/acvm_js/src/execute.rs +++ b/acvm-repo/acvm_js/src/execute.rs @@ -1,5 +1,5 @@ use acvm::{ - acir::circuit::{Circuit, OpcodeLocation}, + acir::circuit::Circuit, pwg::{ACVMStatus, ErrorLocation, OpcodeResolutionError, ACVM}, }; #[allow(deprecated)] @@ -84,17 +84,13 @@ pub async fn execute_circuit_with_black_box_solver( | OpcodeResolutionError::IndexOutOfBounds { opcode_location: ErrorLocation::Resolved(opcode_location), .. - } => ( - get_assert_message(&circuit.assert_messages, opcode_location), - Some(vec![*opcode_location]), - ), + } => { + (circuit.get_assert_message(*opcode_location), Some(vec![*opcode_location])) + } OpcodeResolutionError::BrilligFunctionFailed { call_stack, .. } => { let failing_opcode = call_stack.last().expect("Brillig error call stacks cannot be empty"); - ( - get_assert_message(&circuit.assert_messages, failing_opcode), - Some(call_stack.clone()), - ) + (circuit.get_assert_message(*failing_opcode), Some(call_stack.clone())) } _ => (None, None), }; @@ -117,15 +113,3 @@ pub async fn execute_circuit_with_black_box_solver( let witness_map = acvm.finalize(); Ok(witness_map.into()) } - -// Searches the slice for `opcode_location`. -// This is functionality equivalent to .get on a map. -fn get_assert_message( - assert_messages: &[(OpcodeLocation, String)], - opcode_location: &OpcodeLocation, -) -> Option { - assert_messages - .iter() - .find(|(loc, _)| loc == opcode_location) - .map(|(_, message)| message.clone()) -} diff --git a/compiler/noirc_evaluator/src/ssa/acir_gen/acir_ir/acir_variable.rs b/compiler/noirc_evaluator/src/ssa/acir_gen/acir_ir/acir_variable.rs index 7f04105e05f..5b49795ca41 100644 --- a/compiler/noirc_evaluator/src/ssa/acir_gen/acir_ir/acir_variable.rs +++ b/compiler/noirc_evaluator/src/ssa/acir_gen/acir_ir/acir_variable.rs @@ -96,6 +96,8 @@ pub(crate) struct AcirContext { /// The vars object is an instance of the `TwoWayMap`, which provides a bidirectional mapping between `AcirVar` and `AcirVarData`. vars: HashMap, + constant_witnesses: HashMap, + /// An in-memory representation of ACIR. /// /// This struct will progressively be populated @@ -227,7 +229,16 @@ impl AcirContext { /// Converts an [`AcirVar`] to a [`Witness`] fn var_to_witness(&mut self, var: AcirVar) -> Result { let expression = self.var_to_expression(var)?; - Ok(self.acir_ir.get_or_create_witness(&expression)) + let witness = if let Some(constant) = expression.to_const() { + // Check if a witness has been assigned this value already, if so reuse it. + *self + .constant_witnesses + .entry(constant) + .or_insert_with(|| self.acir_ir.get_or_create_witness(&expression)) + } else { + self.acir_ir.get_or_create_witness(&expression) + }; + Ok(witness) } /// Converts an [`AcirVar`] to an [`Expression`] @@ -487,11 +498,11 @@ impl AcirContext { | (AcirVarData::Const(constant), AcirVarData::Witness(witness)) => { let mut expr = Expression::default(); expr.push_addition_term(constant, witness); - self.add_data(AcirVarData::Expr(expr)) + self.add_data(AcirVarData::from(expr)) } (AcirVarData::Const(constant), AcirVarData::Expr(expr)) | (AcirVarData::Expr(expr), AcirVarData::Const(constant)) => { - self.add_data(AcirVarData::Expr(&expr * constant)) + self.add_data(AcirVarData::from(&expr * constant)) } (AcirVarData::Witness(lhs_witness), AcirVarData::Witness(rhs_witness)) => { let mut expr = Expression::default(); diff --git a/compiler/noirc_evaluator/src/ssa/acir_gen/acir_ir/generated_acir.rs b/compiler/noirc_evaluator/src/ssa/acir_gen/acir_ir/generated_acir.rs index aae9ed97006..ca60a41d143 100644 --- a/compiler/noirc_evaluator/src/ssa/acir_gen/acir_ir/generated_acir.rs +++ b/compiler/noirc_evaluator/src/ssa/acir_gen/acir_ir/generated_acir.rs @@ -440,9 +440,30 @@ impl GeneratedAcir { // // When the predicate is 0, the equation always passes. // When the predicate is 1, the rhs must not be 0. - let rhs_is_zero = self.is_zero(rhs); - let rhs_is_not_zero = self.mul_with_witness(&rhs_is_zero.into(), predicate); - self.assert_is_zero(rhs_is_not_zero); + let rhs_is_nonzero_const = rhs.is_const() && !rhs.is_zero(); + if !rhs_is_nonzero_const { + match predicate.to_const() { + Some(predicate) if predicate.is_zero() => { + // If predicate is known to be inactive, we don't need to lay down constraints. + } + + Some(predicate) if predicate.is_one() => { + // If the predicate is known to be active, we simply assert that an inverse must exist. + // This implies that `rhs != 0`. + let unsafe_inverse = self.brillig_inverse(rhs.clone()); + let rhs_has_inverse = + self.mul_with_witness(rhs, &unsafe_inverse.into()) - FieldElement::one(); + self.assert_is_zero(rhs_has_inverse); + } + + _ => { + // Otherwise we must handle both potential cases. + let rhs_is_zero = self.is_zero(rhs); + let rhs_is_not_zero = self.mul_with_witness(&rhs_is_zero.into(), predicate); + self.assert_is_zero(rhs_is_not_zero); + } + } + } // maximum bit size for q and for [r and rhs] let mut max_q_bits = max_bit_size; diff --git a/compiler/noirc_evaluator/src/ssa/ir/instruction.rs b/compiler/noirc_evaluator/src/ssa/ir/instruction.rs index f748aa040a1..badc1e82d50 100644 --- a/compiler/noirc_evaluator/src/ssa/ir/instruction.rs +++ b/compiler/noirc_evaluator/src/ssa/ir/instruction.rs @@ -239,10 +239,19 @@ impl Instruction { pub(crate) fn has_side_effects(&self, dfg: &DataFlowGraph) -> bool { use Instruction::*; - match self { - Binary(_) - | Cast(_, _) + Binary(binary) => { + if matches!(binary.operator, BinaryOp::Div | BinaryOp::Mod) { + if let Some(rhs) = dfg.get_numeric_constant(binary.rhs) { + rhs == FieldElement::zero() + } else { + true + } + } else { + false + } + } + Cast(_, _) | Not(_) | Truncate { .. } | Allocate diff --git a/compiler/noirc_evaluator/src/ssa/ssa_gen/context.rs b/compiler/noirc_evaluator/src/ssa/ssa_gen/context.rs index f7e2d7df935..d1031c98558 100644 --- a/compiler/noirc_evaluator/src/ssa/ssa_gen/context.rs +++ b/compiler/noirc_evaluator/src/ssa/ssa_gen/context.rs @@ -774,7 +774,15 @@ fn operator_result_max_bit_size_to_truncate( match op { Add => Some(std::cmp::max(lhs_bit_size, rhs_bit_size) + 1), Subtract => Some(std::cmp::max(lhs_bit_size, rhs_bit_size) + 1), - Multiply => Some(lhs_bit_size + rhs_bit_size), + Multiply => { + if lhs_bit_size == 1 || rhs_bit_size == 1 { + // Truncation is unnecessary as multiplication by a boolean value cannot cause an overflow. + None + } else { + Some(lhs_bit_size + rhs_bit_size) + } + } + ShiftLeft => { if let Some(rhs_constant) = dfg.get_numeric_constant(rhs) { // Happy case is that we know precisely by how many bits the the integer will diff --git a/compiler/noirc_frontend/src/ast/expression.rs b/compiler/noirc_frontend/src/ast/expression.rs index d1d71112de0..f8c67781a49 100644 --- a/compiler/noirc_frontend/src/ast/expression.rs +++ b/compiler/noirc_frontend/src/ast/expression.rs @@ -26,6 +26,7 @@ pub enum ExpressionKind { Variable(Path), Tuple(Vec), Lambda(Box), + Parenthesized(Box), Error, } @@ -479,6 +480,7 @@ impl Display for ExpressionKind { write!(f, "({})", elements.join(", ")) } Lambda(lambda) => lambda.fmt(f), + Parenthesized(subexpr) => write!(f, "({subexpr})"), Error => write!(f, "Error"), } } diff --git a/compiler/noirc_frontend/src/hir/def_collector/dc_crate.rs b/compiler/noirc_frontend/src/hir/def_collector/dc_crate.rs index 86cdd936b0d..13610b8ff47 100644 --- a/compiler/noirc_frontend/src/hir/def_collector/dc_crate.rs +++ b/compiler/noirc_frontend/src/hir/def_collector/dc_crate.rs @@ -499,17 +499,18 @@ fn add_method_to_struct_namespace( struct_type: &Shared, func_id: FuncId, name_ident: &Ident, + trait_id: TraitId, ) -> Result<(), DefCollectorErrorKind> { let struct_type = struct_type.borrow(); let type_module = struct_type.id.local_module_id(); let module = &mut current_def_map.modules[type_module.0]; - module.declare_function(name_ident.clone(), func_id).map_err(|(first_def, second_def)| { - DefCollectorErrorKind::Duplicate { + module.declare_trait_function(name_ident.clone(), func_id, trait_id).map_err( + |(first_def, second_def)| DefCollectorErrorKind::Duplicate { typ: DuplicateType::TraitImplementation, first_def, second_def, - } - }) + }, + ) } fn collect_trait_impl( @@ -550,6 +551,7 @@ fn collect_trait_impl( struct_type, *func_id, ast.name_ident(), + trait_id, ) { Ok(()) => {} Err(err) => { diff --git a/compiler/noirc_frontend/src/hir/def_map/item_scope.rs b/compiler/noirc_frontend/src/hir/def_map/item_scope.rs index 78375ab2bc0..42cca550651 100644 --- a/compiler/noirc_frontend/src/hir/def_map/item_scope.rs +++ b/compiler/noirc_frontend/src/hir/def_map/item_scope.rs @@ -1,5 +1,8 @@ use super::{namespace::PerNs, ModuleDefId, ModuleId}; -use crate::{node_interner::FuncId, Ident}; +use crate::{ + node_interner::{FuncId, TraitId}, + Ident, +}; use std::collections::{hash_map::Entry, HashMap}; #[derive(Debug, PartialEq, Eq, Copy, Clone)] @@ -9,8 +12,8 @@ pub enum Visibility { #[derive(Default, Debug, PartialEq, Eq)] pub struct ItemScope { - types: HashMap, - values: HashMap, + types: HashMap, (ModuleDefId, Visibility)>>, + values: HashMap, (ModuleDefId, Visibility)>>, defs: Vec, } @@ -20,8 +23,9 @@ impl ItemScope { &mut self, name: Ident, mod_def: ModuleDefId, + trait_id: Option, ) -> Result<(), (Ident, Ident)> { - self.add_item_to_namespace(name, mod_def)?; + self.add_item_to_namespace(name, mod_def, trait_id)?; self.defs.push(mod_def); Ok(()) } @@ -33,16 +37,26 @@ impl ItemScope { &mut self, name: Ident, mod_def: ModuleDefId, + trait_id: Option, ) -> Result<(), (Ident, Ident)> { - let add_item = |map: &mut HashMap| { - if let Entry::Occupied(o) = map.entry(name.clone()) { - let old_ident = o.key(); - Err((old_ident.clone(), name)) - } else { - map.insert(name, (mod_def, Visibility::Public)); - Ok(()) - } - }; + let add_item = + |map: &mut HashMap, (ModuleDefId, Visibility)>>| { + if let Entry::Occupied(mut o) = map.entry(name.clone()) { + let trait_hashmap = o.get_mut(); + if let Entry::Occupied(_) = trait_hashmap.entry(trait_id) { + let old_ident = o.key(); + Err((old_ident.clone(), name)) + } else { + trait_hashmap.insert(trait_id, (mod_def, Visibility::Public)); + Ok(()) + } + } else { + let mut trait_hashmap = HashMap::new(); + trait_hashmap.insert(trait_id, (mod_def, Visibility::Public)); + map.insert(name, trait_hashmap); + Ok(()) + } + }; match mod_def { ModuleDefId::ModuleId(_) => add_item(&mut self.types), @@ -55,7 +69,7 @@ impl ItemScope { } pub fn find_module_with_name(&self, mod_name: &Ident) -> Option<&ModuleId> { - let (module_def, _) = self.types.get(mod_name)?; + let (module_def, _) = self.types.get(mod_name)?.get(&None)?; match module_def { ModuleDefId::ModuleId(id) => Some(id), _ => None, @@ -63,7 +77,35 @@ impl ItemScope { } pub fn find_func_with_name(&self, func_name: &Ident) -> Option { - let (module_def, _) = self.values.get(func_name)?; + let trait_hashmap = self.values.get(func_name)?; + // methods introduced without trait take priority and hide methods with the same name that come from a trait + let a = trait_hashmap.get(&None); + match a { + Some((module_def, _)) => match module_def { + ModuleDefId::FunctionId(id) => Some(*id), + _ => None, + }, + None => { + if trait_hashmap.len() == 1 { + let (module_def, _) = trait_hashmap.get(trait_hashmap.keys().last()?)?; + match module_def { + ModuleDefId::FunctionId(id) => Some(*id), + _ => None, + } + } else { + // ambiguous name (multiple traits, containing the same function name) + None + } + } + } + } + + pub fn find_func_with_name_and_trait_id( + &self, + func_name: &Ident, + trait_id: &Option, + ) -> Option { + let (module_def, _) = self.values.get(func_name)?.get(trait_id)?; match module_def { ModuleDefId::FunctionId(id) => Some(*id), _ => None, @@ -71,18 +113,46 @@ impl ItemScope { } pub fn find_name(&self, name: &Ident) -> PerNs { - PerNs { types: self.types.get(name).cloned(), values: self.values.get(name).cloned() } + // Names, not associated with traits are searched first. If not found, we search for name, coming from a trait. + // If we find only one name from trait, we return it. If there are multiple traits, providing the same name, we return None. + let find_name_in = + |a: &HashMap, (ModuleDefId, Visibility)>>| { + if let Some(t) = a.get(name) { + if let Some(tt) = t.get(&None) { + Some(*tt) + } else if t.len() == 1 { + t.values().last().cloned() + } else { + None + } + } else { + None + } + }; + + PerNs { types: find_name_in(&self.types), values: find_name_in(&self.values) } + } + + pub fn find_name_for_trait_id(&self, name: &Ident, trait_id: &Option) -> PerNs { + PerNs { + types: if let Some(t) = self.types.get(name) { t.get(trait_id).cloned() } else { None }, + values: if let Some(v) = self.values.get(name) { + v.get(trait_id).cloned() + } else { + None + }, + } } pub fn definitions(&self) -> Vec { self.defs.clone() } - pub fn types(&self) -> &HashMap { + pub fn types(&self) -> &HashMap, (ModuleDefId, Visibility)>> { &self.types } - pub fn values(&self) -> &HashMap { + pub fn values(&self) -> &HashMap, (ModuleDefId, Visibility)>> { &self.values } diff --git a/compiler/noirc_frontend/src/hir/def_map/module_data.rs b/compiler/noirc_frontend/src/hir/def_map/module_data.rs index 5528312c0fc..29b11e92c01 100644 --- a/compiler/noirc_frontend/src/hir/def_map/module_data.rs +++ b/compiler/noirc_frontend/src/hir/def_map/module_data.rs @@ -41,16 +41,30 @@ impl ModuleData { } } - fn declare(&mut self, name: Ident, item_id: ModuleDefId) -> Result<(), (Ident, Ident)> { - self.scope.add_definition(name.clone(), item_id)?; + fn declare( + &mut self, + name: Ident, + item_id: ModuleDefId, + trait_id: Option, + ) -> Result<(), (Ident, Ident)> { + self.scope.add_definition(name.clone(), item_id, trait_id)?; // definitions is a subset of self.scope so it is expected if self.scope.define_func_def // returns without error, so will self.definitions.define_func_def. - self.definitions.add_definition(name, item_id) + self.definitions.add_definition(name, item_id, trait_id) } pub fn declare_function(&mut self, name: Ident, id: FuncId) -> Result<(), (Ident, Ident)> { - self.declare(name, id.into()) + self.declare(name, id.into(), None) + } + + pub fn declare_trait_function( + &mut self, + name: Ident, + id: FuncId, + trait_id: TraitId, + ) -> Result<(), (Ident, Ident)> { + self.declare(name, id.into(), Some(trait_id)) } pub fn remove_function(&mut self, name: &Ident) { @@ -59,11 +73,11 @@ impl ModuleData { } pub fn declare_global(&mut self, name: Ident, id: StmtId) -> Result<(), (Ident, Ident)> { - self.declare(name, id.into()) + self.declare(name, id.into(), None) } pub fn declare_struct(&mut self, name: Ident, id: StructId) -> Result<(), (Ident, Ident)> { - self.declare(name, ModuleDefId::TypeId(id)) + self.declare(name, ModuleDefId::TypeId(id), None) } pub fn declare_type_alias( @@ -71,11 +85,11 @@ impl ModuleData { name: Ident, id: TypeAliasId, ) -> Result<(), (Ident, Ident)> { - self.declare(name, id.into()) + self.declare(name, id.into(), None) } pub fn declare_trait(&mut self, name: Ident, id: TraitId) -> Result<(), (Ident, Ident)> { - self.declare(name, ModuleDefId::TraitId(id)) + self.declare(name, ModuleDefId::TraitId(id), None) } pub fn declare_child_module( @@ -83,7 +97,7 @@ impl ModuleData { name: Ident, child_id: ModuleId, ) -> Result<(), (Ident, Ident)> { - self.declare(name, child_id.into()) + self.declare(name, child_id.into(), None) } pub fn find_func_with_name(&self, name: &Ident) -> Option { @@ -91,7 +105,7 @@ impl ModuleData { } pub fn import(&mut self, name: Ident, id: ModuleDefId) -> Result<(), (Ident, Ident)> { - self.scope.add_item_to_namespace(name, id) + self.scope.add_item_to_namespace(name, id, None) } pub fn find_name(&self, name: &Ident) -> PerNs { @@ -99,12 +113,12 @@ impl ModuleData { } pub fn type_definitions(&self) -> impl Iterator + '_ { - self.definitions.types().values().map(|(id, _)| *id) + self.definitions.types().values().flat_map(|a| a.values().map(|(id, _)| *id)) } /// Return an iterator over all definitions defined within this module, /// excluding any type definitions. pub fn value_definitions(&self) -> impl Iterator + '_ { - self.definitions.values().values().map(|(id, _)| *id) + self.definitions.values().values().flat_map(|a| a.values().map(|(id, _)| *id)) } } diff --git a/compiler/noirc_frontend/src/hir/resolution/resolver.rs b/compiler/noirc_frontend/src/hir/resolution/resolver.rs index 60a12ad601d..97c71eedf4e 100644 --- a/compiler/noirc_frontend/src/hir/resolution/resolver.rs +++ b/compiler/noirc_frontend/src/hir/resolution/resolver.rs @@ -1260,6 +1260,7 @@ impl<'a> Resolver<'a> { captures: lambda_context.captures, }) }), + ExpressionKind::Parenthesized(subexpr) => return self.resolve_expression(*subexpr), }; let expr_id = self.interner.push_expr(hir_expr); diff --git a/compiler/noirc_frontend/src/lexer/lexer.rs b/compiler/noirc_frontend/src/lexer/lexer.rs index 0b8922efce6..593c5bdfb05 100644 --- a/compiler/noirc_frontend/src/lexer/lexer.rs +++ b/compiler/noirc_frontend/src/lexer/lexer.rs @@ -19,6 +19,7 @@ pub struct Lexer<'a> { char_iter: Peekable, RangeFrom>>, position: Position, done: bool, + skip_comments: bool, } pub type SpannedTokenResult = Result; @@ -39,15 +40,21 @@ impl<'a> Lexer<'a> { (Tokens(tokens), errors) } - fn new(source: &'a str) -> Self { + pub fn new(source: &'a str) -> Self { Lexer { // We zip with the character index here to ensure the first char has index 0 char_iter: source.chars().zip(0..).peekable(), position: 0, done: false, + skip_comments: true, } } + pub fn skip_comments(mut self, flag: bool) -> Self { + self.skip_comments = flag; + self + } + /// Iterates the cursor and returns the char at the new cursor position fn next_char(&mut self) -> Option { let (c, index) = self.char_iter.next()?; @@ -176,13 +183,16 @@ impl<'a> Lexer<'a> { Token::Minus => self.single_double_peek_token('>', prev_token, Token::Arrow), Token::Colon => self.single_double_peek_token(':', prev_token, Token::DoubleColon), Token::Slash => { + let start = self.position; + if self.peek_char_is('/') { self.next_char(); - return self.parse_comment(); + return self.parse_comment(start); } else if self.peek_char_is('*') { self.next_char(); - return self.parse_block_comment(); + return self.parse_block_comment(start); } + Ok(spanned_prev_token) } _ => Err(LexerErrorKind::NotADoubleChar { @@ -377,15 +387,18 @@ impl<'a> Lexer<'a> { } } - fn parse_comment(&mut self) -> SpannedTokenResult { - let _ = self.eat_while(None, |ch| ch != '\n'); - self.next_token() + fn parse_comment(&mut self, start: u32) -> SpannedTokenResult { + let comment = self.eat_while(None, |ch| ch != '\n'); + if self.skip_comments { + return self.next_token(); + } + Ok(Token::LineComment(comment).into_span(start, self.position)) } - fn parse_block_comment(&mut self) -> SpannedTokenResult { - let start = self.position; + fn parse_block_comment(&mut self, start: u32) -> SpannedTokenResult { let mut depth = 1usize; + let mut content = String::new(); while let Some(ch) = self.next_char() { match ch { '/' if self.peek_char_is('*') => { @@ -403,12 +416,15 @@ impl<'a> Lexer<'a> { break; } } - _ => {} + ch => content.push(ch), } } if depth == 0 { - self.next_token() + if self.skip_comments { + return self.next_token(); + } + Ok(Token::BlockComment(content).into_span(start, self.position)) } else { let span = Span::inclusive(start, self.position); Err(LexerErrorKind::UnterminatedBlockComment { span }) @@ -431,7 +447,6 @@ impl<'a> Iterator for Lexer<'a> { } } } - #[cfg(test)] mod tests { use super::*; @@ -497,7 +512,7 @@ mod tests { let input = r#"#[deprecated]"#; let mut lexer = Lexer::new(input); - let token = lexer.next().unwrap().unwrap(); + let token = lexer.next_token().unwrap(); assert_eq!( token.token(), &Token::Attribute(Attribute::Secondary(SecondaryAttribute::Deprecated(None))) @@ -509,7 +524,7 @@ mod tests { let input = r#"#[deprecated("hello")]"#; let mut lexer = Lexer::new(input); - let token = lexer.next().unwrap().unwrap(); + let token = lexer.next_token().unwrap(); assert_eq!( token.token(), &Token::Attribute(Attribute::Secondary(crate::token::SecondaryAttribute::Deprecated( @@ -542,7 +557,7 @@ mod tests { let input = r#"#[custom(hello)]"#; let mut lexer = Lexer::new(input); - let token = lexer.next().unwrap().unwrap(); + let token = lexer.next_token().unwrap(); assert_eq!( token.token(), &Token::Attribute(Attribute::Secondary(SecondaryAttribute::Custom( @@ -556,7 +571,7 @@ mod tests { let input = r#"#[test]"#; let mut lexer = Lexer::new(input); - let token = lexer.next().unwrap().unwrap(); + let token = lexer.next_token().unwrap(); assert_eq!( token.token(), &Token::Attribute(Attribute::Function(FunctionAttribute::Test(TestScope::None))) @@ -568,7 +583,7 @@ mod tests { let input = r#"#[contract_library_method]"#; let mut lexer = Lexer::new(input); - let token = lexer.next().unwrap().unwrap(); + let token = lexer.next_token().unwrap(); assert_eq!( token.token(), &Token::Attribute(Attribute::Secondary(SecondaryAttribute::ContractLibraryMethod)) @@ -580,7 +595,7 @@ mod tests { let input = r#"#[test(should_fail)]"#; let mut lexer = Lexer::new(input); - let token = lexer.next().unwrap().unwrap(); + let token = lexer.next_token().unwrap(); assert_eq!( token.token(), &Token::Attribute(Attribute::Function(FunctionAttribute::Test( @@ -594,7 +609,7 @@ mod tests { let input = r#"#[test(should_fail_with = "hello")]"#; let mut lexer = Lexer::new(input); - let token = lexer.next().unwrap().unwrap(); + let token = lexer.next_token().unwrap(); assert_eq!( token.token(), &Token::Attribute(Attribute::Function(FunctionAttribute::Test( diff --git a/compiler/noirc_frontend/src/lexer/token.rs b/compiler/noirc_frontend/src/lexer/token.rs index 2ad2f3902b1..8b2acb5b28e 100644 --- a/compiler/noirc_frontend/src/lexer/token.rs +++ b/compiler/noirc_frontend/src/lexer/token.rs @@ -19,6 +19,8 @@ pub enum Token { Keyword(Keyword), IntType(IntType), Attribute(Attribute), + LineComment(String), + BlockComment(String), /// < Less, /// <= @@ -149,6 +151,8 @@ impl fmt::Display for Token { Token::FmtStr(ref b) => write!(f, "f{b}"), Token::Keyword(k) => write!(f, "{k}"), Token::Attribute(ref a) => write!(f, "{a}"), + Token::LineComment(ref s) => write!(f, "//{s}"), + Token::BlockComment(ref s) => write!(f, "/*{s}*/"), Token::IntType(ref i) => write!(f, "{i}"), Token::Less => write!(f, "<"), Token::LessEqual => write!(f, "<="), diff --git a/compiler/noirc_frontend/src/parser/parser.rs b/compiler/noirc_frontend/src/parser/parser.rs index 2da17c997c1..083646ceab0 100644 --- a/compiler/noirc_frontend/src/parser/parser.rs +++ b/compiler/noirc_frontend/src/parser/parser.rs @@ -1554,7 +1554,9 @@ where literal(), )) .map_with_span(Expression::new) - .or(parenthesized(expr_parser.clone())) + .or(parenthesized(expr_parser.clone()).map_with_span(|subexpr, span| { + Expression::new(ExpressionKind::Parenthesized(subexpr.into()), span) + })) .or(tuple(expr_parser)) .labelled(ParsingRuleLabel::Atom) } diff --git a/deny.toml b/deny.toml index 5d5b0e34d0f..e19406592d8 100644 --- a/deny.toml +++ b/deny.toml @@ -58,6 +58,8 @@ allow = [ "LicenseRef-rustls-webpki", # bitmaps 2.1.0, generational-arena 0.2.9,im 15.1.0 "MPL-2.0", + # Boost Software License + "BSL-1.0" ] # Allow 1 or more licenses on a per-crate basis, so that particular licenses diff --git a/tooling/nargo/src/ops/execute.rs b/tooling/nargo/src/ops/execute.rs index 5fd130c9412..cf14934d61e 100644 --- a/tooling/nargo/src/ops/execute.rs +++ b/tooling/nargo/src/ops/execute.rs @@ -15,15 +15,6 @@ pub fn execute_circuit( ) -> Result { let mut acvm = ACVM::new(blackbox_solver, &circuit.opcodes, initial_witness); - // Assert messages are not a map due to https://github.com/noir-lang/acvm/issues/522 - let get_assert_message = |opcode_location| { - circuit - .assert_messages - .iter() - .find(|(loc, _)| loc == opcode_location) - .map(|(_, message)| message.clone()) - }; - let mut foreign_call_executor = ForeignCallExecutor::default(); loop { @@ -47,10 +38,10 @@ pub fn execute_circuit( return Err(NargoError::ExecutionError(match call_stack { Some(call_stack) => { - if let Some(assert_message) = get_assert_message( - call_stack.last().expect("Call stacks should not be empty"), + if let Some(assert_message) = circuit.get_assert_message( + *call_stack.last().expect("Call stacks should not be empty"), ) { - ExecutionError::AssertionFailed(assert_message, call_stack) + ExecutionError::AssertionFailed(assert_message.to_owned(), call_stack) } else { ExecutionError::SolvingError(error) } diff --git a/tooling/nargo_cli/tests/acir_artifacts/1327_concrete_in_generic/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/1327_concrete_in_generic/target/acir.gz index 16cefef0bc3..cc92863a4a8 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/1327_concrete_in_generic/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/1327_concrete_in_generic/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/1_mul/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/1_mul/target/acir.gz index 50a2be61dac..1c28b75f74e 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/1_mul/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/1_mul/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/1_mul/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/1_mul/target/witness.gz index ffbbbd8a483..f01447653fa 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/1_mul/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/1_mul/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/2_div/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/2_div/target/acir.gz index dbe4de9485a..42caed06578 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/2_div/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/2_div/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/2_div/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/2_div/target/witness.gz index fe5aad35bfc..d8733d8606e 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/2_div/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/2_div/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/3_add/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/3_add/target/acir.gz index e9d898ebfaa..cef79cbc46c 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/3_add/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/3_add/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/3_add/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/3_add/target/witness.gz index d871f412010..f44e09476bc 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/3_add/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/3_add/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/4_sub/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/4_sub/target/acir.gz index 1819020069a..a6681ca770d 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/4_sub/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/4_sub/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/4_sub/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/4_sub/target/witness.gz index 25328a0260c..ce60a15c551 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/4_sub/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/4_sub/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/5_over/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/5_over/target/acir.gz index 304724930e3..053840dca8b 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/5_over/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/5_over/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/5_over/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/5_over/target/witness.gz index a66cdd23b6d..122614793e2 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/5_over/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/5_over/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/6/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/6/target/acir.gz index 95e9c75d68e..0cc489d8932 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/6/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/6/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/6_array/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/6_array/target/acir.gz index db8652ef2b1..bbc40bbae03 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/6_array/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/6_array/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/6_array/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/6_array/target/witness.gz index 2c50fe3b7a9..e1ab57f56a1 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/6_array/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/6_array/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/7/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/7/target/acir.gz index feeca5449cf..7f14d2a932c 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/7/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/7/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/7_function/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/7_function/target/acir.gz index a7e330713f6..d08ebb1a635 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/7_function/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/7_function/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/7_function/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/7_function/target/witness.gz index be5c9ba0c07..250f96eab04 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/7_function/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/7_function/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/arithmetic_binary_operations/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/arithmetic_binary_operations/target/acir.gz index 45007d3de3b..fb233f84cbf 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/arithmetic_binary_operations/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/arithmetic_binary_operations/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/arithmetic_binary_operations/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/arithmetic_binary_operations/target/witness.gz index f7462a59eb9..450a83edc9c 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/arithmetic_binary_operations/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/arithmetic_binary_operations/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/array_dynamic/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/array_dynamic/target/acir.gz index 4e70f3500f8..1b4f0912b08 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/array_dynamic/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/array_dynamic/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/array_dynamic/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/array_dynamic/target/witness.gz index e2f8feed5f8..41a4ec0817e 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/array_dynamic/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/array_dynamic/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/array_eq/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/array_eq/target/acir.gz index 524e0213506..b274cd72649 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/array_eq/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/array_eq/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/array_len/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/array_len/target/acir.gz index 7249f39ae4e..795d22712b2 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/array_len/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/array_len/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/array_len/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/array_len/target/witness.gz index c1ca0b90f05..c3763958eeb 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/array_len/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/array_len/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/array_neq/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/array_neq/target/acir.gz index 3fc214188a6..8d87f8bc575 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/array_neq/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/array_neq/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/array_sort/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/array_sort/target/acir.gz index 02c1b4460d5..08ff95bdd92 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/array_sort/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/array_sort/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/array_sort/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/array_sort/target/witness.gz index 47e9d08f889..8229809cc95 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/array_sort/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/array_sort/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/assert/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/assert/target/acir.gz index e59ce0d64f8..c4e7f86f219 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/assert/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/assert/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/assert_statement/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/assert_statement/target/acir.gz index b3ddbec900d..d71ac1b6b0e 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/assert_statement/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/assert_statement/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/assign_ex/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/assign_ex/target/acir.gz index 0acd67b06c1..a682df0b963 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/assign_ex/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/assign_ex/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/bit_and/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/bit_and/target/acir.gz index e89ab2e990e..bb100a3693a 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/bit_and/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/bit_and/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/bit_and/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/bit_and/target/witness.gz index ff1bfd52cec..0c5dc12cf1c 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/bit_and/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/bit_and/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/bit_shifts_comptime/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/bit_shifts_comptime/target/acir.gz index e4dfc6a1fb9..fdea9f57fa8 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/bit_shifts_comptime/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/bit_shifts_comptime/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/bit_shifts_comptime/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/bit_shifts_comptime/target/witness.gz index bc2149d74f7..5de81c483c2 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/bit_shifts_comptime/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/bit_shifts_comptime/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/bit_shifts_runtime/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/bit_shifts_runtime/target/acir.gz index 07e3db2d498..e6a8f03a590 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/bit_shifts_runtime/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/bit_shifts_runtime/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/bit_shifts_runtime/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/bit_shifts_runtime/target/witness.gz index 2909f713b54..105d4dc8781 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/bit_shifts_runtime/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/bit_shifts_runtime/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/bool_not/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/bool_not/target/acir.gz index 144584c4bc5..bffd6c3f723 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/bool_not/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/bool_not/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/bool_or/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/bool_or/target/acir.gz index e3b6a07b49d..b2550099bf6 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/bool_or/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/bool_or/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/brillig_acir_as_brillig/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/brillig_acir_as_brillig/target/acir.gz index cea92f8a7f3..bdd4d5bed9d 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/brillig_acir_as_brillig/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/brillig_acir_as_brillig/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/brillig_acir_as_brillig/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/brillig_acir_as_brillig/target/witness.gz index ae8f583ce97..96855675d25 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/brillig_acir_as_brillig/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/brillig_acir_as_brillig/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/brillig_arrays/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/brillig_arrays/target/acir.gz index c6f1053d57e..a093703d4b3 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/brillig_arrays/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/brillig_arrays/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/brillig_assert/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/brillig_assert/target/acir.gz index d88034dcfd3..db07a3c5aa3 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/brillig_assert/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/brillig_assert/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/brillig_assert/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/brillig_assert/target/witness.gz index b941cfc2b31..628e5fbc6d8 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/brillig_assert/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/brillig_assert/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/brillig_blake2s/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/brillig_blake2s/target/acir.gz index 8c2c2a0ee48..be47506c42f 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/brillig_blake2s/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/brillig_blake2s/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/brillig_calls/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/brillig_calls/target/acir.gz index 8e5f44f9f2b..e60666c73c8 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/brillig_calls/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/brillig_calls/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/brillig_calls/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/brillig_calls/target/witness.gz index ae8f583ce97..96855675d25 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/brillig_calls/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/brillig_calls/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/brillig_calls_array/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/brillig_calls_array/target/acir.gz index 753475df6b1..1d348538bff 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/brillig_calls_array/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/brillig_calls_array/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/brillig_calls_conditionals/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/brillig_calls_conditionals/target/acir.gz index 816fd018b4d..e4155f58ead 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/brillig_calls_conditionals/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/brillig_calls_conditionals/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/brillig_conditional/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/brillig_conditional/target/acir.gz index f5f05e0ae4e..9117511d800 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/brillig_conditional/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/brillig_conditional/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/brillig_ecdsa/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/brillig_ecdsa/target/acir.gz index 3cb8211bb5d..cdc28517544 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/brillig_ecdsa/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/brillig_ecdsa/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/brillig_fns_as_values/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/brillig_fns_as_values/target/acir.gz index 221aa632c9d..eb55a029ec8 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/brillig_fns_as_values/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/brillig_fns_as_values/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/brillig_fns_as_values/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/brillig_fns_as_values/target/witness.gz index a7d28d780d2..0b563e5b0be 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/brillig_fns_as_values/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/brillig_fns_as_values/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/brillig_hash_to_field/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/brillig_hash_to_field/target/acir.gz index 73278d95462..06569c728ad 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/brillig_hash_to_field/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/brillig_hash_to_field/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/brillig_identity_function/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/brillig_identity_function/target/acir.gz index 51f3aea170a..4e17ecc5d7b 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/brillig_identity_function/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/brillig_identity_function/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/brillig_keccak/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/brillig_keccak/target/acir.gz index f048dfbf740..ae815259717 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/brillig_keccak/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/brillig_keccak/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/brillig_keccak/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/brillig_keccak/target/witness.gz index 7c80e951d72..95b5064a5a7 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/brillig_keccak/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/brillig_keccak/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/brillig_loop/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/brillig_loop/target/acir.gz index c93d385a2a7..04baae8d290 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/brillig_loop/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/brillig_loop/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/brillig_nested_arrays/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/brillig_nested_arrays/target/acir.gz index 92bb93fcf3a..f69df4781ec 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/brillig_nested_arrays/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/brillig_nested_arrays/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/brillig_nested_slices/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/brillig_nested_slices/target/acir.gz index ad63ca80fd9..100a208bcd8 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/brillig_nested_slices/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/brillig_nested_slices/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/brillig_not/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/brillig_not/target/acir.gz index fd6fea24874..3d625215150 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/brillig_not/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/brillig_not/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/brillig_not/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/brillig_not/target/witness.gz index 7da5a2de59d..3fbf07be37e 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/brillig_not/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/brillig_not/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/brillig_oracle/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/brillig_oracle/target/acir.gz index 483c24add00..3ebdee29a46 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/brillig_oracle/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/brillig_oracle/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/brillig_pedersen/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/brillig_pedersen/target/acir.gz index 4411b4381da..d876646a63e 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/brillig_pedersen/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/brillig_pedersen/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/brillig_recursion/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/brillig_recursion/target/acir.gz index 5a3dd291e78..4853adb029b 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/brillig_recursion/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/brillig_recursion/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/brillig_references/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/brillig_references/target/acir.gz index 5ff2027b973..4069ca2cb5e 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/brillig_references/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/brillig_references/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/brillig_scalar_mul/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/brillig_scalar_mul/target/acir.gz index 2c29941121f..dfeb06cc1f0 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/brillig_scalar_mul/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/brillig_scalar_mul/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/brillig_schnorr/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/brillig_schnorr/target/acir.gz index c3675e56ef2..625ae64a11d 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/brillig_schnorr/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/brillig_schnorr/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/brillig_sha256/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/brillig_sha256/target/acir.gz index 924efdc4270..49f7e6afcf4 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/brillig_sha256/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/brillig_sha256/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/brillig_slices/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/brillig_slices/target/acir.gz index 270329d70c6..57ca1d59fed 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/brillig_slices/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/brillig_slices/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/brillig_to_be_bytes/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/brillig_to_be_bytes/target/acir.gz index 5d42d1d088e..1249975b27c 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/brillig_to_be_bytes/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/brillig_to_be_bytes/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/brillig_to_bytes_integration/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/brillig_to_bytes_integration/target/acir.gz index dafe5b20fc3..fe9ac34ed17 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/brillig_to_bytes_integration/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/brillig_to_bytes_integration/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/brillig_to_le_bytes/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/brillig_to_le_bytes/target/acir.gz index dcbea001f6f..834f57e1ee7 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/brillig_to_le_bytes/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/brillig_to_le_bytes/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/brillig_top_level/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/brillig_top_level/target/acir.gz index f0f13ee9dea..4b2fbcd3462 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/brillig_top_level/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/brillig_top_level/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/brillig_unitialised_arrays/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/brillig_unitialised_arrays/target/acir.gz index 3337139e860..4ab33919248 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/brillig_unitialised_arrays/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/brillig_unitialised_arrays/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/brillig_unitialised_arrays/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/brillig_unitialised_arrays/target/witness.gz index c7a692fd449..869536a1d98 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/brillig_unitialised_arrays/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/brillig_unitialised_arrays/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/cast_bool/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/cast_bool/target/acir.gz index a0ffcd3a17c..032b36d1629 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/cast_bool/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/cast_bool/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/closures_mut_ref/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/closures_mut_ref/target/acir.gz index 9a0635f2226..271b0ddd649 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/closures_mut_ref/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/closures_mut_ref/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/conditional_1/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/conditional_1/target/acir.gz index 3c60eb1582d..0bad56713bd 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/conditional_1/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/conditional_1/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/conditional_1/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/conditional_1/target/witness.gz index edef9f71e36..bd0870eefc9 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/conditional_1/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/conditional_1/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/conditional_2/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/conditional_2/target/acir.gz index ca259337933..8b56f25b2cf 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/conditional_2/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/conditional_2/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/conditional_regression_421/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/conditional_regression_421/target/acir.gz index 930d414825e..bb060b5ebcc 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/conditional_regression_421/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/conditional_regression_421/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/conditional_regression_547/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/conditional_regression_547/target/acir.gz index 350a4daf676..090578ca4e3 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/conditional_regression_547/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/conditional_regression_547/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/conditional_regression_579/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/conditional_regression_579/target/acir.gz index 3628a8d6b1e..2639a2e0809 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/conditional_regression_579/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/conditional_regression_579/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/conditional_regression_661/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/conditional_regression_661/target/acir.gz index 078d874ec91..41a4dbd0a2c 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/conditional_regression_661/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/conditional_regression_661/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/conditional_regression_661/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/conditional_regression_661/target/witness.gz index 9fe13d5277c..ad901ffb80d 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/conditional_regression_661/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/conditional_regression_661/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/conditional_regression_short_circuit/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/conditional_regression_short_circuit/target/acir.gz index 82221bfd02e..34340161cd7 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/conditional_regression_short_circuit/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/conditional_regression_short_circuit/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/conditional_regression_short_circuit/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/conditional_regression_short_circuit/target/witness.gz index 82558b122b6..b2aa4a0b23f 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/conditional_regression_short_circuit/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/conditional_regression_short_circuit/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/conditional_regression_to_bits/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/conditional_regression_to_bits/target/acir.gz index 3628a8d6b1e..2639a2e0809 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/conditional_regression_to_bits/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/conditional_regression_to_bits/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/custom_entry/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/custom_entry/target/acir.gz index e59ce0d64f8..c4e7f86f219 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/custom_entry/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/custom_entry/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/debug_logs/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/debug_logs/target/acir.gz index 4ecdb39c47e..ea9187f4084 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/debug_logs/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/debug_logs/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/diamond_deps_0/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/diamond_deps_0/target/acir.gz index 802695728d2..e73668fd86c 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/diamond_deps_0/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/diamond_deps_0/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/distinct_keyword/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/distinct_keyword/target/acir.gz index 42e909de7d9..b3411dc96a7 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/distinct_keyword/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/distinct_keyword/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/double_verify_proof/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/double_verify_proof/target/acir.gz index 3a630b095f7..45f9234a182 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/double_verify_proof/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/double_verify_proof/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/ecdsa_secp256k1/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/ecdsa_secp256k1/target/acir.gz index d64949310ee..2b594788817 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/ecdsa_secp256k1/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/ecdsa_secp256k1/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/ecdsa_secp256r1/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/ecdsa_secp256r1/target/acir.gz index 314a6e71940..0b8cf56b8d5 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/ecdsa_secp256r1/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/ecdsa_secp256r1/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/eddsa/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/eddsa/target/acir.gz index 61b37c09081..049b7326ea8 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/eddsa/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/eddsa/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/eddsa/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/eddsa/target/witness.gz index 10f5a3fd1dc..fcce3069d87 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/eddsa/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/eddsa/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/field_attribute/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/field_attribute/target/acir.gz index 2eaa1ddbb09..a68a3a3b566 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/field_attribute/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/field_attribute/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/field_attribute/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/field_attribute/target/witness.gz index 1661b95399b..5f3c241de56 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/field_attribute/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/field_attribute/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/generics/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/generics/target/acir.gz index 2100e796d5d..c9462cfa87f 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/generics/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/generics/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/global_consts/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/global_consts/target/acir.gz index 938aa5ce925..8b6a0d9db65 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/global_consts/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/global_consts/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/hash_to_field/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/hash_to_field/target/acir.gz index 499c53b9ace..4c5bcaa1a31 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/hash_to_field/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/hash_to_field/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/higher_order_functions/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/higher_order_functions/target/acir.gz index e964d33d840..53bbd84e74c 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/higher_order_functions/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/higher_order_functions/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/higher_order_functions/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/higher_order_functions/target/witness.gz index deefbab76e5..3998fbc8d59 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/higher_order_functions/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/higher_order_functions/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/if_else_chain/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/if_else_chain/target/acir.gz index 95a8357b37c..21cb3898a2d 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/if_else_chain/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/if_else_chain/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/import/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/import/target/acir.gz index 5d716ecd89a..ff6e6f6c394 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/import/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/import/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/integer_array_indexing/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/integer_array_indexing/target/acir.gz index 9ed895b648c..1c4c50039eb 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/integer_array_indexing/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/integer_array_indexing/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/integer_array_indexing/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/integer_array_indexing/target/witness.gz index 7a6b5abdacd..b3d60e315ec 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/integer_array_indexing/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/integer_array_indexing/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/keccak256/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/keccak256/target/acir.gz index 3fb0794c238..6b57ed0fb85 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/keccak256/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/keccak256/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/keccak256/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/keccak256/target/witness.gz index 4335d7cbcfe..42bcc0ccbd1 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/keccak256/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/keccak256/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/main_bool_arg/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/main_bool_arg/target/acir.gz index f952b731324..753ad7c9687 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/main_bool_arg/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/main_bool_arg/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/main_return/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/main_return/target/acir.gz index 98a51b6a16d..4763c63284d 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/main_return/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/main_return/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/merkle_insert/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/merkle_insert/target/acir.gz index ef447347713..5db7b8b1539 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/merkle_insert/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/merkle_insert/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/merkle_insert/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/merkle_insert/target/witness.gz index 9b7c8f12289..7fdb4d1f9e5 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/merkle_insert/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/merkle_insert/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/mock_oracle/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/mock_oracle/target/acir.gz index 40aac645003..c45cd40f28e 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/mock_oracle/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/mock_oracle/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/modules/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/modules/target/acir.gz index b2a5e0352bb..05b5e23ae3e 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/modules/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/modules/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/modules_more/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/modules_more/target/acir.gz index 5d716ecd89a..ff6e6f6c394 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/modules_more/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/modules_more/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/modulus/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/modulus/target/acir.gz index 57f194bf95f..3ac23ecd933 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/modulus/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/modulus/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/nested_array_dynamic/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/nested_array_dynamic/target/acir.gz index 9bb7df48483..8eb05c0382d 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/nested_array_dynamic/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/nested_array_dynamic/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/nested_array_dynamic/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/nested_array_dynamic/target/witness.gz index 335447243bb..d5dc73c9bb4 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/nested_array_dynamic/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/nested_array_dynamic/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/nested_arrays_from_brillig/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/nested_arrays_from_brillig/target/acir.gz index f9bf2088829..270cfcaf53c 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/nested_arrays_from_brillig/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/nested_arrays_from_brillig/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/nested_arrays_from_brillig/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/nested_arrays_from_brillig/target/witness.gz index 67c96f0da95..a3161ac44f9 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/nested_arrays_from_brillig/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/nested_arrays_from_brillig/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/nested_slice_dynamic/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/nested_slice_dynamic/target/acir.gz index 366baabac87..d76d3a08041 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/nested_slice_dynamic/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/nested_slice_dynamic/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/nested_slice_dynamic/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/nested_slice_dynamic/target/witness.gz index 37974bf17b1..8d168b8c19c 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/nested_slice_dynamic/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/nested_slice_dynamic/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/pedersen_check/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/pedersen_check/target/acir.gz index 77cf626184c..0c96568b826 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/pedersen_check/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/pedersen_check/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/pedersen_check/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/pedersen_check/target/witness.gz index 0b48ba0aeb2..a2cef03fe16 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/pedersen_check/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/pedersen_check/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/poseidon_bn254_hash/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/poseidon_bn254_hash/target/acir.gz index d3a6c993063..0327f600884 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/poseidon_bn254_hash/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/poseidon_bn254_hash/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/poseidon_bn254_hash/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/poseidon_bn254_hash/target/witness.gz index f4fbaec7ccf..b3f3f1a3b24 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/poseidon_bn254_hash/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/poseidon_bn254_hash/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/poseidonsponge_x5_254/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/poseidonsponge_x5_254/target/acir.gz index 0acb8775b0e..dc260ce2aa7 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/poseidonsponge_x5_254/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/poseidonsponge_x5_254/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/poseidonsponge_x5_254/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/poseidonsponge_x5_254/target/witness.gz index d7e732d7ee1..f61ba4ec0cf 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/poseidonsponge_x5_254/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/poseidonsponge_x5_254/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/pred_eq/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/pred_eq/target/acir.gz index a0ffcd3a17c..032b36d1629 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/pred_eq/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/pred_eq/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/references/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/references/target/acir.gz index 7c60b6b92b2..0668e2eca25 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/references/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/references/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/references_aliasing/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/references_aliasing/target/acir.gz index 3628a8d6b1e..2639a2e0809 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/references_aliasing/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/references_aliasing/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/regression/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/regression/target/acir.gz index 9b65966266d..be72e6abb75 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/regression/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/regression/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/regression/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/regression/target/witness.gz index 39046f13606..10c1c42caa0 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/regression/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/regression/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/regression_2854/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/regression_2854/target/acir.gz index 194163133ed..8a9e4ed2b65 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/regression_2854/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/regression_2854/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/regression_2854/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/regression_2854/target/witness.gz index e881fa8da63..c0b900e8119 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/regression_2854/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/regression_2854/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/regression_mem_op_predicate/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/regression_mem_op_predicate/target/acir.gz index ea0679ed77f..403c0dd43f1 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/regression_mem_op_predicate/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/regression_mem_op_predicate/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/regression_mem_op_predicate/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/regression_mem_op_predicate/target/witness.gz index 2d69f57800b..e8dc551cf13 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/regression_mem_op_predicate/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/regression_mem_op_predicate/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/regression_method_cannot_be_found/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/regression_method_cannot_be_found/target/acir.gz index 0cffadb13aa..f29fbef8d3f 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/regression_method_cannot_be_found/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/regression_method_cannot_be_found/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/scalar_mul/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/scalar_mul/target/acir.gz index 4746bf75a68..e06ad09e176 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/scalar_mul/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/scalar_mul/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/scalar_mul/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/scalar_mul/target/witness.gz index 1d7bfd63739..637e61f60de 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/scalar_mul/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/scalar_mul/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/schnorr/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/schnorr/target/acir.gz index c4a0376fdc3..84a646ab241 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/schnorr/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/schnorr/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/schnorr/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/schnorr/target/witness.gz index 5ba3d57c1a8..ebc1ed7f713 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/schnorr/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/schnorr/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/sha256/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/sha256/target/acir.gz index be37fde4db7..8537218ec5c 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/sha256/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/sha256/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/sha256/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/sha256/target/witness.gz index 19f4c8ecdcf..d5762dfc7d5 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/sha256/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/sha256/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/sha2_blocks/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/sha2_blocks/target/acir.gz index 385bee61cf8..3c21d9a4bf8 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/sha2_blocks/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/sha2_blocks/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/sha2_blocks/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/sha2_blocks/target/witness.gz index c85ea6b98bd..40ca3d3f63f 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/sha2_blocks/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/sha2_blocks/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/sha2_byte/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/sha2_byte/target/acir.gz index 025a4eebb6f..b285f9c24e5 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/sha2_byte/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/sha2_byte/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/sha2_byte/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/sha2_byte/target/witness.gz index 4336e4dc653..66d8125a852 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/sha2_byte/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/sha2_byte/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/signed_arithmetic/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/signed_arithmetic/target/acir.gz index cbb050199f1..a5305fbd1bd 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/signed_arithmetic/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/signed_arithmetic/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/signed_arithmetic/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/signed_arithmetic/target/witness.gz index 63fb3e0b3de..5a1d190cdf0 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/signed_arithmetic/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/signed_arithmetic/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/signed_division/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/signed_division/target/acir.gz index e968085be64..e3663c2a7c9 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/signed_division/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/signed_division/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/signed_division/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/signed_division/target/witness.gz index 1cd4db34256..598c8658469 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/signed_division/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/signed_division/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/simple_2d_array/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/simple_2d_array/target/acir.gz index ff726b4542b..59b62b9c99d 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/simple_2d_array/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/simple_2d_array/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/simple_add_and_ret_arr/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/simple_add_and_ret_arr/target/acir.gz index 48d9d1aba75..d7ec1ebc477 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/simple_add_and_ret_arr/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/simple_add_and_ret_arr/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/simple_array_param/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/simple_array_param/target/acir.gz index 813d64b5582..e908711b098 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/simple_array_param/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/simple_array_param/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/simple_bitwise/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/simple_bitwise/target/acir.gz index be9aa5c5fa5..71e5cc3ce65 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/simple_bitwise/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/simple_bitwise/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/simple_bitwise/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/simple_bitwise/target/witness.gz index 78f39a7d112..2cb925c0149 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/simple_bitwise/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/simple_bitwise/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/simple_comparison/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/simple_comparison/target/acir.gz index 0d9d364f344..87ad6a62a57 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/simple_comparison/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/simple_comparison/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/simple_comparison/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/simple_comparison/target/witness.gz index 5cda1d62977..5896584fa8a 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/simple_comparison/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/simple_comparison/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/simple_mut/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/simple_mut/target/acir.gz index 75566241c92..9338b74aabd 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/simple_mut/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/simple_mut/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/simple_not/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/simple_not/target/acir.gz index 5d1b5e460c6..8f3fd60cc4d 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/simple_not/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/simple_not/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/simple_print/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/simple_print/target/acir.gz index f5db91fb9a4..5a2c524f26b 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/simple_print/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/simple_print/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/simple_program_addition/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/simple_program_addition/target/acir.gz index 48d9d1aba75..d7ec1ebc477 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/simple_program_addition/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/simple_program_addition/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/simple_radix/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/simple_radix/target/acir.gz index 402ba7603ba..78096c19e45 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/simple_radix/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/simple_radix/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/simple_radix/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/simple_radix/target/witness.gz index b2bbcdea99f..6ecc30eb054 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/simple_radix/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/simple_radix/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/simple_shield/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/simple_shield/target/acir.gz index 7f8f38b47e5..8fbb88d62bd 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/simple_shield/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/simple_shield/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/simple_shield/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/simple_shield/target/witness.gz index 282b0717a41..1a33f9f79e2 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/simple_shield/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/simple_shield/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/simple_shift_left_right/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/simple_shift_left_right/target/acir.gz index fddd4366dba..19d240987a8 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/simple_shift_left_right/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/simple_shift_left_right/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/simple_shift_left_right/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/simple_shift_left_right/target/witness.gz index eb28de51576..9c05da63d6b 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/simple_shift_left_right/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/simple_shift_left_right/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/slice_dynamic_index/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/slice_dynamic_index/target/acir.gz index fe4c578d57a..f53fbca1f59 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/slice_dynamic_index/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/slice_dynamic_index/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/slice_dynamic_index/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/slice_dynamic_index/target/witness.gz index c1a1279097d..0075dd044dc 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/slice_dynamic_index/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/slice_dynamic_index/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/slices/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/slices/target/acir.gz index dd80d6523c0..b8a2b19d38b 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/slices/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/slices/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/slices/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/slices/target/witness.gz index cc6402710f6..d9d8d036339 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/slices/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/slices/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/strings/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/strings/target/acir.gz index 8eef9d732a6..26528ac0100 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/strings/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/strings/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/struct/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/struct/target/acir.gz index 371f434fc5a..e9de8adcb38 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/struct/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/struct/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/struct_array_inputs/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/struct_array_inputs/target/acir.gz index 48ed78131b1..f66ed17a0cf 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/struct_array_inputs/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/struct_array_inputs/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/struct_fields_ordering/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/struct_fields_ordering/target/acir.gz index f802fec624f..8ddb62e8799 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/struct_fields_ordering/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/struct_fields_ordering/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/struct_inputs/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/struct_inputs/target/acir.gz index 76a70a60d71..b658b4111f6 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/struct_inputs/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/struct_inputs/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/submodules/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/submodules/target/acir.gz index e3b6a07b49d..b2550099bf6 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/submodules/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/submodules/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/to_be_bytes/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/to_be_bytes/target/acir.gz index 5b768e5753d..f0742c6cf2b 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/to_be_bytes/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/to_be_bytes/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/to_be_bytes/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/to_be_bytes/target/witness.gz index f2e2e29d62b..9ffa155a84f 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/to_be_bytes/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/to_be_bytes/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/to_bytes_consistent/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/to_bytes_consistent/target/acir.gz index 91d2fc4659a..a69c76b3198 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/to_bytes_consistent/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/to_bytes_consistent/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/to_bytes_consistent/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/to_bytes_consistent/target/witness.gz index 39033f1efea..3b931590419 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/to_bytes_consistent/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/to_bytes_consistent/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/to_bytes_integration/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/to_bytes_integration/target/acir.gz index c9e6ad478d1..4e34c8da2d1 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/to_bytes_integration/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/to_bytes_integration/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/to_bytes_integration/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/to_bytes_integration/target/witness.gz index 8e45e4300b0..b25db55391c 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/to_bytes_integration/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/to_bytes_integration/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/to_le_bytes/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/to_le_bytes/target/acir.gz index 99533f1bbb1..1445a969536 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/to_le_bytes/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/to_le_bytes/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/to_le_bytes/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/to_le_bytes/target/witness.gz index de200202829..b3948caad12 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/to_le_bytes/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/to_le_bytes/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/trait_allowed_item_name_matches/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/trait_allowed_item_name_matches/target/acir.gz index 3628a8d6b1e..2639a2e0809 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/trait_allowed_item_name_matches/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/trait_allowed_item_name_matches/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/trait_associated_member_names_clashes/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/trait_associated_member_names_clashes/target/acir.gz new file mode 100644 index 00000000000..2639a2e0809 Binary files /dev/null and b/tooling/nargo_cli/tests/acir_artifacts/trait_associated_member_names_clashes/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/trait_associated_member_names_clashes/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/trait_associated_member_names_clashes/target/witness.gz new file mode 100644 index 00000000000..4e90289d5e1 Binary files /dev/null and b/tooling/nargo_cli/tests/acir_artifacts/trait_associated_member_names_clashes/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/trait_default_implementation/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/trait_default_implementation/target/acir.gz index 4b691b72625..b3a99dacb66 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/trait_default_implementation/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/trait_default_implementation/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/trait_function_calls/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/trait_function_calls/target/acir.gz index 3628a8d6b1e..2639a2e0809 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/trait_function_calls/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/trait_function_calls/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/trait_impl_base_type/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/trait_impl_base_type/target/acir.gz index 0cabf2036eb..531a1baf42e 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/trait_impl_base_type/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/trait_impl_base_type/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/trait_multi_module_test/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/trait_multi_module_test/target/acir.gz index 3628a8d6b1e..2639a2e0809 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/trait_multi_module_test/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/trait_multi_module_test/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/trait_override_implementation/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/trait_override_implementation/target/acir.gz index 4b691b72625..b3a99dacb66 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/trait_override_implementation/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/trait_override_implementation/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/trait_self/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/trait_self/target/acir.gz index 3628a8d6b1e..2639a2e0809 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/trait_self/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/trait_self/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/trait_where_clause/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/trait_where_clause/target/acir.gz index 3628a8d6b1e..2639a2e0809 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/trait_where_clause/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/trait_where_clause/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/traits_in_crates_1/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/traits_in_crates_1/target/acir.gz index d06ac891987..6eb630ce2ff 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/traits_in_crates_1/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/traits_in_crates_1/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/traits_in_crates_2/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/traits_in_crates_2/target/acir.gz index d06ac891987..6eb630ce2ff 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/traits_in_crates_2/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/traits_in_crates_2/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/tuple_inputs/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/tuple_inputs/target/acir.gz index 60df59819bc..cf2b43945fe 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/tuple_inputs/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/tuple_inputs/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/tuple_inputs/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/tuple_inputs/target/witness.gz index 0af5fc52ec4..0eb0d6f09f6 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/tuple_inputs/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/tuple_inputs/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/tuples/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/tuples/target/acir.gz index 002b5e4a169..154974745fa 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/tuples/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/tuples/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/tuples/target/witness.gz b/tooling/nargo_cli/tests/acir_artifacts/tuples/target/witness.gz index 768f9f77de0..e48187b08c1 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/tuples/target/witness.gz and b/tooling/nargo_cli/tests/acir_artifacts/tuples/target/witness.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/type_aliases/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/type_aliases/target/acir.gz index 2a2153f9706..7855747826f 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/type_aliases/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/type_aliases/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/acir_artifacts/xor/target/acir.gz b/tooling/nargo_cli/tests/acir_artifacts/xor/target/acir.gz index a9dca272c62..eda28c748c5 100644 Binary files a/tooling/nargo_cli/tests/acir_artifacts/xor/target/acir.gz and b/tooling/nargo_cli/tests/acir_artifacts/xor/target/acir.gz differ diff --git a/tooling/nargo_cli/tests/compile_failure/constant_return/src/main.nr b/tooling/nargo_cli/tests/compile_failure/constant_return/src/main.nr index 4cc6c739181..4972d514860 100644 --- a/tooling/nargo_cli/tests/compile_failure/constant_return/src/main.nr +++ b/tooling/nargo_cli/tests/compile_failure/constant_return/src/main.nr @@ -4,4 +4,4 @@ // a test before ACIR gen optimizes this test. fn main(_x : Field) -> pub Field { 5 -} \ No newline at end of file +} diff --git a/tooling/nargo_cli/tests/execution_success/1327_concrete_in_generic/src/main.nr b/tooling/nargo_cli/tests/execution_success/1327_concrete_in_generic/src/main.nr index d868ff1ef83..368d4811e45 100644 --- a/tooling/nargo_cli/tests/execution_success/1327_concrete_in_generic/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/1327_concrete_in_generic/src/main.nr @@ -1,9 +1,8 @@ // --- - - fn new_concrete_c_over_d() -> C { - let d_method_interface = get_d_method_interface(); - C::new(d_method_interface) - } +fn new_concrete_c_over_d() -> C { + let d_method_interface = get_d_method_interface(); + C::new(d_method_interface) +} // --- @@ -54,25 +53,24 @@ d: Field, } - fn d_method(input: D) -> Field { - input.d * input.d - } +fn d_method(input: D) -> Field { + input.d * input.d +} - fn get_d_method_interface() -> MethodInterface { - MethodInterface { +fn get_d_method_interface() -> MethodInterface { + MethodInterface { some_method_on_t_d: d_method, } - } - -// --- +} - fn main(input: Field) -> pub Field { - let b: B> = B::new(new_concrete_c_over_d); - let c: C = b.get_t_c(); // Singleton - let d: D = D { d: input }; // Note - let output = c.call_method_of_t_d(d); - - output - } +// --- +fn main(input: Field) -> pub Field { + let b: B> = B::new(new_concrete_c_over_d); + let c: C = b.get_t_c(); // Singleton + let d: D = D { d: input }; // Note + let output = c.call_method_of_t_d(d); + + output +} // --- diff --git a/tooling/nargo_cli/tests/execution_success/5_over/src/main.nr b/tooling/nargo_cli/tests/execution_success/5_over/src/main.nr index fa50fbe7c14..42f339533aa 100644 --- a/tooling/nargo_cli/tests/execution_success/5_over/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/5_over/src/main.nr @@ -6,6 +6,6 @@ fn main(mut x: u32, y: u32) { x = std::wrapping_mul(x,x); assert(y == x); - let c:u3 = 2; + let c: u3 = 2; assert(c > x as u3); } diff --git a/tooling/nargo_cli/tests/execution_success/6_array/src/main.nr b/tooling/nargo_cli/tests/execution_success/6_array/src/main.nr index 8d029943d81..44a5363f8bc 100644 --- a/tooling/nargo_cli/tests/execution_success/6_array/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/6_array/src/main.nr @@ -1,6 +1,6 @@ use dep::std; -//Basic tests for arrays -fn main(x: [u32; 5], y: [u32; 5], mut z: u32, t: u32) { +//Basic tests for arrays +fn main(x: [u32; 5], y: [u32; 5], mut z: u32, t: u32) { let mut c = 2301; z = y[4]; //Test 1: diff --git a/tooling/nargo_cli/tests/execution_success/7_function/src/main.nr b/tooling/nargo_cli/tests/execution_success/7_function/src/main.nr index c664a791636..8fd85fa31cf 100644 --- a/tooling/nargo_cli/tests/execution_success/7_function/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/7_function/src/main.nr @@ -1,11 +1,11 @@ -//Tests for function calling +//Tests for function calling fn f1(mut x: Field) -> Field { x = x + 1; x = f2(x); x } -fn f2(mut x: Field) -> Field{ +fn f2(mut x: Field) -> Field { x += 2; x } @@ -22,7 +22,7 @@ fn test1(mut a: Field) { assert(a == 4); } -fn test2(z: Field, t: u32 ) { +fn test2(z: Field, t: u32 ) { let a = z + t as Field; assert(a == 64); let e = pow(z, t as Field); @@ -78,15 +78,12 @@ fn test_multiple5(a: (u32, u32)) { assert(a.0 == a.1+2); } - fn test_multiple6(a: my2, b: my_struct, c: (my2, my_struct)) { test_multiple4(a.aa); test_multiple5((b.a, b.b)); assert(c.0.aa.a == c.1.a); } - - fn foo(a: [Field; N]) -> [Field; N] { a } @@ -95,7 +92,7 @@ fn bar() -> [Field; 1] { foo([0]) } -fn main(x: u32 , y: u32 , a: Field, arr1: [u32; 9], arr2: [u32; 9]) { +fn main(x: u32 , y: u32 , a: Field, arr1: [u32; 9], arr2: [u32; 9]) { let mut ss: my_struct = my_struct { b: x, a: x+2, }; test_multiple4(ss); test_multiple5((ss.a,ss.b)); @@ -106,13 +103,13 @@ fn main(x: u32 , y: u32 , a: Field, arr1: [u32; 9], arr2: [u32; 9]) { ss.a = 61; test_multiple6(my, ss, (my,ss)); - let my_block = { + let my_block = { let mut ab = f2(a); ab = ab + a; (x,ab) }; assert(my_block.1 == 4); - + test0(a); test1(a); test2(x as Field, y); diff --git a/tooling/nargo_cli/tests/execution_success/arithmetic_binary_operations/src/main.nr b/tooling/nargo_cli/tests/execution_success/arithmetic_binary_operations/src/main.nr index 78c91818345..8fb7bcdbeb2 100644 --- a/tooling/nargo_cli/tests/execution_success/arithmetic_binary_operations/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/arithmetic_binary_operations/src/main.nr @@ -12,4 +12,4 @@ fn main(x : Field, y : Field, z : Field) -> pub Field { let c = b * z; // 2 * 5 = 10 let d = c / a; // 10 / 6 (This uses field inversion, so we test it by multiplying by `a`) d * a -} \ No newline at end of file +} diff --git a/tooling/nargo_cli/tests/execution_success/array_dynamic/src/main.nr b/tooling/nargo_cli/tests/execution_success/array_dynamic/src/main.nr index db8f10b27e9..14b6f7d3b85 100644 --- a/tooling/nargo_cli/tests/execution_success/array_dynamic/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/array_dynamic/src/main.nr @@ -1,4 +1,3 @@ - fn main(x: [u32; 5], mut z: u32, t: u32, index: [Field;5], index2: [Field;5], offset: Field, sublen: Field) { let idx = (z - 5*t - 5) as Field; //dynamic array test diff --git a/tooling/nargo_cli/tests/execution_success/assert_statement/src/main.nr b/tooling/nargo_cli/tests/execution_success/assert_statement/src/main.nr index 3209f5b944b..f9359ded812 100644 --- a/tooling/nargo_cli/tests/execution_success/assert_statement/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/assert_statement/src/main.nr @@ -1,7 +1,7 @@ // Tests a very simple program. // // The features being tested is assertion -fn main(x : Field, y : pub Field) { +fn main(x : Field, y : pub Field) { assert(x == y, "x and y are not equal"); assert_eq(x, y, "x and y are not equal"); } diff --git a/tooling/nargo_cli/tests/execution_success/bit_and/src/main.nr b/tooling/nargo_cli/tests/execution_success/bit_and/src/main.nr index f4805960a33..35671abea63 100644 --- a/tooling/nargo_cli/tests/execution_success/bit_and/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/bit_and/src/main.nr @@ -15,4 +15,4 @@ fn main(x : Field, y : Field) { let y_as_u11 = y as u11; assert((x_as_u11 & y_as_u11) == x_as_u11); } - + diff --git a/tooling/nargo_cli/tests/execution_success/bit_shifts_comptime/src/main.nr b/tooling/nargo_cli/tests/execution_success/bit_shifts_comptime/src/main.nr index e4ca1bd92cc..209861e74fa 100644 --- a/tooling/nargo_cli/tests/execution_success/bit_shifts_comptime/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/bit_shifts_comptime/src/main.nr @@ -1,6 +1,6 @@ fn main(x: u64) { - let two: u64 = 2; - let three: u64 = 3; + let two: u64 = 2; + let three: u64 = 3; // shifts on constant values assert(two << 2 == 8); @@ -11,13 +11,13 @@ fn main(x: u64) { assert(x << 1 == 128); assert(x >> 2 == 16); - regression_2250(); + regression_2250(); } fn regression_2250() { - let a: u1 = 1 >> 1; + let a: u1 = 1 >> 1; assert(a == 0); - - let b: u32 = 1 >> 32; + + let b: u32 = 1 >> 32; assert(b == 0); -} \ No newline at end of file +} diff --git a/tooling/nargo_cli/tests/execution_success/bool_not/src/main.nr b/tooling/nargo_cli/tests/execution_success/bool_not/src/main.nr index a0afe770121..935d8cc074d 100644 --- a/tooling/nargo_cli/tests/execution_success/bool_not/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/bool_not/src/main.nr @@ -1,4 +1,4 @@ fn main(x: u1) { assert(!x == 0); } - + diff --git a/tooling/nargo_cli/tests/execution_success/bool_or/src/main.nr b/tooling/nargo_cli/tests/execution_success/bool_or/src/main.nr index 87d7e870063..6cb959e61e6 100644 --- a/tooling/nargo_cli/tests/execution_success/bool_or/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/bool_or/src/main.nr @@ -3,4 +3,4 @@ fn main(x: u1, y: u1) { assert(x | y | x == 1); } - + diff --git a/tooling/nargo_cli/tests/execution_success/brillig_acir_as_brillig/src/main.nr b/tooling/nargo_cli/tests/execution_success/brillig_acir_as_brillig/src/main.nr index 9d4c5da9dc4..da5982dcd04 100644 --- a/tooling/nargo_cli/tests/execution_success/brillig_acir_as_brillig/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/brillig_acir_as_brillig/src/main.nr @@ -1,5 +1,4 @@ - -fn main(x: u32) { +fn main(x: u32) { assert(entry_point(x) == 2); swap_entry_point(x, x + 1); assert(deep_entry_point(x) == 4); diff --git a/tooling/nargo_cli/tests/execution_success/brillig_arrays/src/main.nr b/tooling/nargo_cli/tests/execution_success/brillig_arrays/src/main.nr index a2b64100918..e535b6001a4 100644 --- a/tooling/nargo_cli/tests/execution_success/brillig_arrays/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/brillig_arrays/src/main.nr @@ -1,8 +1,7 @@ // Tests a very simple program. // // The features being tested are array reads and writes - -fn main(x: [Field; 3]) { +fn main(x: [Field; 3]) { read_array(x); read_write_array(x); } diff --git a/tooling/nargo_cli/tests/execution_success/brillig_assert/src/main.nr b/tooling/nargo_cli/tests/execution_success/brillig_assert/src/main.nr index 632c72f2393..d17c0b4f991 100644 --- a/tooling/nargo_cli/tests/execution_success/brillig_assert/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/brillig_assert/src/main.nr @@ -1,7 +1,7 @@ // Tests a very simple program. // // The features being tested is using assert on brillig -fn main(x: Field) { +fn main(x: Field) { assert(1 == conditional(x as bool)); } diff --git a/tooling/nargo_cli/tests/execution_success/brillig_calls/src/main.nr b/tooling/nargo_cli/tests/execution_success/brillig_calls/src/main.nr index fed84f80545..656d241d2f5 100644 --- a/tooling/nargo_cli/tests/execution_success/brillig_calls/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/brillig_calls/src/main.nr @@ -1,7 +1,7 @@ // Tests a very simple program. // // The features being tested is brillig calls -fn main(x: u32) { +fn main(x: u32) { assert(entry_point(x) == 2); swap_entry_point(x, x + 1); assert(deep_entry_point(x) == 4); diff --git a/tooling/nargo_cli/tests/execution_success/brillig_calls_array/src/main.nr b/tooling/nargo_cli/tests/execution_success/brillig_calls_array/src/main.nr index 3af825c38f9..d5702ac4f82 100644 --- a/tooling/nargo_cli/tests/execution_success/brillig_calls_array/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/brillig_calls_array/src/main.nr @@ -1,7 +1,7 @@ // Tests a very simple program. // // The features being tested is brillig calls passing arrays around -fn main(x: [u32; 3]) { +fn main(x: [u32; 3]) { assert(entry_point(x) == 9); another_entry_point(x); } diff --git a/tooling/nargo_cli/tests/execution_success/brillig_calls_conditionals/src/main.nr b/tooling/nargo_cli/tests/execution_success/brillig_calls_conditionals/src/main.nr index 4d4eba01f05..0a1718d0171 100644 --- a/tooling/nargo_cli/tests/execution_success/brillig_calls_conditionals/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/brillig_calls_conditionals/src/main.nr @@ -1,7 +1,7 @@ // Tests a very simple program. // // The features being tested is brillig calls with conditionals -fn main(x: [u32; 3]) { +fn main(x: [u32; 3]) { assert(entry_point(x[0]) == 7); assert(entry_point(x[1]) == 8); assert(entry_point(x[2]) == 9); @@ -29,7 +29,7 @@ unconstrained fn entry_point(x: u32) -> u32 { result = inner_2(); } else if x == 3 { result = inner_3(); - } + } result } diff --git a/tooling/nargo_cli/tests/execution_success/brillig_conditional/src/main.nr b/tooling/nargo_cli/tests/execution_success/brillig_conditional/src/main.nr index 96e5217ca65..a3d92ab58e9 100644 --- a/tooling/nargo_cli/tests/execution_success/brillig_conditional/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/brillig_conditional/src/main.nr @@ -1,7 +1,7 @@ // Tests a very simple program. // // The features being tested is basic conditonal on brillig -fn main(x: Field) { +fn main(x: Field) { assert(4 == conditional(x == 1)); } diff --git a/tooling/nargo_cli/tests/execution_success/brillig_fns_as_values/src/main.nr b/tooling/nargo_cli/tests/execution_success/brillig_fns_as_values/src/main.nr index d0985a9012d..5f8435825f6 100644 --- a/tooling/nargo_cli/tests/execution_success/brillig_fns_as_values/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/brillig_fns_as_values/src/main.nr @@ -2,7 +2,7 @@ struct MyStruct { operation: fn (u32) -> u32, } -fn main(x: u32) { +fn main(x: u32) { assert(wrapper(increment, x) == x + 1); assert(wrapper(increment_acir, x) == x + 1); assert(wrapper(decrement, x) == x - 1); diff --git a/tooling/nargo_cli/tests/execution_success/brillig_identity_function/src/main.nr b/tooling/nargo_cli/tests/execution_success/brillig_identity_function/src/main.nr index f711c5e86ba..ca646140f21 100644 --- a/tooling/nargo_cli/tests/execution_success/brillig_identity_function/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/brillig_identity_function/src/main.nr @@ -6,7 +6,7 @@ struct myStruct { // Tests a very simple program. // // The features being tested is the identity function in Brillig -fn main(x : Field) { +fn main(x : Field) { assert(x == identity(x)); // TODO: add support for array comparison let arr = identity_array([x, x]); @@ -21,13 +21,13 @@ fn main(x : Field) { } unconstrained fn identity(x : Field) -> Field { - x + x } unconstrained fn identity_array(arr : [Field; 2]) -> [Field; 2] { - arr + arr } unconstrained fn identity_struct(s : myStruct) -> myStruct { - s + s } diff --git a/tooling/nargo_cli/tests/execution_success/brillig_keccak/src/main.nr b/tooling/nargo_cli/tests/execution_success/brillig_keccak/src/main.nr index fcc2a772d10..46c2a59f6b6 100644 --- a/tooling/nargo_cli/tests/execution_success/brillig_keccak/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/brillig_keccak/src/main.nr @@ -9,7 +9,7 @@ fn main(x: Field, result: [u8; 32]) { let digest = keccak256([x as u8], 1); assert(digest == result); - //#1399: variable meesage size + //#1399: variable meesage size let message_size = 4; let hash_a = keccak256([1,2,3,4], message_size); let hash_b = keccak256([1,2,3,4,0,0,0,0], message_size); diff --git a/tooling/nargo_cli/tests/execution_success/brillig_loop/src/main.nr b/tooling/nargo_cli/tests/execution_success/brillig_loop/src/main.nr index e469248239e..05d35469342 100644 --- a/tooling/nargo_cli/tests/execution_success/brillig_loop/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/brillig_loop/src/main.nr @@ -1,7 +1,7 @@ // Tests a very simple program. // // The features being tested is basic looping on brillig -fn main(sum: u32){ +fn main(sum: u32) { assert(loop(4) == sum); assert(plain_loop() == sum); } diff --git a/tooling/nargo_cli/tests/execution_success/brillig_not/src/main.nr b/tooling/nargo_cli/tests/execution_success/brillig_not/src/main.nr index 0466649f67c..34ed2199902 100644 --- a/tooling/nargo_cli/tests/execution_success/brillig_not/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/brillig_not/src/main.nr @@ -1,7 +1,7 @@ // Tests a very simple Brillig function. // // The features being tested is not instruction on brillig -fn main(x: Field, y : Field) { +fn main(x: Field, y : Field) { assert(false == not_operator(x as bool)); assert(true == not_operator(y as bool)); } diff --git a/tooling/nargo_cli/tests/execution_success/brillig_oracle/src/main.nr b/tooling/nargo_cli/tests/execution_success/brillig_oracle/src/main.nr index 84dcb1a0915..ece23996a65 100644 --- a/tooling/nargo_cli/tests/execution_success/brillig_oracle/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/brillig_oracle/src/main.nr @@ -1,7 +1,7 @@ use dep::std::slice; // Tests oracle usage in brillig/unconstrained functions -fn main(x: Field) { +fn main(x: Field) { get_number_sequence_wrapper(20); } diff --git a/tooling/nargo_cli/tests/execution_success/brillig_pedersen/src/main.nr b/tooling/nargo_cli/tests/execution_success/brillig_pedersen/src/main.nr index d41a7bd95ef..24de7f0ac83 100644 --- a/tooling/nargo_cli/tests/execution_success/brillig_pedersen/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/brillig_pedersen/src/main.nr @@ -14,4 +14,4 @@ unconstrained fn main(x: Field, y: Field, salt: Field, out_x: Field, out_y: Fiel let hash = std::hash::pedersen_with_separator([state], 0); assert(std::hash::pedersen_with_separator([43], 0)[0] == hash[0]); } - + diff --git a/tooling/nargo_cli/tests/execution_success/brillig_recursion/src/main.nr b/tooling/nargo_cli/tests/execution_success/brillig_recursion/src/main.nr index 974d26165b6..43d1034fbbf 100644 --- a/tooling/nargo_cli/tests/execution_success/brillig_recursion/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/brillig_recursion/src/main.nr @@ -1,7 +1,7 @@ // Tests a very simple program. // // The feature being tested is brillig recursion -fn main(x: u32) { +fn main(x: u32) { assert(fibonacci(x) == 55); } diff --git a/tooling/nargo_cli/tests/execution_success/brillig_scalar_mul/src/main.nr b/tooling/nargo_cli/tests/execution_success/brillig_scalar_mul/src/main.nr index 8383c7fd2e5..b95a8d4ef4a 100644 --- a/tooling/nargo_cli/tests/execution_success/brillig_scalar_mul/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/brillig_scalar_mul/src/main.nr @@ -8,15 +8,15 @@ unconstrained fn main( b_pub_x: pub Field, b_pub_y: pub Field ) { - let mut priv_key = a; - let mut pub_x: Field = a_pub_x; - let mut pub_y: Field = a_pub_y; - if a != 1 { // Change `a` in Prover.toml to test input `b` + let mut priv_key = a; + let mut pub_x: Field = a_pub_x; + let mut pub_y: Field = a_pub_y; + if a != 1 { // Change `a` in Prover.toml to test input `b` priv_key = b; pub_x = b_pub_x; pub_y = b_pub_y; } - let res = std::scalar_mul::fixed_base_embedded_curve(priv_key, 0); + let res = std::scalar_mul::fixed_base_embedded_curve(priv_key, 0); assert(res[0] == pub_x); assert(res[1] == pub_y); } diff --git a/tooling/nargo_cli/tests/execution_success/brillig_to_bytes_integration/src/main.nr b/tooling/nargo_cli/tests/execution_success/brillig_to_bytes_integration/src/main.nr index 08986867dfc..775d1e512d9 100644 --- a/tooling/nargo_cli/tests/execution_success/brillig_to_bytes_integration/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/brillig_to_bytes_integration/src/main.nr @@ -1,6 +1,6 @@ use dep::std; -unconstrained fn main(x : Field, _y: Field) { +unconstrained fn main(x : Field, _y: Field) { // The result of this byte array will be big-endian let y: Field = 2040124; let be_byte_array = y.to_be_bytes(31); @@ -23,5 +23,5 @@ unconstrained fn main(x : Field, _y: Field) { assert(z_bits[0] == 0); assert(p_bits[100] == z_bits[100]); - _y.to_le_bits(std::field::modulus_num_bits() as u32); + _y.to_le_bits(std::field::modulus_num_bits() as u32); } diff --git a/tooling/nargo_cli/tests/execution_success/brillig_top_level/src/main.nr b/tooling/nargo_cli/tests/execution_success/brillig_top_level/src/main.nr index 4a781e89d78..6dfd98b2c3e 100644 --- a/tooling/nargo_cli/tests/execution_success/brillig_top_level/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/brillig_top_level/src/main.nr @@ -1,7 +1,6 @@ // Tests a very simple program. // // The feature being tested is brillig as the entry point. - unconstrained fn main(array: [Field; 3], x: pub Field) -> pub [Field; 2] { [array[x], array[x + 1]] } diff --git a/tooling/nargo_cli/tests/execution_success/brillig_unitialised_arrays/src/main.nr b/tooling/nargo_cli/tests/execution_success/brillig_unitialised_arrays/src/main.nr index 4f24e179124..5ec657b0d35 100644 --- a/tooling/nargo_cli/tests/execution_success/brillig_unitialised_arrays/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/brillig_unitialised_arrays/src/main.nr @@ -1,5 +1,4 @@ - -fn main(x: Field, y: Field) -> pub Field { +fn main(x: Field, y: Field) -> pub Field { let notes = create_notes(x, y); sum_x(notes, x, y) } diff --git a/tooling/nargo_cli/tests/execution_success/cast_bool/src/main.nr b/tooling/nargo_cli/tests/execution_success/cast_bool/src/main.nr index 57af8120b33..422d3b98f83 100644 --- a/tooling/nargo_cli/tests/execution_success/cast_bool/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/cast_bool/src/main.nr @@ -3,4 +3,4 @@ fn main(x: Field, y: Field) { let t = z as u8; assert(t == 1); } - + diff --git a/tooling/nargo_cli/tests/execution_success/closures_mut_ref/src/main.nr b/tooling/nargo_cli/tests/execution_success/closures_mut_ref/src/main.nr index 2888745a96e..99de3dd31e4 100644 --- a/tooling/nargo_cli/tests/execution_success/closures_mut_ref/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/closures_mut_ref/src/main.nr @@ -28,4 +28,4 @@ fn issue_2120() { assert(*x1 == 44); set_x1(*x1); assert(*x1 == 44); -} \ No newline at end of file +} diff --git a/tooling/nargo_cli/tests/execution_success/conditional_1/src/main.nr b/tooling/nargo_cli/tests/execution_success/conditional_1/src/main.nr index 4d1eeae0fe7..176106ba890 100644 --- a/tooling/nargo_cli/tests/execution_success/conditional_1/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/conditional_1/src/main.nr @@ -1,6 +1,6 @@ use dep::std; -fn sort(mut a: [u32; 4]) -> [u32; 4] { +fn sort(mut a: [u32; 4]) -> [u32; 4] { for i in 1..4 { for j in 0..i { if a[i] < a[j] { @@ -13,13 +13,11 @@ fn sort(mut a: [u32; 4]) -> [u32; 4] { a } - fn must_be_zero(x: u8) { assert(x == 0); } -fn main(a: u32, mut c: [u32; 4], x: [u8; 5], result: pub [u8; 32]){ - +fn main(a: u32, mut c: [u32; 4], x: [u8; 5], result: pub [u8; 32]) { //Test case for short-circuit let mut data = [0 as u32; 32]; let mut ba = a; @@ -96,5 +94,4 @@ fn main(a: u32, mut c: [u32; 4], x: [u8; 5], result: pub [u8; 32]){ } } assert(x == 0); - -} \ No newline at end of file +} diff --git a/tooling/nargo_cli/tests/execution_success/conditional_2/src/main.nr b/tooling/nargo_cli/tests/execution_success/conditional_2/src/main.nr index af5b46c003e..70237d4b638 100644 --- a/tooling/nargo_cli/tests/execution_success/conditional_2/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/conditional_2/src/main.nr @@ -1,6 +1,5 @@ use dep::std; - fn must_be_zero(x: u8) { assert(x == 0); } @@ -17,7 +16,6 @@ fn test4() -> [u32; 4] { } fn main(a: u32, mut c: [u32; 4]) { - test3(1); if a == 0 { diff --git a/tooling/nargo_cli/tests/execution_success/conditional_regression_421/src/main.nr b/tooling/nargo_cli/tests/execution_success/conditional_regression_421/src/main.nr index b31cf761be8..60052c20610 100644 --- a/tooling/nargo_cli/tests/execution_success/conditional_regression_421/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/conditional_regression_421/src/main.nr @@ -1,4 +1,4 @@ -fn main(a: u32, mut c: [u32; 4]){ +fn main(a: u32, mut c: [u32; 4]) { //Issue reported in #421 if a == c[0] { assert(c[0] == 0); diff --git a/tooling/nargo_cli/tests/execution_success/conditional_regression_547/src/main.nr b/tooling/nargo_cli/tests/execution_success/conditional_regression_547/src/main.nr index 1bd69f03ea7..41ccbb00a2a 100644 --- a/tooling/nargo_cli/tests/execution_success/conditional_regression_547/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/conditional_regression_547/src/main.nr @@ -12,8 +12,7 @@ fn main(x: Field) -> pub Field { x + safe_inverse(0) } -fn safe_inverse(n: Field) -> Field -{ +fn safe_inverse(n: Field) -> Field { if n == 0 { 0 } diff --git a/tooling/nargo_cli/tests/execution_success/conditional_regression_579/src/main.nr b/tooling/nargo_cli/tests/execution_success/conditional_regression_579/src/main.nr index ae1d11eef77..a479a7a6fbf 100644 --- a/tooling/nargo_cli/tests/execution_success/conditional_regression_579/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/conditional_regression_579/src/main.nr @@ -1,4 +1,4 @@ -fn main(){ +fn main() { //Regression for Issue #579 let result1_true = test(true); assert(result1_true.array_param[0] == 1); @@ -19,7 +19,7 @@ impl MyStruct579 { } fn test(flag: bool) -> MyStruct579 { - let mut my_struct = MyStruct579::new([0; 2]); + let mut my_struct = MyStruct579::new([0; 2]); if flag == true { my_struct= MyStruct579::new([1; 2]); diff --git a/tooling/nargo_cli/tests/execution_success/conditional_regression_661/src/main.nr b/tooling/nargo_cli/tests/execution_success/conditional_regression_661/src/main.nr index 375b49cc27b..efdc1ddbce4 100644 --- a/tooling/nargo_cli/tests/execution_success/conditional_regression_661/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/conditional_regression_661/src/main.nr @@ -1,6 +1,6 @@ -fn main(a: u32, mut c: [u32; 4]){ +fn main(a: u32, mut c: [u32; 4]) { // Regression for issue #661: - let mut c_661 :[u32;1]=[0]; + let mut c_661: [u32; 1] = [0]; if a > 5 { c_661 = issue_661_foo(issue_661_bar(c), a); } else { @@ -16,13 +16,12 @@ fn test5(a : u32) { } } - fn issue_661_foo(array: [u32;4], b:u32) ->[u32;1] { [array[0] + b] } fn issue_661_bar(a : [u32;4]) ->[u32;4] { - let mut b:[u32;4] = [0;4]; + let mut b: [u32; 4] = [0;4]; b[0]=a[0]+1; b } diff --git a/tooling/nargo_cli/tests/execution_success/conditional_regression_short_circuit/src/main.nr b/tooling/nargo_cli/tests/execution_success/conditional_regression_short_circuit/src/main.nr index 4fb4c37a1ab..57387ed5052 100644 --- a/tooling/nargo_cli/tests/execution_success/conditional_regression_short_circuit/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/conditional_regression_short_circuit/src/main.nr @@ -1,6 +1,6 @@ use dep::std; -fn main(a: u32, mut c: [u32; 4], x: [u8; 5], result: pub [u8; 32]){ +fn main(a: u32, mut c: [u32; 4], x: [u8; 5], result: pub [u8; 32]) { //regression for short-circuit2 if 35 == a { assert(false); @@ -14,8 +14,6 @@ fn main(a: u32, mut c: [u32; 4], x: [u8; 5], result: pub [u8; 32]){ call_intrinsic(x, result); } - - fn foo() { let mut x = 1; x /= 0; @@ -27,7 +25,6 @@ fn bar(x:Field) { } } - fn call_intrinsic(x: [u8; 5], result: [u8; 32]) { let mut digest = std::hash::sha256(x); digest[0] = 5 as u8; @@ -38,4 +35,4 @@ fn call_intrinsic(x: [u8; 5], result: [u8; 32]) { fn test4() -> [u32; 4] { let b: [u32; 4] = [1,2,3,4]; b -} \ No newline at end of file +} diff --git a/tooling/nargo_cli/tests/execution_success/conditional_regression_to_bits/src/main.nr b/tooling/nargo_cli/tests/execution_success/conditional_regression_to_bits/src/main.nr index 8c612ca0eb2..e5450334c5e 100644 --- a/tooling/nargo_cli/tests/execution_success/conditional_regression_to_bits/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/conditional_regression_to_bits/src/main.nr @@ -1,8 +1,6 @@ use dep::std; - fn main() { - //Regression for to_le_bits() constant evaluation // binary array representation of u8 1 let arr: [u8; 2] = [1, 2]; @@ -26,7 +24,5 @@ fn main() { } } assert(c1 == 1); - - } diff --git a/tooling/nargo_cli/tests/execution_success/debug_logs/src/main.nr b/tooling/nargo_cli/tests/execution_success/debug_logs/src/main.nr index f17e20fac3d..23c6b8a76d4 100644 --- a/tooling/nargo_cli/tests/execution_success/debug_logs/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/debug_logs/src/main.nr @@ -25,12 +25,12 @@ fn main(x : Field, y : pub Field) { std::println(x); std::println([x, y]); - + let foo = fooStruct { my_struct: s, foo: 15 }; std::println(f"s: {s}, foo: {foo}"); std::println(f"x: 0, y: 1"); - + let s_2 = myStruct { x: 20, y: 30 }; std::println(f"s1: {s}, s2: {s_2}"); @@ -67,7 +67,7 @@ struct fooStruct { fn regression_2906() { let array_two_vals = [1, 2]; - dep::std::println(f"array_two_vals: {array_two_vals}"); + dep::std::println(f"array_two_vals: {array_two_vals}"); let label_two_vals = "12"; dep::std::println(f"label_two_vals: {label_two_vals}"); @@ -79,4 +79,4 @@ fn regression_2906() { dep::std::println(f"label_five_vals: {label_five_vals}"); dep::std::println(f"array_five_vals: {array_five_vals}, label_five_vals: {label_five_vals}"); -} \ No newline at end of file +} diff --git a/tooling/nargo_cli/tests/execution_success/diamond_deps_0/src/main.nr b/tooling/nargo_cli/tests/execution_success/diamond_deps_0/src/main.nr index f01491171bb..1c4dba1c791 100644 --- a/tooling/nargo_cli/tests/execution_success/diamond_deps_0/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/diamond_deps_0/src/main.nr @@ -4,4 +4,4 @@ use dep::dep2::RESOLVE_THIS; fn main(x : Field, y : pub Field) -> pub Field { call_dep1_then_dep2(x, y) + call_dep2(x, y) + RESOLVE_THIS -} \ No newline at end of file +} diff --git a/tooling/nargo_cli/tests/execution_success/double_verify_proof/src/main.nr b/tooling/nargo_cli/tests/execution_success/double_verify_proof/src/main.nr index 39b8c142ace..c679730e3c0 100644 --- a/tooling/nargo_cli/tests/execution_success/double_verify_proof/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/double_verify_proof/src/main.nr @@ -23,7 +23,7 @@ fn main( key_hash, output_aggregation_object_a ); - + let mut output = [0; 16]; for i in 0..16 { output[i] = output_aggregation_object[i]; diff --git a/tooling/nargo_cli/tests/execution_success/ecdsa_secp256k1/src/main.nr b/tooling/nargo_cli/tests/execution_success/ecdsa_secp256k1/src/main.nr index 2512531cb04..5af8008f291 100644 --- a/tooling/nargo_cli/tests/execution_success/ecdsa_secp256k1/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/ecdsa_secp256k1/src/main.nr @@ -2,9 +2,9 @@ use dep::std; fn main(message : [u8;38],hashed_message : [u8;32], pub_key_x : [u8;32], pub_key_y : [u8;32], signature : [u8;64]) { // Hash the message, since secp256k1 expects a hashed_message - let expected= std::hash::sha256(message); + let expected = std::hash::sha256(message); assert(hashed_message == expected); - let valid_signature = std::ecdsa_secp256k1::verify_signature(pub_key_x, pub_key_y, signature, hashed_message); + let valid_signature = std::ecdsa_secp256k1::verify_signature(pub_key_x, pub_key_y, signature, hashed_message); assert(valid_signature); } diff --git a/tooling/nargo_cli/tests/execution_success/ecdsa_secp256r1/src/main.nr b/tooling/nargo_cli/tests/execution_success/ecdsa_secp256r1/src/main.nr index e81d84fd902..eda78cd81a6 100644 --- a/tooling/nargo_cli/tests/execution_success/ecdsa_secp256r1/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/ecdsa_secp256r1/src/main.nr @@ -1,6 +1,6 @@ use dep::std; fn main(hashed_message : [u8;32], pub_key_x : [u8;32], pub_key_y : [u8;32], signature : [u8;64]) { - let valid_signature = std::ecdsa_secp256r1::verify_signature(pub_key_x, pub_key_y, signature, hashed_message); + let valid_signature = std::ecdsa_secp256r1::verify_signature(pub_key_x, pub_key_y, signature, hashed_message); assert(valid_signature); } diff --git a/tooling/nargo_cli/tests/execution_success/generics/src/main.nr b/tooling/nargo_cli/tests/execution_success/generics/src/main.nr index 4c87bc685f1..9a1effcd318 100644 --- a/tooling/nargo_cli/tests/execution_success/generics/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/generics/src/main.nr @@ -49,7 +49,6 @@ fn main(x: Field, y: Field) { // Expected type error // assert(bar2.get_other() == bar2.other); - let one = x; let two = y; let nested_generics: Bar> = Bar { one, two, other: Bar { one, two, other: 0 } }; diff --git a/tooling/nargo_cli/tests/execution_success/global_consts/src/foo/bar.nr b/tooling/nargo_cli/tests/execution_success/global_consts/src/foo/bar.nr index b839ff28ac6..b4b43442cc8 100644 --- a/tooling/nargo_cli/tests/execution_success/global_consts/src/foo/bar.nr +++ b/tooling/nargo_cli/tests/execution_success/global_consts/src/foo/bar.nr @@ -2,4 +2,4 @@ global N: Field = 5; pub fn from_bar(x : Field) -> Field { x * N -} \ No newline at end of file +} diff --git a/tooling/nargo_cli/tests/execution_success/global_consts/src/main.nr b/tooling/nargo_cli/tests/execution_success/global_consts/src/main.nr index e741de50c86..0c3a4fcd771 100644 --- a/tooling/nargo_cli/tests/execution_success/global_consts/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/global_consts/src/main.nr @@ -19,7 +19,7 @@ global VALS: [Test; 1] = [Test { v: 100 }]; global NESTED = [VALS, VALS]; fn main(a: [Field; M + N - N], b: [Field; 30 + N / 2], c : pub [Field; foo::MAGIC_NUMBER], d: [Field; foo::bar::N]) { - let test_struct = Dummy { x: d, y: c }; + let test_struct = Dummy { x: d, y: c }; for i in 0..foo::MAGIC_NUMBER { assert(c[i] == foo::MAGIC_NUMBER); @@ -28,12 +28,12 @@ fn main(a: [Field; M + N - N], b: [Field; 30 + N / 2], c : pub [Field; foo::MAGI } assert(N != M); - - let expected: u32 = 42; + + let expected: u32 = 42; assert(foo::TYPE_INFERRED == expected); - let mut y = 5; - let mut x = M; + let mut y = 5; + let mut x = M; for i in 0..N*N { let M: Field = 10; x = M; @@ -43,34 +43,34 @@ fn main(a: [Field; M + N - N], b: [Field; 30 + N / 2], c : pub [Field; foo::MAGI assert(y == 24); assert(x == 10); - let q = multiplyByM(3); + let q = multiplyByM(3); assert(q == 96); - arrays_neq(a, b); + arrays_neq(a, b); - let t: [Field; T_LEN] = [N, M]; + let t: [Field; T_LEN] = [N, M]; assert(t[1] == 32); assert(15 == mysubmodule::my_helper()); - - let add_submodules_N = mysubmodule::N + foo::bar::N; + + let add_submodules_N = mysubmodule::N + foo::bar::N; assert(15 == add_submodules_N); - let add_from_bar_N = mysubmodule::N + foo::bar::from_bar(1); + let add_from_bar_N = mysubmodule::N + foo::bar::from_bar(1); assert(15 == add_from_bar_N); // Example showing an array filled with (mysubmodule::N + 2) 0's - let sugared = [0; mysubmodule::N + 2]; + let sugared = [0; mysubmodule::N + 2]; assert(sugared[mysubmodule::N + 1] == 0); - let arr: [Field; mysubmodule::N] = [N; 10]; + let arr: [Field; mysubmodule::N] = [N; 10]; assert((arr[0] == 5) & (arr[9] == 5)); - foo::from_foo(d); - baz::from_baz(c); + foo::from_foo(d); + baz::from_baz(c); } fn multiplyByM(x: Field) -> Field { - x * M + x * M } fn arrays_neq(a: [Field; M], b: [Field; M]) { diff --git a/tooling/nargo_cli/tests/execution_success/if_else_chain/src/main.nr b/tooling/nargo_cli/tests/execution_success/if_else_chain/src/main.nr index f83ba2dde0e..9fd5fbfd3d3 100644 --- a/tooling/nargo_cli/tests/execution_success/if_else_chain/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/if_else_chain/src/main.nr @@ -1,4 +1,4 @@ -fn main(a: u32, mut c: [u32; 4]){ +fn main(a: u32, mut c: [u32; 4]) { if a == c[0] { assert(c[0] == 0); } else if a == c[1] { diff --git a/tooling/nargo_cli/tests/execution_success/import/src/import.nr b/tooling/nargo_cli/tests/execution_success/import/src/import.nr index 3dfa96992ad..4df05bbc288 100644 --- a/tooling/nargo_cli/tests/execution_success/import/src/import.nr +++ b/tooling/nargo_cli/tests/execution_success/import/src/import.nr @@ -1,4 +1,3 @@ - pub fn hello(x : Field) -> Field { x -} \ No newline at end of file +} diff --git a/tooling/nargo_cli/tests/execution_success/integer_array_indexing/src/main.nr b/tooling/nargo_cli/tests/execution_success/integer_array_indexing/src/main.nr index 1e0ec518b9f..1698c68161b 100644 --- a/tooling/nargo_cli/tests/execution_success/integer_array_indexing/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/integer_array_indexing/src/main.nr @@ -1,12 +1,10 @@ global ARRAY_LEN: u32 = 3; fn main(arr: [Field; ARRAY_LEN], x: u32) -> pub Field { - let mut value = arr[ARRAY_LEN - 1]; value += arr[0 as u32]; value += arr[1 as Field]; - value + (x as Field) - + value + x as Field } diff --git a/tooling/nargo_cli/tests/execution_success/keccak256/src/main.nr b/tooling/nargo_cli/tests/execution_success/keccak256/src/main.nr index ba3ed7d07af..9bca6a7c1bf 100644 --- a/tooling/nargo_cli/tests/execution_success/keccak256/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/keccak256/src/main.nr @@ -8,7 +8,7 @@ fn main(x: Field, result: [u8; 32]) { let digest = std::hash::keccak256([x as u8], 1); assert(digest == result); - //#1399: variable meesage size + //#1399: variable meesage size let message_size = 4; let hash_a = std::hash::keccak256([1,2,3,4], message_size); let hash_b = std::hash::keccak256([1,2,3,4,0,0,0,0], message_size); diff --git a/tooling/nargo_cli/tests/execution_success/mock_oracle/src/main.nr b/tooling/nargo_cli/tests/execution_success/mock_oracle/src/main.nr index 405f34a4a70..07553f05d6c 100644 --- a/tooling/nargo_cli/tests/execution_success/mock_oracle/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/mock_oracle/src/main.nr @@ -8,7 +8,7 @@ struct Point { #[oracle(foo)] unconstrained fn foo_oracle(_point: Point, _array: [Field; 4]) -> Field {} -unconstrained fn main() { +unconstrained fn main() { let array = [1,2,3,4]; let another_array = [4,3,2,1]; let point = Point { diff --git a/tooling/nargo_cli/tests/execution_success/modules/src/foo.nr b/tooling/nargo_cli/tests/execution_success/modules/src/foo.nr index 1f10d8ddd8d..4df05bbc288 100644 --- a/tooling/nargo_cli/tests/execution_success/modules/src/foo.nr +++ b/tooling/nargo_cli/tests/execution_success/modules/src/foo.nr @@ -1,3 +1,3 @@ pub fn hello(x : Field) -> Field { x -} \ No newline at end of file +} diff --git a/tooling/nargo_cli/tests/execution_success/modules_more/src/foo/bar.nr b/tooling/nargo_cli/tests/execution_success/modules_more/src/foo/bar.nr index 4f459b040d6..3d07fd9b72f 100644 --- a/tooling/nargo_cli/tests/execution_success/modules_more/src/foo/bar.nr +++ b/tooling/nargo_cli/tests/execution_success/modules_more/src/foo/bar.nr @@ -1,3 +1,3 @@ pub fn from_bar(x : Field) -> Field { x -} \ No newline at end of file +} diff --git a/tooling/nargo_cli/tests/execution_success/modulus/src/main.nr b/tooling/nargo_cli/tests/execution_success/modulus/src/main.nr index 6dda450df5d..e8d0cc0541a 100644 --- a/tooling/nargo_cli/tests/execution_success/modulus/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/modulus/src/main.nr @@ -4,7 +4,7 @@ fn main(bn254_modulus_be_bytes : [u8; 32], bn254_modulus_be_bits : [u1; 254]) { let modulus_size = std::field::modulus_num_bits(); // NOTE: The constraints used in this circuit will only work when testing nargo with the plonk bn254 backend assert(modulus_size == 254); - + let modulus_be_byte_array = std::field::modulus_be_bytes(); for i in 0..32 { assert(modulus_be_byte_array[i] == bn254_modulus_be_bytes[i]); diff --git a/tooling/nargo_cli/tests/execution_success/nested_array_dynamic/src/main.nr b/tooling/nargo_cli/tests/execution_success/nested_array_dynamic/src/main.nr index 5f15905dfba..5538c08d778 100644 --- a/tooling/nargo_cli/tests/execution_success/nested_array_dynamic/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/nested_array_dynamic/src/main.nr @@ -24,7 +24,7 @@ fn main(mut x : [Foo; 4], y : pub Field) { assert(x[y].b == [11, 12, 23]); assert(x[y].bar.inner == [109, 110, 111]); - // Check dynamic array set + // Check dynamic array set if y != 2 { x[y].a = 50; } else { diff --git a/tooling/nargo_cli/tests/execution_success/nested_slice_dynamic/src/main.nr b/tooling/nargo_cli/tests/execution_success/nested_slice_dynamic/src/main.nr index d4740902a52..a2de5141786 100644 --- a/tooling/nargo_cli/tests/execution_success/nested_slice_dynamic/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/nested_slice_dynamic/src/main.nr @@ -46,4 +46,4 @@ fn main(y : Field) { assert(x[y - 2].bar.inner == [103, 104, 105]); assert(x[y - 1].bar.inner == [106, 107, 108]); assert(x[y].bar.inner == [109, 110, 111]); -} \ No newline at end of file +} diff --git a/tooling/nargo_cli/tests/execution_success/pedersen_check/src/main.nr b/tooling/nargo_cli/tests/execution_success/pedersen_check/src/main.nr index 37fc3f61188..0e5c6b2c5b4 100644 --- a/tooling/nargo_cli/tests/execution_success/pedersen_check/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/pedersen_check/src/main.nr @@ -14,4 +14,4 @@ fn main(x: Field, y: Field, salt: Field, out_x: Field, out_y: Field ) { let hash = std::hash::pedersen([state]); assert(std::hash::pedersen([43])[0] == hash[0]); } - + diff --git a/tooling/nargo_cli/tests/execution_success/poseidon_bn254_hash/src/main.nr b/tooling/nargo_cli/tests/execution_success/poseidon_bn254_hash/src/main.nr index 37621c732a8..3d30ebad279 100644 --- a/tooling/nargo_cli/tests/execution_success/poseidon_bn254_hash/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/poseidon_bn254_hash/src/main.nr @@ -1,7 +1,6 @@ use dep::std::hash::poseidon; -fn main(x1: [Field; 2], y1: pub Field, x2: [Field; 4], y2: pub Field) -{ +fn main(x1: [Field; 2], y1: pub Field, x2: [Field; 4], y2: pub Field) { let hash1 = poseidon::bn254::hash_2(x1); assert(hash1 == y1); diff --git a/tooling/nargo_cli/tests/execution_success/poseidonsponge_x5_254/src/main.nr b/tooling/nargo_cli/tests/execution_success/poseidonsponge_x5_254/src/main.nr index 3addc1cec97..aba7ba41f35 100644 --- a/tooling/nargo_cli/tests/execution_success/poseidonsponge_x5_254/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/poseidonsponge_x5_254/src/main.nr @@ -1,7 +1,6 @@ use dep::std::hash::poseidon; -fn main(x: [Field; 7]) -{ +fn main(x: [Field; 7]) { // Test optimised sponge let result = poseidon::bn254::sponge(x); diff --git a/tooling/nargo_cli/tests/execution_success/references/src/main.nr b/tooling/nargo_cli/tests/execution_success/references/src/main.nr index be02f2b10d6..5265519f2a8 100644 --- a/tooling/nargo_cli/tests/execution_success/references/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/references/src/main.nr @@ -162,7 +162,7 @@ fn regression_2218_if_inner_else(x: Field, y: Field) { fn regression_2218_else(x: Field, y: Field) { let value = regression_2218(x, y); - assert(value == 20); + assert(value == 20); } fn regression_2218_loop(x: Field, y: Field) { @@ -215,7 +215,7 @@ fn regression_2218_loop(x: Field, y: Field) { assert(*q1 == 20); } } - assert(*q1 == 2); + assert(*q1 == 2); if x != y { for _ in 0..5 { @@ -234,7 +234,7 @@ fn regression_2218_loop(x: Field, y: Field) { *q2 = 20; assert(*q1 == 20); } - assert(*q1 == 2); + assert(*q1 == 2); } // This is more a feature test than a proper regression. diff --git a/tooling/nargo_cli/tests/execution_success/regression/src/main.nr b/tooling/nargo_cli/tests/execution_success/regression/src/main.nr index 4ae4f6a91f1..010468a450a 100644 --- a/tooling/nargo_cli/tests/execution_success/regression/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/regression/src/main.nr @@ -1,15 +1,14 @@ global NIBBLE_LENGTH: Field = 16; -fn compact_decode(input: [u8; N], length: Field) -> ([u4; NIBBLE_LENGTH], Field) -{ +fn compact_decode(input: [u8; N], length: Field) -> ([u4; NIBBLE_LENGTH], Field) { assert(2*input.len() as u64 <= NIBBLE_LENGTH as u64); assert(length as u64 <= input.len() as u64); - + let mut nibble = [0 as u4; NIBBLE_LENGTH]; let first_nibble = (input[0] >> 4) as u4; let parity = first_nibble as u1; - + if parity == 1 { nibble[0] = (input[0] & 0x0f) as u4; @@ -41,8 +40,7 @@ fn compact_decode(input: [u8; N], length: Field) -> ([u4; NIBBLE_LENGTH], Fie out } -fn enc(value: [u8; N], value_length: Field) -> ([u8; 32], Field) -{ +fn enc(value: [u8; N], value_length: Field) -> ([u8; 32], Field) { assert(value.len() as u8 >= value_length as u8); let mut out_value = [0; 32]; if value_length == 0 @@ -90,16 +88,14 @@ fn bitshift_variable(idx: u64) -> u64 { bits } - -fn main(x: [u8; 5], z: Field) -{ +fn main(x: [u8; 5], z: Field) { //Issue 1144 - let (nib, len) = compact_decode(x,z); + let (nib, len) = compact_decode(x,z); assert(len == 5); assert([nib[0], nib[1], nib[2], nib[3], nib[4]] == [15, 1, 12, 11, 8]); // Issue 1169 - let val1 = [0xb8,0x8f,0x61,0xe6,0xfb,0xda,0x83,0xfb,0xff,0xfa,0xbe,0x36,0x41,0x12,0x13,0x74,0x80,0x39,0x80,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]; + let val1 = [0xb8,0x8f,0x61,0xe6,0xfb,0xda,0x83,0xfb,0xff,0xfa,0xbe,0x36,0x41,0x12,0x13,0x74,0x80,0x39,0x80,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]; let val1_length = 20; let enc_val1 = enc(val1,val1_length); @@ -112,9 +108,8 @@ fn main(x: [u8; 5], z: Field) assert(result_0 == 1); let result_4 = bitshift_literal_4(); assert(result_4 == 16); - let result_0 = bitshift_variable(0); + let result_0 = bitshift_variable(0); assert(result_0 == 1); let result_4 = bitshift_variable(4); assert(result_4 == 16); - } diff --git a/tooling/nargo_cli/tests/execution_success/regression_mem_op_predicate/src/main.nr b/tooling/nargo_cli/tests/execution_success/regression_mem_op_predicate/src/main.nr index a592e2b62b4..368ca50397f 100644 --- a/tooling/nargo_cli/tests/execution_success/regression_mem_op_predicate/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/regression_mem_op_predicate/src/main.nr @@ -1,8 +1,8 @@ fn main(mut x: [u32; 5], idx: Field) { // We should not hit out of bounds here as we have a predicate // that should not be hit - if idx as u32 < 3 { + if idx as u32 < 3 { x[idx] = 10; } assert(x[4] == 111); -} \ No newline at end of file +} diff --git a/tooling/nargo_cli/tests/execution_success/scalar_mul/src/main.nr b/tooling/nargo_cli/tests/execution_success/scalar_mul/src/main.nr index 37f3ac410f0..87641b407d6 100644 --- a/tooling/nargo_cli/tests/execution_success/scalar_mul/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/scalar_mul/src/main.nr @@ -8,15 +8,15 @@ fn main( b_pub_x: pub Field, b_pub_y: pub Field ) { - let mut priv_key = a; - let mut pub_x: Field = a_pub_x; - let mut pub_y: Field = a_pub_y; - if a != 1 { // Change `a` in Prover.toml to test input `b` + let mut priv_key = a; + let mut pub_x: Field = a_pub_x; + let mut pub_y: Field = a_pub_y; + if a != 1 { // Change `a` in Prover.toml to test input `b` priv_key = b; pub_x = b_pub_x; pub_y = b_pub_y; } - let res = std::scalar_mul::fixed_base_embedded_curve(priv_key, 0); + let res = std::scalar_mul::fixed_base_embedded_curve(priv_key, 0); assert(res[0] == pub_x); assert(res[1] == pub_y); } diff --git a/tooling/nargo_cli/tests/execution_success/sha2_blocks/src/main.nr b/tooling/nargo_cli/tests/execution_success/sha2_blocks/src/main.nr index fcdcdb8684f..52891d18de2 100644 --- a/tooling/nargo_cli/tests/execution_success/sha2_blocks/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/sha2_blocks/src/main.nr @@ -1,22 +1,21 @@ // Test Noir implementations of SHA256 and SHA512 on one- and two-block (padded) messages. use dep::std; -fn main(x: [u8; 3], result256: [u8; 32], result512: [u8; 64]) -{ +fn main(x: [u8; 3], result256: [u8; 32], result512: [u8; 64]) { // One-block tests. - let mut digest256 = std::sha256::digest(x); + let mut digest256 = std::sha256::digest(x); assert(digest256 == result256); - let mut digest512 = std::sha512::digest(x); + let mut digest512 = std::sha512::digest(x); assert(digest512 == result512); // Two-block SHA256 test. Taken from https://csrc.nist.gov/CSRC/media/Projects/Cryptographic-Standards-and-Guidelines/documents/examples/SHA256.pdf - let y: [u8; 56] = [97,98,99,100,98,99,100,101,99,100,101,102,100,101,102,103,101,102,103,104,102,103,104,105,103,104,105,106,104,105,106,107,105,106,107,108,106,107,108,109,107,108,109,110,108,109,110,111,109,110,111,112,110,111,112,113]; // "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" + let y: [u8; 56] = [97,98,99,100,98,99,100,101,99,100,101,102,100,101,102,103,101,102,103,104,102,103,104,105,103,104,105,106,104,105,106,107,105,106,107,108,106,107,108,109,107,108,109,110,108,109,110,111,109,110,111,112,110,111,112,113]; // "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" digest256 = std::sha256::digest(y); assert(digest256 == [36,141,106,97,210,6,56,184,229,192,38,147,12,62,96,57,163,60,228,89,100,255,33,103,246,236,237,212,25,219,6,193]); // Two-block SHA256 test. Taken from https://csrc.nist.gov/CSRC/media/Projects/Cryptographic-Standards-and-Guidelines/documents/examples/SHA512.pdf - let z: [u8; 112] = [97,98,99,100,101,102,103,104,98,99,100,101,102,103,104,105,99,100,101,102,103,104,105,106,100,101,102,103,104,105,106,107,101,102,103,104,105,106,107,108,102,103,104,105,106,107,108,109,103,104,105,106,107,108,109,110,104,105,106,107,108,109,110,111,105,106,107,108,109,110,111,112,106,107,108,109,110,111,112,113,107,108,109,110,111,112,113,114,108,109,110,111,112,113,114,115,109,110,111,112,113,114,115,116,110,111,112,113,114,115,116,117]; // "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu" + let z: [u8; 112] = [97,98,99,100,101,102,103,104,98,99,100,101,102,103,104,105,99,100,101,102,103,104,105,106,100,101,102,103,104,105,106,107,101,102,103,104,105,106,107,108,102,103,104,105,106,107,108,109,103,104,105,106,107,108,109,110,104,105,106,107,108,109,110,111,105,106,107,108,109,110,111,112,106,107,108,109,110,111,112,113,107,108,109,110,111,112,113,114,108,109,110,111,112,113,114,115,109,110,111,112,113,114,115,116,110,111,112,113,114,115,116,117]; // "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu" digest512 = std::sha512::digest(z); assert(digest512 == [142,149,155,117,218,227,19,218,140,244,247,40,20,252,20,63,143,119,121,198,235,159,127,161,114,153,174,173,182,136,144,24,80,29,40,158,73,0,247,228,51,27,153,222,196,181,67,58,199,211,41,238,182,221,38,84,94,150,229,91,135,75,233,9]); } diff --git a/tooling/nargo_cli/tests/execution_success/sha2_byte/src/main.nr b/tooling/nargo_cli/tests/execution_success/sha2_byte/src/main.nr index a7cc9daebb9..6470ccd8379 100644 --- a/tooling/nargo_cli/tests/execution_success/sha2_byte/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/sha2_byte/src/main.nr @@ -1,11 +1,10 @@ // Test Noir implementations of SHA256 and SHA512 on a one-byte message. use dep::std; -fn main(x: Field, result256: [u8; 32], result512: [u8; 64]) -{ - let digest256 = std::sha256::digest([x as u8]); +fn main(x: Field, result256: [u8; 32], result512: [u8; 64]) { + let digest256 = std::sha256::digest([x as u8]); assert(digest256 == result256); - let digest512 = std::sha512::digest([x as u8]); + let digest512 = std::sha512::digest([x as u8]); assert(digest512 == result512); } diff --git a/tooling/nargo_cli/tests/execution_success/simple_array_param/src/main.nr b/tooling/nargo_cli/tests/execution_success/simple_array_param/src/main.nr index 8dc9b138496..60978bab519 100644 --- a/tooling/nargo_cli/tests/execution_success/simple_array_param/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/simple_array_param/src/main.nr @@ -1,7 +1,6 @@ // This program tests: // - the allocation of virtual arrays for array params to main // - load instructions for such arrays - fn main(xs : [Field; 2]) -> pub Field { xs[1] } diff --git a/tooling/nargo_cli/tests/execution_success/simple_comparison/src/main.nr b/tooling/nargo_cli/tests/execution_success/simple_comparison/src/main.nr index 671ea6cf35e..f224b8a9bee 100644 --- a/tooling/nargo_cli/tests/execution_success/simple_comparison/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/simple_comparison/src/main.nr @@ -1,6 +1,6 @@ // Tests a very simple program. // // The features being tested is comparison -fn main(x : Field, y : Field) { +fn main(x : Field, y : Field) { assert(x as u32 < y as u32); -} \ No newline at end of file +} diff --git a/tooling/nargo_cli/tests/execution_success/simple_mut/src/main.nr b/tooling/nargo_cli/tests/execution_success/simple_mut/src/main.nr index 502aceac546..bba0eca5fab 100644 --- a/tooling/nargo_cli/tests/execution_success/simple_mut/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/simple_mut/src/main.nr @@ -1,5 +1,4 @@ // A simple program to test mutable variables - fn main(x : Field) -> pub Field { let mut y = 2; y += x; diff --git a/tooling/nargo_cli/tests/execution_success/simple_not/src/main.nr b/tooling/nargo_cli/tests/execution_success/simple_not/src/main.nr index 0069932cf24..4b17fd91eca 100644 --- a/tooling/nargo_cli/tests/execution_success/simple_not/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/simple_not/src/main.nr @@ -1,4 +1,4 @@ // A simple program for testing the NOT op fn main(x : bool) -> pub bool { !x -} \ No newline at end of file +} diff --git a/tooling/nargo_cli/tests/execution_success/simple_program_addition/src/main.nr b/tooling/nargo_cli/tests/execution_success/simple_program_addition/src/main.nr index 59b03556d94..082d9b5071f 100644 --- a/tooling/nargo_cli/tests/execution_success/simple_program_addition/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/simple_program_addition/src/main.nr @@ -2,4 +2,4 @@ // a binary operation. fn main(x : Field) -> pub Field { x + 1 -} \ No newline at end of file +} diff --git a/tooling/nargo_cli/tests/execution_success/simple_radix/src/main.nr b/tooling/nargo_cli/tests/execution_success/simple_radix/src/main.nr index 9ce6d86f13a..67268a932a3 100644 --- a/tooling/nargo_cli/tests/execution_success/simple_radix/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/simple_radix/src/main.nr @@ -1,5 +1,4 @@ // Simple program to test to_radix - fn main(x : Field) { let bits = x.to_le_bits(3); assert(bits[0] == 0); diff --git a/tooling/nargo_cli/tests/execution_success/simple_shift_left_right/src/main.nr b/tooling/nargo_cli/tests/execution_success/simple_shift_left_right/src/main.nr index f12b2d8bf20..517ef429458 100644 --- a/tooling/nargo_cli/tests/execution_success/simple_shift_left_right/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/simple_shift_left_right/src/main.nr @@ -1,7 +1,7 @@ // Tests a very simple program. // // The features being tested are left and right shifts. -fn main(x : u32) { +fn main(x : u32) { let z = x >> 4; let t = x << 4; assert(z == t >> 8); diff --git a/tooling/nargo_cli/tests/execution_success/slice_dynamic_index/src/main.nr b/tooling/nargo_cli/tests/execution_success/slice_dynamic_index/src/main.nr index 724f3f16184..3f3177b1b5a 100644 --- a/tooling/nargo_cli/tests/execution_success/slice_dynamic_index/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/slice_dynamic_index/src/main.nr @@ -9,7 +9,7 @@ fn regression_dynamic_slice_index(x: Field, y: Field) { slice = slice.push_back(i); } assert(slice.len() == 5); - + dynamic_slice_index_set_if(slice, x, y); dynamic_slice_index_set_else(slice, x, y); dynamic_slice_index_set_nested_if_else_else(slice, x, y); @@ -92,7 +92,6 @@ fn dynamic_slice_index_else(mut slice: [Field], x: Field) { assert(slice[4] == 2); } - fn dynamic_slice_merge_if(mut slice: [Field], x: Field) { if x as u32 < 10 { assert(slice[x] == 4); @@ -250,7 +249,6 @@ fn dynamic_slice_merge_two_ifs(mut slice: [Field], x: Field) { assert(slice[slice.len() - 1] == 20); } - fn dynamic_slice_merge_mutate_between_ifs(mut slice: [Field], x: Field, y: Field) { if x != y { slice[x] = 50; @@ -312,4 +310,3 @@ fn dynamic_slice_merge_push_then_pop(mut slice: [Field], x: Field, y: Field) { assert(elem == y); } - diff --git a/tooling/nargo_cli/tests/execution_success/slices/src/main.nr b/tooling/nargo_cli/tests/execution_success/slices/src/main.nr index f9069a48e39..e027c0f5ea2 100644 --- a/tooling/nargo_cli/tests/execution_success/slices/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/slices/src/main.nr @@ -116,7 +116,7 @@ fn merge_slices_if(x: Field, y: Field) { assert(slice[5] == 15); assert(slice[6] == 50); assert(slice[7] == 60); - + merge_slices_push_then_pop(x, y); let slice = merge_slices_push_then_insert(x, y); @@ -199,7 +199,7 @@ fn merge_slices_mutate_two_ifs(x: Field, y: Field) -> [Field] { slice = slice.push_back(15); slice = slice.push_back(30); - + slice } @@ -213,7 +213,7 @@ fn merge_slices_mutate_between_ifs(x: Field, y: Field) -> [Field] { } slice = slice.push_back(30); - + if x == 20 { slice = slice.push_back(20); } diff --git a/tooling/nargo_cli/tests/execution_success/strings/src/main.nr b/tooling/nargo_cli/tests/execution_success/strings/src/main.nr index 1d401260179..02e2fa678cd 100644 --- a/tooling/nargo_cli/tests/execution_success/strings/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/strings/src/main.nr @@ -57,7 +57,7 @@ fn failed_constraint(hex_as_field: Field) { // evaluated at compile time. // When this method is called from a test method or with constant values // a `Failed constraint` compile error will be caught before this `println` - // is executed as the input will be a constant. + // is executed as the input will be a constant. std::println(hex_as_field); assert(hex_as_field != 0x41); } diff --git a/tooling/nargo_cli/tests/execution_success/struct_array_inputs/src/main.nr b/tooling/nargo_cli/tests/execution_success/struct_array_inputs/src/main.nr index de317fe35e7..4a367558671 100644 --- a/tooling/nargo_cli/tests/execution_success/struct_array_inputs/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/struct_array_inputs/src/main.nr @@ -5,4 +5,4 @@ struct Foo { fn main(foos: [Foo; 3]) -> pub Field { foos[2].bar + foos[2].baz -} \ No newline at end of file +} diff --git a/tooling/nargo_cli/tests/execution_success/struct_inputs/src/foo.nr b/tooling/nargo_cli/tests/execution_success/struct_inputs/src/foo.nr index 281769cfb07..ea3a6bbe25f 100644 --- a/tooling/nargo_cli/tests/execution_success/struct_inputs/src/foo.nr +++ b/tooling/nargo_cli/tests/execution_success/struct_inputs/src/foo.nr @@ -3,4 +3,4 @@ mod bar; struct fooStruct { bar_struct: bar::barStruct, baz: Field, -} \ No newline at end of file +} diff --git a/tooling/nargo_cli/tests/execution_success/struct_inputs/src/foo/bar.nr b/tooling/nargo_cli/tests/execution_success/struct_inputs/src/foo/bar.nr index d1963f4a0a7..6d879326677 100644 --- a/tooling/nargo_cli/tests/execution_success/struct_inputs/src/foo/bar.nr +++ b/tooling/nargo_cli/tests/execution_success/struct_inputs/src/foo/bar.nr @@ -4,4 +4,4 @@ struct barStruct { val: Field, array: [Field; 2], message: str<5>, -} \ No newline at end of file +} diff --git a/tooling/nargo_cli/tests/execution_success/struct_inputs/src/main.nr b/tooling/nargo_cli/tests/execution_success/struct_inputs/src/main.nr index 68858d98998..96684d01a1d 100644 --- a/tooling/nargo_cli/tests/execution_success/struct_inputs/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/struct_inputs/src/main.nr @@ -22,7 +22,7 @@ fn main(x : Field, y : pub myStruct, z: pub foo::bar::barStruct, a: pub foo::foo assert(y.message == "hello"); assert(a.bar_struct.message == struct_from_bar.message); - + a.bar_struct.array[1] } diff --git a/tooling/nargo_cli/tests/execution_success/submodules/src/main.nr b/tooling/nargo_cli/tests/execution_success/submodules/src/main.nr index 47f80f1bd4d..813f3a26a20 100644 --- a/tooling/nargo_cli/tests/execution_success/submodules/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/submodules/src/main.nr @@ -12,4 +12,4 @@ mod mysubmodule { pub fn my_helper() {} } - + diff --git a/tooling/nargo_cli/tests/execution_success/to_bytes_integration/src/main.nr b/tooling/nargo_cli/tests/execution_success/to_bytes_integration/src/main.nr index f76df026db7..43a35f05488 100644 --- a/tooling/nargo_cli/tests/execution_success/to_bytes_integration/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/to_bytes_integration/src/main.nr @@ -1,6 +1,6 @@ use dep::std; -fn main(x : Field, a: Field) { +fn main(x : Field, a: Field) { let y: Field = 2040124; let be_byte_array = y.to_be_bytes(31); let le_byte_array = x.to_le_bytes(31); diff --git a/tooling/nargo_cli/tests/execution_success/to_le_bytes/src/main.nr b/tooling/nargo_cli/tests/execution_success/to_le_bytes/src/main.nr index 9d7eb403083..7155122b372 100644 --- a/tooling/nargo_cli/tests/execution_success/to_le_bytes/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/to_le_bytes/src/main.nr @@ -2,7 +2,7 @@ fn main(x : Field) -> pub [u8; 31] { // The result of this byte array will be little-endian let byte_array = x.to_le_bytes(31); assert(byte_array.len() == 31); - + let mut bytes = [0; 31]; for i in 0..31 { bytes[i] = byte_array[i]; diff --git a/tooling/nargo_cli/tests/execution_success/trait_associated_member_names_clashes/Nargo.toml b/tooling/nargo_cli/tests/execution_success/trait_associated_member_names_clashes/Nargo.toml new file mode 100644 index 00000000000..585dcde7351 --- /dev/null +++ b/tooling/nargo_cli/tests/execution_success/trait_associated_member_names_clashes/Nargo.toml @@ -0,0 +1,7 @@ +[package] +name = "trait_associated_member_names_clashes" +type = "bin" +authors = [""] +compiler_version = "0.16.0" + +[dependencies] \ No newline at end of file diff --git a/tooling/nargo_cli/tests/execution_success/trait_associated_member_names_clashes/Prover.toml b/tooling/nargo_cli/tests/execution_success/trait_associated_member_names_clashes/Prover.toml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tooling/nargo_cli/tests/execution_success/trait_associated_member_names_clashes/src/main.nr b/tooling/nargo_cli/tests/execution_success/trait_associated_member_names_clashes/src/main.nr new file mode 100644 index 00000000000..412a75010f6 --- /dev/null +++ b/tooling/nargo_cli/tests/execution_success/trait_associated_member_names_clashes/src/main.nr @@ -0,0 +1,36 @@ +trait Trait1 { + fn tralala() -> Field; +} + +trait Trait2 { + fn tralala() -> Field; +} + +struct Struct1 { +} + +impl Struct1 { + fn tralala() -> Field { + 123456 + } +} + +impl Trait1 for Struct1 { + fn tralala() -> Field { + 111111 + } +} + +impl Trait2 for Struct1 { + fn tralala() -> Field { + 222222 + } +} + +fn main() { + // the struct impl takes priority over trait methods + assert(Struct1::tralala() == 123456); + // TODO: uncomment these, once we support the :: syntax + //assert(::tralala() == 111111); + //assert(::tralala() == 222222); +} diff --git a/tooling/nargo_cli/tests/execution_success/trait_multi_module_test/src/main.nr b/tooling/nargo_cli/tests/execution_success/trait_multi_module_test/src/main.nr index 63b6f08ed52..77c30ce602b 100644 --- a/tooling/nargo_cli/tests/execution_success/trait_multi_module_test/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/trait_multi_module_test/src/main.nr @@ -5,5 +5,4 @@ mod module4; mod module5; mod module6; -fn main() { -} +fn main() {} diff --git a/tooling/nargo_cli/tests/execution_success/tuples/src/main.nr b/tooling/nargo_cli/tests/execution_success/tuples/src/main.nr index bfc943dfc07..e836c66a0fa 100644 --- a/tooling/nargo_cli/tests/execution_success/tuples/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/tuples/src/main.nr @@ -7,7 +7,7 @@ fn main(x: Field, y: Field) { assert(a == 0); assert(b == 1); - let (u,v) = if x as u32 < 1 { + let (u, v) = if x as u32 < 1 { (x, x + 1) } else { (x + 1, x) diff --git a/tooling/nargo_cli/tests/execution_success/xor/src/main.nr b/tooling/nargo_cli/tests/execution_success/xor/src/main.nr index e893c938fc3..d4261aa786a 100644 --- a/tooling/nargo_cli/tests/execution_success/xor/src/main.nr +++ b/tooling/nargo_cli/tests/execution_success/xor/src/main.nr @@ -2,4 +2,4 @@ fn main(x : u32, y : pub u32) { let m = x ^ y; assert(m != 10); -} \ No newline at end of file +} diff --git a/tooling/nargo_fmt/src/visitor/expr.rs b/tooling/nargo_fmt/src/visitor/expr.rs index 7677a6284ec..d8bea6c7530 100644 --- a/tooling/nargo_fmt/src/visitor/expr.rs +++ b/tooling/nargo_fmt/src/visitor/expr.rs @@ -1,6 +1,6 @@ use noirc_frontend::{ - hir::resolution::errors::Span, ArrayLiteral, BlockExpression, Expression, ExpressionKind, - Literal, Statement, + hir::resolution::errors::Span, lexer::Lexer, token::Token, ArrayLiteral, BlockExpression, + Expression, ExpressionKind, Literal, Statement, }; use super::FmtVisitor; @@ -10,6 +10,7 @@ impl FmtVisitor<'_> { let span = expr.span; let rewrite = self.format_expr(expr); + let rewrite = recover_comment_removed(slice!(self, span.start(), span.end()), rewrite); self.push_rewrite(rewrite, span); self.last_position = span.end(); @@ -94,6 +95,7 @@ impl FmtVisitor<'_> { literal.to_string() } }, + ExpressionKind::Parenthesized(subexpr) => format!("({})", self.format_expr(*subexpr)), // TODO: _expr => slice!(self, span.start(), span.end()).to_string(), } @@ -159,3 +161,30 @@ impl FmtVisitor<'_> { self.push_str(&block_str); } } + +fn recover_comment_removed(original: &str, new: String) -> String { + if changed_comment_content(original, &new) { + original.to_string() + } else { + new + } +} + +fn changed_comment_content(original: &str, new: &str) -> bool { + comments(original) != comments(new) +} + +fn comments(source: &str) -> Vec { + Lexer::new(source) + .skip_comments(false) + .flatten() + .filter_map(|spanned| { + if let Token::LineComment(content) | Token::BlockComment(content) = spanned.into_token() + { + Some(content) + } else { + None + } + }) + .collect() +} diff --git a/tooling/nargo_fmt/tests/expected/expr.nr b/tooling/nargo_fmt/tests/expected/expr.nr index 01bdb9d1399..6d4fedba4b3 100644 --- a/tooling/nargo_fmt/tests/expected/expr.nr +++ b/tooling/nargo_fmt/tests/expected/expr.nr @@ -71,3 +71,11 @@ fn test() { // 324 34 } + +fn parenthesized() { + value + (x as Field) +} + +fn parenthesized() { + (i as u8) + (j as u8) + (k as u8) + x + y + z +} diff --git a/tooling/nargo_fmt/tests/expected/infix.nr b/tooling/nargo_fmt/tests/expected/infix.nr index 13b53170da6..f930f79ebcb 100644 --- a/tooling/nargo_fmt/tests/expected/infix.nr +++ b/tooling/nargo_fmt/tests/expected/infix.nr @@ -2,4 +2,7 @@ fn foo() { 40 + 2; !40 + 2; 40 + 2 == 42; + + 40/*test*/ + 2 == 42; + 40 + 2/*test*/ == 42; } diff --git a/tooling/nargo_fmt/tests/expected/unary_operators.nr b/tooling/nargo_fmt/tests/expected/unary_operators.nr index 88140ac9a6e..e65690cf482 100644 --- a/tooling/nargo_fmt/tests/expected/unary_operators.nr +++ b/tooling/nargo_fmt/tests/expected/unary_operators.nr @@ -1,3 +1,5 @@ fn main() { - -1 + -1; + -/*test*/1; + -/*test*/1; } diff --git a/tooling/nargo_fmt/tests/input/expr.nr b/tooling/nargo_fmt/tests/input/expr.nr index 601e946cb0c..25602c640d3 100644 --- a/tooling/nargo_fmt/tests/input/expr.nr +++ b/tooling/nargo_fmt/tests/input/expr.nr @@ -80,3 +80,11 @@ fn test() { // 324 34 } + +fn parenthesized() { + value + ( x as Field ) +} + +fn parenthesized() { + ( i as u8 ) + ( j as u8 ) + ( k as u8 ) + x + y + z +} diff --git a/tooling/nargo_fmt/tests/input/infix.nr b/tooling/nargo_fmt/tests/input/infix.nr index c01969f0502..df57f956097 100644 --- a/tooling/nargo_fmt/tests/input/infix.nr +++ b/tooling/nargo_fmt/tests/input/infix.nr @@ -2,4 +2,7 @@ fn foo() { 40 + 2; !40+2; 40 + 2 == 42; + +40/*test*/ + 2 == 42; + 40 + 2/*test*/ == 42; } diff --git a/tooling/nargo_fmt/tests/input/unary_operators.nr b/tooling/nargo_fmt/tests/input/unary_operators.nr index 5805c7081f5..62e4a1c4d27 100644 --- a/tooling/nargo_fmt/tests/input/unary_operators.nr +++ b/tooling/nargo_fmt/tests/input/unary_operators.nr @@ -1,3 +1,5 @@ fn main() { - -1 + -1; +-/*test*/1; + -/*test*/1; } \ No newline at end of file