From 99f44a4fc9dcecf7c2e5da8ac423d01027e41b50 Mon Sep 17 00:00:00 2001 From: Tom French <15848336+TomAFrench@users.noreply.github.com> Date: Fri, 13 Oct 2023 16:07:13 +0100 Subject: [PATCH] chore: apply spellcheck (#3143) Co-authored-by: Tom French --- CHANGELOG.md | 8 +- acvm-repo/acir/src/circuit/directives.rs | 2 +- compiler/fm/src/lib.rs | 2 +- .../brillig/brillig_gen/brillig_directive.rs | 2 +- .../brillig/brillig_gen/variable_liveness.rs | 2 +- compiler/noirc_evaluator/src/ssa.rs | 4 +- .../src/ssa/acir_gen/acir_ir/acir_variable.rs | 8 +- .../ssa/acir_gen/acir_ir/generated_acir.rs | 6 +- compiler/noirc_evaluator/src/ssa/ir/value.rs | 2 +- .../noirc_evaluator/src/ssa/opt/mem2reg.rs | 4 +- .../src/ssa/ssa_gen/context.rs | 2 +- .../noirc_evaluator/src/ssa/ssa_gen/value.rs | 2 +- compiler/noirc_frontend/src/ast/expression.rs | 2 +- .../noirc_frontend/src/hir/aztec_library.rs | 6 +- .../src/hir/def_collector/dc_crate.rs | 2 +- .../src/hir/def_collector/dc_mod.rs | 10 +-- .../src/hir/def_collector/errors.rs | 4 +- .../src/hir/resolution/resolver.rs | 2 +- .../noirc_frontend/src/hir/type_check/expr.rs | 4 +- compiler/noirc_frontend/src/hir_def/expr.rs | 4 +- compiler/noirc_frontend/src/node_interner.rs | 4 +- compiler/noirc_frontend/src/parser/parser.rs | 10 +-- compiler/noirc_frontend/src/tests.rs | 18 ++-- cspell.json | 90 ++++++++++--------- .../instruction_deduplication/src/main.nr | 2 +- .../poseidonsponge_x5_254/src/main.nr | 2 +- 26 files changed, 107 insertions(+), 97 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b9bea13b5e0..a56f9490edb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -157,7 +157,7 @@ * Fix `update_acir` deleting all debug information ([#2643](https://github.com/noir-lang/noir/issues/2643)) ([a8a5395](https://github.com/noir-lang/noir/commit/a8a5395f357ef26890af526f417418c49b032d17)) * Fix compilation using `aztec` feature flag ([#2663](https://github.com/noir-lang/noir/issues/2663)) ([7f6fe46](https://github.com/noir-lang/noir/commit/7f6fe46f8bc00f24ff8d14b3a517e27b50db4ee5)) * Implement auto-dereferencing when calling methods ([#2581](https://github.com/noir-lang/noir/issues/2581)) ([3c731b1](https://github.com/noir-lang/noir/commit/3c731b11b31b8556eeebc4fe59b68609aa96c463)) -* Initialise arrays returned by brillig ([#2048](https://github.com/noir-lang/noir/issues/2048)) ([788dfb4](https://github.com/noir-lang/noir/commit/788dfb45e025786b13035d4c3d6ccf1e1614ef2f)) +* Initialize arrays returned by brillig ([#2048](https://github.com/noir-lang/noir/issues/2048)) ([788dfb4](https://github.com/noir-lang/noir/commit/788dfb45e025786b13035d4c3d6ccf1e1614ef2f)) * Remove duplicate file extension in stack trace ([#2655](https://github.com/noir-lang/noir/issues/2655)) ([1114871](https://github.com/noir-lang/noir/commit/1114871d538767c053d71c67577890dd29f0b490)) * **ssa:** Slice mergers with multiple ifs ([#2597](https://github.com/noir-lang/noir/issues/2597)) ([6110638](https://github.com/noir-lang/noir/commit/6110638ec743616b9a3f38650838dda631a25efd)) * Support for conditional stores ([#2553](https://github.com/noir-lang/noir/issues/2553)) ([6e6d952](https://github.com/noir-lang/noir/commit/6e6d952c052a893e897eaa42b36d3a15426a4f78)) @@ -448,7 +448,7 @@ * Adding internal keyword ([#1873](https://github.com/noir-lang/noir/issues/1873)) ([7a85493](https://github.com/noir-lang/noir/commit/7a854937ca5a300ae05f335612d2ff72ce88b4b1)) * Allow arrays of arbitrary types in the program ABI ([#1651](https://github.com/noir-lang/noir/issues/1651)) ([811ede1](https://github.com/noir-lang/noir/commit/811ede19f2160d809904deffc09a51799448d8d6)) * Allow shadowing by default ([#2000](https://github.com/noir-lang/noir/issues/2000)) ([88a4f74](https://github.com/noir-lang/noir/commit/88a4f74a36704137d7de94e3791c2e6bea9319b5)) -* avoid unnecessary witness assignments in euclidian division / bound constraint ([#1989](https://github.com/noir-lang/noir/issues/1989)) ([c23257d](https://github.com/noir-lang/noir/commit/c23257d4bdd8d93b9219fd767de6d806e237ccea)) +* avoid unnecessary witness assignments in euclidean division / bound constraint ([#1989](https://github.com/noir-lang/noir/issues/1989)) ([c23257d](https://github.com/noir-lang/noir/commit/c23257d4bdd8d93b9219fd767de6d806e237ccea)) * **brillig_gen:** Return slices from foreign calls ([#1909](https://github.com/noir-lang/noir/issues/1909)) ([6fa3144](https://github.com/noir-lang/noir/commit/6fa3144b30ef908a350273fbfd950d5a247104b2)) * compile to brillig reachable acir fns ([#1919](https://github.com/noir-lang/noir/issues/1919)) ([2b4237d](https://github.com/noir-lang/noir/commit/2b4237d7ffc2a0246cdaa1b7d85cc1ef7d7b3eb1)) * dynamic arrays for experimental-ssa ([#1969](https://github.com/noir-lang/noir/issues/1969)) ([08d199a](https://github.com/noir-lang/noir/commit/08d199aa4daa2038ca01f5ad23376fec27950f9a)) @@ -860,8 +860,8 @@ * Optimize parser ([#869](https://github.com/noir-lang/noir/issues/869)) ([e927a39](https://github.com/noir-lang/noir/commit/e927a39dc3d6517f233509b8349dfd9c7f79471d)) * prevent inconsistent language usage in `Driver` ([48cda7a](https://github.com/noir-lang/noir/commit/48cda7a08b22afdde9f904632b502c53fb491ee6)) * prevent inconsistent language usage in `Driver` ([#881](https://github.com/noir-lang/noir/issues/881)) ([48cda7a](https://github.com/noir-lang/noir/commit/48cda7a08b22afdde9f904632b502c53fb491ee6)) -* properly initialise `Evaluator` in test ([#863](https://github.com/noir-lang/noir/issues/863)) ([bbb70bd](https://github.com/noir-lang/noir/commit/bbb70bdcc78041f5db9b74657cdcc92ad34c035b)) -* properly initialise Evaluator in test ([bbb70bd](https://github.com/noir-lang/noir/commit/bbb70bdcc78041f5db9b74657cdcc92ad34c035b)) +* properly initialize `Evaluator` in test ([#863](https://github.com/noir-lang/noir/issues/863)) ([bbb70bd](https://github.com/noir-lang/noir/commit/bbb70bdcc78041f5db9b74657cdcc92ad34c035b)) +* properly initialize Evaluator in test ([bbb70bd](https://github.com/noir-lang/noir/commit/bbb70bdcc78041f5db9b74657cdcc92ad34c035b)) * Remove uses of std::process::exit ([#963](https://github.com/noir-lang/noir/issues/963)) ([870ea46](https://github.com/noir-lang/noir/commit/870ea463583502db106d4c8b05ad5c02fb6f8428)) * **ssa:** fix the compile-time check for equality in acir-gen ([#904](https://github.com/noir-lang/noir/issues/904)) ([161e4fb](https://github.com/noir-lang/noir/commit/161e4fbfe17ef9ed6c237d6ea812a866fee2c74a)) diff --git a/acvm-repo/acir/src/circuit/directives.rs b/acvm-repo/acir/src/circuit/directives.rs index 32c0bd6337a..a86eb525c1f 100644 --- a/acvm-repo/acir/src/circuit/directives.rs +++ b/acvm-repo/acir/src/circuit/directives.rs @@ -15,7 +15,7 @@ pub struct QuotientDirective { /// You can think of them as opcodes that allow one to use non-determinism /// In the future, this can be replaced with asm non-determinism blocks pub enum Directive { - //Performs euclidian division of a / b (as integers) and stores the quotient in q and the rest in r + //Performs euclidean division of a / b (as integers) and stores the quotient in q and the rest in r Quotient(QuotientDirective), //decomposition of a: a=\sum b[i]*radix^i where b is an array of witnesses < radix in little endian form diff --git a/compiler/fm/src/lib.rs b/compiler/fm/src/lib.rs index 5c5175499d8..d8a7bce4509 100644 --- a/compiler/fm/src/lib.rs +++ b/compiler/fm/src/lib.rs @@ -102,7 +102,7 @@ impl FileManager { let anchor_path = self.path(anchor).to_path_buf(); let anchor_dir = anchor_path.parent().unwrap(); - // if `anchor` is a `main.nr`, `lib.nr`, `mod.nr` or `{modname}.nr`, we check siblings of + // if `anchor` is a `main.nr`, `lib.nr`, `mod.nr` or `{mod_name}.nr`, we check siblings of // the anchor at `base/mod_name.nr`. let candidate = if should_check_siblings_for_module(&anchor_path, anchor_dir) { anchor_dir.join(format!("{mod_name}.{FILE_EXTENSION}")) diff --git a/compiler/noirc_evaluator/src/brillig/brillig_gen/brillig_directive.rs b/compiler/noirc_evaluator/src/brillig/brillig_gen/brillig_directive.rs index 8b5ff8e9cbd..a07865073ff 100644 --- a/compiler/noirc_evaluator/src/brillig/brillig_gen/brillig_directive.rs +++ b/compiler/noirc_evaluator/src/brillig/brillig_gen/brillig_directive.rs @@ -40,7 +40,7 @@ pub(crate) fn directive_invert() -> GeneratedBrillig { /// Generates brillig bytecode which computes `a / b` and returns the quotient and remainder. /// -/// This is equivalent to the Noir (psuedo)code +/// This is equivalent to the Noir (pseudo)code /// /// ```ignore /// fn quotient(a: T, b: T) -> (T,T) { diff --git a/compiler/noirc_evaluator/src/brillig/brillig_gen/variable_liveness.rs b/compiler/noirc_evaluator/src/brillig/brillig_gen/variable_liveness.rs index eeea627a308..d57196288bf 100644 --- a/compiler/noirc_evaluator/src/brillig/brillig_gen/variable_liveness.rs +++ b/compiler/noirc_evaluator/src/brillig/brillig_gen/variable_liveness.rs @@ -50,7 +50,7 @@ fn collect_variables_of_value(value_id: ValueId, dfg: &DataFlowGraph) -> Vec { vec![value_id] } - // Literal arrays are constants, but might use variable values to initialise. + // Literal arrays are constants, but might use variable values to initialize. Value::Array { array, .. } => { let mut value_ids = Vec::new(); diff --git a/compiler/noirc_evaluator/src/ssa.rs b/compiler/noirc_evaluator/src/ssa.rs index 47e5f0492a5..131cf30a510 100644 --- a/compiler/noirc_evaluator/src/ssa.rs +++ b/compiler/noirc_evaluator/src/ssa.rs @@ -116,10 +116,10 @@ pub fn create_circuit( let mut debug_info = DebugInfo::new(locations); // Perform any ACIR-level optimizations - let (optimized_ciruit, transformation_map) = acvm::compiler::optimize(circuit); + let (optimized_circuit, transformation_map) = acvm::compiler::optimize(circuit); debug_info.update_acir(transformation_map); - Ok((optimized_ciruit, debug_info, abi)) + Ok((optimized_circuit, debug_info, abi)) } // This is just a convenience object to bundle the ssa with `print_ssa_passes` for debug printing. 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 5b49795ca41..d846ede566f 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 @@ -292,7 +292,7 @@ impl AcirContext { let inverted_var = self.add_data(AcirVarData::Const(constant.inverse())); // Check that the inverted var is valid. - // This check prevents invalid divisons by zero. + // This check prevents invalid divisions by zero. let should_be_one = self.mul_var(inverted_var, var)?; self.maybe_eq_predicate(should_be_one, predicate)?; @@ -311,7 +311,7 @@ impl AcirContext { let inverted_var = Self::expect_one_var(results); // Check that the inverted var is valid. - // This check prevents invalid divisons by zero. + // This check prevents invalid divisions by zero. let should_be_one = self.mul_var(inverted_var, var)?; self.maybe_eq_predicate(should_be_one, predicate)?; @@ -571,7 +571,7 @@ impl AcirContext { /// Returns the quotient and remainder such that lhs = rhs * quotient + remainder /// and |remainder| < |rhs| /// and remainder has the same sign than lhs - /// Note that this is not the euclidian division, where we have instead remainder < |rhs| + /// Note that this is not the euclidean division, where we have instead remainder < |rhs| fn signed_division_var( &mut self, lhs: AcirVar, @@ -627,7 +627,7 @@ impl AcirContext { } /// Returns an `AcirVar` which will be constrained to be lhs mod 2^{rhs} - /// In order to do this, we 'simply' perform euclidian division of lhs by 2^{rhs} + /// In order to do this, we 'simply' perform euclidean division of lhs by 2^{rhs} /// The remainder of the division is then lhs mod 2^{rhs} pub(crate) fn truncate_var( &mut self, 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 ca60a41d143..3ce1c8893fa 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 @@ -358,8 +358,8 @@ impl GeneratedAcir { } /// Signed division lhs / rhs - /// We derive the signed division from the unsigned euclidian division. - /// note that this is not euclidian division! + /// We derive the signed division from the unsigned euclidean division. + /// note that this is not euclidean division! // if x is a signed integer, then sign(x)x >= 0 // so if a and b are signed integers, we can do the unsigned division: // sign(a)a = q1*sign(b)b + r1 @@ -821,7 +821,7 @@ impl GeneratedAcir { let two_max_bits: FieldElement = two.pow(&FieldElement::from(max_bits as i128)); let comparison_evaluation = (a - b) + two_max_bits; - // Euclidian division by 2^{max_bits} : 2^{max_bits} + a - b = q * 2^{max_bits} + r + // euclidean division by 2^{max_bits} : 2^{max_bits} + a - b = q * 2^{max_bits} + r // // 2^{max_bits} is of max_bits+1 bit size // If a>b, then a-b is less than 2^{max_bits} - 1, so 2^{max_bits} + a - b is less than 2^{max_bits} + 2^{max_bits} - 1 = 2^{max_bits+1} - 1 diff --git a/compiler/noirc_evaluator/src/ssa/ir/value.rs b/compiler/noirc_evaluator/src/ssa/ir/value.rs index 8c2a4e88ef3..c83609dec1f 100644 --- a/compiler/noirc_evaluator/src/ssa/ir/value.rs +++ b/compiler/noirc_evaluator/src/ssa/ir/value.rs @@ -50,7 +50,7 @@ pub(crate) enum Value { Intrinsic(Intrinsic), /// This Value refers to an external function in the IR. - /// ForeignFunction's always have the type Type::Function and have simlar semantics to Function, + /// ForeignFunction's always have the type Type::Function and have similar semantics to Function, /// other than generating different backend operations and being only accessible through Brillig. ForeignFunction(String), } diff --git a/compiler/noirc_evaluator/src/ssa/opt/mem2reg.rs b/compiler/noirc_evaluator/src/ssa/opt/mem2reg.rs index 342a47160d0..e5fffaccdd0 100644 --- a/compiler/noirc_evaluator/src/ssa/opt/mem2reg.rs +++ b/compiler/noirc_evaluator/src/ssa/opt/mem2reg.rs @@ -524,8 +524,8 @@ mod tests { // Since the mem2reg pass simplifies as it goes, the id of the allocate instruction result // is most likely no longer v0. We have to retrieve the new id here. - let alloca_id = func.dfg.instruction_results(instructions[0])[0]; - assert_eq!(ret_val_id, alloca_id); + let allocate_id = func.dfg.instruction_results(instructions[0])[0]; + assert_eq!(ret_val_id, allocate_id); } fn count_stores(block: BasicBlockId, dfg: &DataFlowGraph) -> usize { diff --git a/compiler/noirc_evaluator/src/ssa/ssa_gen/context.rs b/compiler/noirc_evaluator/src/ssa/ssa_gen/context.rs index d1031c98558..142e9f81397 100644 --- a/compiler/noirc_evaluator/src/ssa/ssa_gen/context.rs +++ b/compiler/noirc_evaluator/src/ssa/ssa_gen/context.rs @@ -863,7 +863,7 @@ impl SharedContext { /// and return this new id. pub(super) fn get_or_queue_function(&self, id: ast::FuncId) -> IrFunctionId { // Start a new block to guarantee the destructor for the map lock is released - // before map needs to be aquired again in self.functions.write() below + // before map needs to be acquired again in self.functions.write() below { let map = self.functions.read().expect("Failed to read self.functions"); if let Some(existing_id) = map.get(&id) { diff --git a/compiler/noirc_evaluator/src/ssa/ssa_gen/value.rs b/compiler/noirc_evaluator/src/ssa/ssa_gen/value.rs index e7bb515465b..d71d4e5604e 100644 --- a/compiler/noirc_evaluator/src/ssa/ssa_gen/value.rs +++ b/compiler/noirc_evaluator/src/ssa/ssa_gen/value.rs @@ -24,7 +24,7 @@ pub(super) enum Tree { /// /// Note that these values wrap the ValueIds /// used internally by functions in the ssa ir and should thus be isolated -/// to a given function. If used outisde their function of origin, the IDs +/// to a given function. If used outside their function of origin, the IDs /// would be invalid. #[derive(Debug, Clone)] pub(super) enum Value { diff --git a/compiler/noirc_frontend/src/ast/expression.rs b/compiler/noirc_frontend/src/ast/expression.rs index f8c67781a49..4c8e98a0d4d 100644 --- a/compiler/noirc_frontend/src/ast/expression.rs +++ b/compiler/noirc_frontend/src/ast/expression.rs @@ -480,7 +480,7 @@ impl Display for ExpressionKind { write!(f, "({})", elements.join(", ")) } Lambda(lambda) => lambda.fmt(f), - Parenthesized(subexpr) => write!(f, "({subexpr})"), + Parenthesized(sub_expr) => write!(f, "({sub_expr})"), Error => write!(f, "Error"), } } diff --git a/compiler/noirc_frontend/src/hir/aztec_library.rs b/compiler/noirc_frontend/src/hir/aztec_library.rs index c09835b2071..2d91840544c 100644 --- a/compiler/noirc_frontend/src/hir/aztec_library.rs +++ b/compiler/noirc_frontend/src/hir/aztec_library.rs @@ -591,7 +591,7 @@ fn abstract_return_values(func: &NoirFunction) -> Option { let last_statement = &func.def.body.0[len - 1]; // TODO: (length, type) => We can limit the size of the array returned to be limited by kernel size - // Doesnt need done until we have settled on a kernel size + // Doesn't need done until we have settled on a kernel size // TODO: support tuples here and in inputs -> convert into an issue // Check if the return type is an expression, if it is, we can handle it @@ -864,11 +864,11 @@ fn add_array_to_hasher(identifier: &Ident) -> Statement { fn add_field_to_hasher(identifier: &Ident) -> Statement { // `hasher.add({ident})` - let iden = variable_path(path(identifier.clone())); + let ident = variable_path(path(identifier.clone())); make_statement(StatementKind::Semi(method_call( variable("hasher"), // variable "add", // method name - vec![iden], // args + vec![ident], // args ))) } 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 13610b8ff47..a458814ce9e 100644 --- a/compiler/noirc_frontend/src/hir/def_collector/dc_crate.rs +++ b/compiler/noirc_frontend/src/hir/def_collector/dc_crate.rs @@ -303,7 +303,7 @@ impl DefCollector { errors.extend(collect_impls(context, crate_id, &def_collector.collected_impls)); // Bind trait impls to their trait. Collect trait functions, that have a - // default implementation, which hasn't been overriden. + // default implementation, which hasn't been overridden. errors.extend(collect_trait_impls( context, crate_id, diff --git a/compiler/noirc_frontend/src/hir/def_collector/dc_mod.rs b/compiler/noirc_frontend/src/hir/def_collector/dc_mod.rs index 803ffbc41fe..ed48d7fbb51 100644 --- a/compiler/noirc_frontend/src/hir/def_collector/dc_mod.rs +++ b/compiler/noirc_frontend/src/hir/def_collector/dc_mod.rs @@ -251,7 +251,7 @@ impl<'a> ModCollector<'a> { types: Vec, krate: CrateId, ) -> Vec<(CompilationError, FileId)> { - let mut definiton_errors = vec![]; + let mut definition_errors = vec![]; for struct_definition in types { let name = struct_definition.name.clone(); @@ -265,7 +265,7 @@ impl<'a> ModCollector<'a> { let id = match self.push_child_module(&name, self.file_id, false, false) { Ok(local_id) => context.def_interner.new_struct(&unresolved, krate, local_id), Err(error) => { - definiton_errors.push((error.into(), self.file_id)); + definition_errors.push((error.into(), self.file_id)); continue; } }; @@ -280,13 +280,13 @@ impl<'a> ModCollector<'a> { first_def, second_def, }; - definiton_errors.push((error.into(), self.file_id)); + definition_errors.push((error.into(), self.file_id)); } // And store the TypeId -> StructType mapping somewhere it is reachable self.def_collector.collected_types.insert(id, unresolved); } - definiton_errors + definition_errors } /// Collect any type aliases definitions declared within the ast. @@ -514,7 +514,7 @@ impl<'a> ModCollector<'a> { }; errors.push((error.into(), location.file)); - let error2 = DefCollectorErrorKind::ModuleOrignallyDefined { + let error2 = DefCollectorErrorKind::ModuleOriginallyDefined { mod_name: mod_name.clone(), span: old_location.span, }; diff --git a/compiler/noirc_frontend/src/hir/def_collector/errors.rs b/compiler/noirc_frontend/src/hir/def_collector/errors.rs index 5cd18e7f4ae..4e7f8ad286b 100644 --- a/compiler/noirc_frontend/src/hir/def_collector/errors.rs +++ b/compiler/noirc_frontend/src/hir/def_collector/errors.rs @@ -56,7 +56,7 @@ pub enum DefCollectorErrorKind { #[error("Module is already part of the crate")] ModuleAlreadyPartOfCrate { mod_name: Ident, span: Span }, #[error("Module was originally declared here")] - ModuleOrignallyDefined { mod_name: Ident, span: Span }, + ModuleOriginallyDefined { mod_name: Ident, span: Span }, #[cfg(feature = "aztec")] #[error("Aztec dependency not found. Please add aztec as a dependency in your Cargo.toml")] AztecNotFound {}, @@ -189,7 +189,7 @@ impl From for Diagnostic { let secondary = String::new(); Diagnostic::simple_error(message, secondary, span) } - DefCollectorErrorKind::ModuleOrignallyDefined { mod_name, span } => { + DefCollectorErrorKind::ModuleOriginallyDefined { mod_name, span } => { let message = format!("Note: {mod_name} was originally declared here"); let secondary = String::new(); Diagnostic::simple_error(message, secondary, span) diff --git a/compiler/noirc_frontend/src/hir/resolution/resolver.rs b/compiler/noirc_frontend/src/hir/resolution/resolver.rs index 97c71eedf4e..f9bf01c0957 100644 --- a/compiler/noirc_frontend/src/hir/resolution/resolver.rs +++ b/compiler/noirc_frontend/src/hir/resolution/resolver.rs @@ -1260,7 +1260,7 @@ impl<'a> Resolver<'a> { captures: lambda_context.captures, }) }), - ExpressionKind::Parenthesized(subexpr) => return self.resolve_expression(*subexpr), + ExpressionKind::Parenthesized(sub_expr) => return self.resolve_expression(*sub_expr), }; let expr_id = self.interner.push_expr(hir_expr); diff --git a/compiler/noirc_frontend/src/hir/type_check/expr.rs b/compiler/noirc_frontend/src/hir/type_check/expr.rs index b7e9fe953fd..27820922100 100644 --- a/compiler/noirc_frontend/src/hir/type_check/expr.rs +++ b/compiler/noirc_frontend/src/hir/type_check/expr.rs @@ -475,7 +475,7 @@ impl<'interner> TypeChecker<'interner> { arguments: Vec<(Type, ExprId, Span)>, span: Span, ) -> Type { - let (fntyp, param_len) = match method_ref { + let (fn_typ, param_len) = match method_ref { HirMethodReference::FuncId(func_id) => { if func_id == FuncId::dummy_id() { return Type::Error; @@ -504,7 +504,7 @@ impl<'interner> TypeChecker<'interner> { }); } - let (function_type, instantiation_bindings) = fntyp.instantiate(self.interner); + let (function_type, instantiation_bindings) = fn_typ.instantiate(self.interner); self.interner.store_instantiation_bindings(*function_ident_id, instantiation_bindings); self.interner.push_expr_type(function_ident_id, function_type.clone()); diff --git a/compiler/noirc_frontend/src/hir_def/expr.rs b/compiler/noirc_frontend/src/hir_def/expr.rs index 157e424bc95..42803378ccb 100644 --- a/compiler/noirc_frontend/src/hir_def/expr.rs +++ b/compiler/noirc_frontend/src/hir_def/expr.rs @@ -103,7 +103,7 @@ pub struct HirInfixExpression { pub rhs: ExprId, } -/// This is always a struct field access `mystruct.field` +/// This is always a struct field access `my_struct.field` /// and never a method call. The later is represented by HirMethodCallExpression. #[derive(Debug, Clone)] pub struct HirMemberAccess { @@ -155,7 +155,7 @@ pub enum HirMethodReference { /// Or a method can come from a Trait impl block, in which case /// the actual function called will depend on the instantiated type, - /// which can be only known during monomorphizaiton. + /// which can be only known during monomorphization. TraitMethodId(Type, TraitMethodId), } diff --git a/compiler/noirc_frontend/src/node_interner.rs b/compiler/noirc_frontend/src/node_interner.rs index 4f26f212afa..c4497331fae 100644 --- a/compiler/noirc_frontend/src/node_interner.rs +++ b/compiler/noirc_frontend/src/node_interner.rs @@ -126,7 +126,7 @@ pub struct NodeInterner { } /// All the information from a function that is filled out during definition collection rather than -/// name resolution. Resultingly, if information about a function is needed during name resolution, +/// name resolution. As a result, if information about a function is needed during name resolution, /// this is the only place where it is safe to retrieve it (where all fields are guaranteed to be initialized). pub struct FunctionModifiers { pub name: String, @@ -614,7 +614,7 @@ impl NodeInterner { id } - /// Push a function with the default modifiers and moduleid for testing + /// Push a function with the default modifiers and [`ModuleId`] for testing #[cfg(test)] pub fn push_test_function_definition(&mut self, name: String) -> FuncId { let id = self.push_fn(HirFunction::empty()); diff --git a/compiler/noirc_frontend/src/parser/parser.rs b/compiler/noirc_frontend/src/parser/parser.rs index 083646ceab0..6b43bd003f3 100644 --- a/compiler/noirc_frontend/src/parser/parser.rs +++ b/compiler/noirc_frontend/src/parser/parser.rs @@ -346,10 +346,10 @@ fn nothing() -> impl NoirParser { } fn self_parameter() -> impl NoirParser<(Pattern, UnresolvedType, Visibility)> { - let refmut_pattern = just(Token::Ampersand).then_ignore(keyword(Keyword::Mut)); + let mut_ref_pattern = just(Token::Ampersand).then_ignore(keyword(Keyword::Mut)); let mut_pattern = keyword(Keyword::Mut); - refmut_pattern + mut_ref_pattern .or(mut_pattern) .map_with_span(|token, span| (token, span)) .or_not() @@ -935,7 +935,7 @@ fn assign_operator() -> impl NoirParser { let shorthand_operators = right_shift_operator().or(one_of(shorthand_operators)); let shorthand_syntax = shorthand_operators.then_ignore(just(Token::Assign)); - // Since >> is lexed as two separate greater-thans, >>= is lexed as > >=, so + // Since >> is lexed as two separate "greater-than"s, >>= is lexed as > >=, so // we need to account for that case here as well. let right_shift_fix = just(Token::Greater).then(just(Token::GreaterEqual)).map(|_| Token::ShiftRight); @@ -1554,8 +1554,8 @@ where literal(), )) .map_with_span(Expression::new) - .or(parenthesized(expr_parser.clone()).map_with_span(|subexpr, span| { - Expression::new(ExpressionKind::Parenthesized(subexpr.into()), span) + .or(parenthesized(expr_parser.clone()).map_with_span(|sub_expr, span| { + Expression::new(ExpressionKind::Parenthesized(sub_expr.into()), span) })) .or(tuple(expr_parser)) .labelled(ParsingRuleLabel::Atom) diff --git a/compiler/noirc_frontend/src/tests.rs b/compiler/noirc_frontend/src/tests.rs index 87adc9d83a8..91fce8d8862 100644 --- a/compiler/noirc_frontend/src/tests.rs +++ b/compiler/noirc_frontend/src/tests.rs @@ -327,29 +327,29 @@ mod test { // wrong trait name method should not compile impl Default for Foo { - fn doesnt_exist(x: Field, y: Field) -> Self { + fn does_not_exist(x: Field, y: Field) -> Self { Self { bar: x, array: [x,y] } } } fn main() { }"; - let compilator_errors = get_program_errors(src); - assert!(!has_parser_error(&compilator_errors)); + let compilation_errors = get_program_errors(src); + assert!(!has_parser_error(&compilation_errors)); assert!( - compilator_errors.len() == 1, + compilation_errors.len() == 1, "Expected 1 compilation error, got: {:?}", - compilator_errors + compilation_errors ); - for (err, _file_id) in compilator_errors { + for (err, _file_id) in compilation_errors { match &err { CompilationError::DefinitionError(DefCollectorErrorKind::MethodNotInTrait { trait_name, impl_method, }) => { assert_eq!(trait_name, "Default"); - assert_eq!(impl_method, "doesnt_exist"); + assert_eq!(impl_method, "does_not_exist"); } _ => { panic!("No other errors are expected! Found = {:?}", err); @@ -1057,7 +1057,7 @@ mod test { println(f"I want to print {0}"); let new_val = 10; - println(f"randomstring{new_val}{new_val}"); + println(f"random_string{new_val}{new_val}"); } fn println(x : T) -> T { x @@ -1088,7 +1088,7 @@ mod test { assert!( a == "println(string)" || a == "println(f\"I want to print {0}\")" - || a == "println(f\"randomstring{new_val}{new_val}\")" + || a == "println(f\"random_string{new_val}{new_val}\")" ); } _ => unimplemented!(), diff --git a/cspell.json b/cspell.json index 79699391423..a667fc6d7aa 100644 --- a/cspell.json +++ b/cspell.json @@ -1,38 +1,63 @@ { "version": "0.2", "words": [ - // In code - // "aarch", + "acir", + "acvm", "aeiou", - "arraysort", "arithmetization", "arity", + "arkworks", + "arraysort", "barretenberg", + "bincode", + "bindgen", + "bitand", "blackbox", "brillig", + "callsite", + "callsites", + "canonicalize", + "castable", + "chumsky", + "clippy", "codegen", + "codegens", "coeff", "combinators", "comptime", "cranelift", "deflatten", "deflattened", + "deflattening", + "defunctionalization", "defunctionalize", "defunctionalized", - "defunctionalization", + "deque", "desugared", + "direnv", "eddsa", "endianness", + "envrc", "Flamegraph", + "flate", + "fmtstr", + "foldl", "forall", "foralls", + "formatcp", + "fxhash", + "getrandom", + "gloo", "Guillaume", + "hasher", + "hexdigit", "higher-kinded", "Hindley-Milner", "idents", "impls", "injective", + "Inlines", "interner", "intrinsics", "jmp", @@ -50,63 +75,48 @@ "monomorphizer", "monomorphizes", "nand", + "nargo", + "nixpkgs", + "noirc", + "noirup", "pedersen", "peekable", + "plonkc", "pprof", "preprocess", "prettytable", "printstd", "pseudocode", + "rustc", + "rustup", "schnorr", "sdiv", + "secp256k1", + "secp256r1", "signedness", + "smol", + "splitn", "srem", "stdlib", "struct", "subexpression", + "subshell", "subtyping", + "tempdir", + "tempfile", + "termcolor", + "thiserror", + "tslog", + "typecheck", + "typechecked", "typevar", "typevars", "udiv", "uninstantiated", "unnormalized", + "unoptimized", "urem", "vecmap", - "direnv", - "nixpkgs", - "envrc", - "subshell", - // Dependencies - // - "acir", - "acvm", - "arkworks", - "bincode", - "bindgen", - "bitand", - "canonicalize", - "chumsky", - "clippy", - "deque", - "flate", - "foldl", - "formatcp", - "fxhash", - "gloo", - "hasher", - "hexdigit", - "nargo", - "noirc", - "noirup", - "plonkc", - "rustc", - "rustup", - "secp256k1", - "secp256r1", - "smol", - "tempdir", - "tempfile", - "termcolor", - "thiserror" + "wasi" ] } diff --git a/tooling/nargo_cli/tests/compile_success_empty/instruction_deduplication/src/main.nr b/tooling/nargo_cli/tests/compile_success_empty/instruction_deduplication/src/main.nr index 43a6da8d6e4..09aa8ee47f2 100644 --- a/tooling/nargo_cli/tests/compile_success_empty/instruction_deduplication/src/main.nr +++ b/tooling/nargo_cli/tests/compile_success_empty/instruction_deduplication/src/main.nr @@ -1,5 +1,5 @@ fn main(x : Field) { // This is a regression test for #2450. - // The compiler should recognise that the `(x as u32)` instructions are duplicates and so have the same output. + // The compiler should recognize that the `(x as u32)` instructions are duplicates and so have the same output. assert(x as u32 == x as u32); } 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 aba7ba41f35..6d75dcccc66 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,7 @@ use dep::std::hash::poseidon; fn main(x: [Field; 7]) { - // Test optimised sponge + // Test optimized sponge let result = poseidon::bn254::sponge(x); assert(result == 0x080ae1669d62f0197190573d4a325bfb8d8fc201ce3127cbac0c47a7ac81ac48);