From 6808aa5d7b29f017aeddb4a59be53c043793eadc Mon Sep 17 00:00:00 2001 From: Tom French Date: Thu, 30 Mar 2023 15:24:00 +0100 Subject: [PATCH 1/2] chore: apply spelling fixes --- crates/nargo_cli/tests/test_data/4_sub/src/main.nr | 2 +- crates/noirc_evaluator/src/errors.rs | 2 +- .../src/ssa/acir_gen/operations/intrinsics.rs | 8 ++++---- .../noirc_evaluator/src/ssa/acir_gen/operations/sort.rs | 4 ++-- crates/noirc_frontend/src/hir/resolution/resolver.rs | 2 +- crates/noirc_frontend/src/hir_def/mod.rs | 2 +- crates/noirc_frontend/src/hir_def/types.rs | 2 +- cspell.json | 5 +++++ 8 files changed, 16 insertions(+), 11 deletions(-) diff --git a/crates/nargo_cli/tests/test_data/4_sub/src/main.nr b/crates/nargo_cli/tests/test_data/4_sub/src/main.nr index 7038471eaee..242be90970f 100644 --- a/crates/nargo_cli/tests/test_data/4_sub/src/main.nr +++ b/crates/nargo_cli/tests/test_data/4_sub/src/main.nr @@ -1,4 +1,4 @@ -// Test unsafe integer substraction with underflow: 12 - 2418266113 = 1876701195 modulo 2^32 +// Test unsafe integer subtraction with underflow: 12 - 2418266113 = 1876701195 modulo 2^32 fn main(mut x: u32, y: u32, z: u32) { x -= y; constrain x == z; diff --git a/crates/noirc_evaluator/src/errors.rs b/crates/noirc_evaluator/src/errors.rs index b62bc467dad..764a900a057 100644 --- a/crates/noirc_evaluator/src/errors.rs +++ b/crates/noirc_evaluator/src/errors.rs @@ -23,7 +23,7 @@ impl RuntimeError { } // Keep one of the two location which is Some, if possible - // This is used when we optimise instructions so that we do not loose track of location + // This is used when we optimize instructions so that we do not loose track of location pub fn merge_location(a: Option, b: Option) -> Option { match (a, b) { (Some(loc), _) | (_, Some(loc)) => Some(loc), diff --git a/crates/noirc_evaluator/src/ssa/acir_gen/operations/intrinsics.rs b/crates/noirc_evaluator/src/ssa/acir_gen/operations/intrinsics.rs index 9ba2322d730..de23a45ef9d 100644 --- a/crates/noirc_evaluator/src/ssa/acir_gen/operations/intrinsics.rs +++ b/crates/noirc_evaluator/src/ssa/acir_gen/operations/intrinsics.rs @@ -44,23 +44,23 @@ pub(crate) fn evaluate( let outputs; match opcode { - Opcode::ToBits(endianess) => { + Opcode::ToBits(endianness) => { // TODO: document where `0` and `1` are coming from, for args[0], args[1] let bit_size = ctx.get_as_constant(args[1]).unwrap().to_u128() as u32; let l_c = acir_gen.var_cache.get_or_compute_internal_var_unwrap(args[0], evaluator, ctx); - outputs = to_radix_base(l_c.expression(), 2, bit_size, endianess, evaluator); + outputs = to_radix_base(l_c.expression(), 2, bit_size, endianness, evaluator); if let ObjectType::Pointer(a) = res_type { acir_gen.memory.map_array(a, &outputs, ctx); } } - Opcode::ToRadix(endianess) => { + Opcode::ToRadix(endianness) => { // TODO: document where `0`, `1` and `2` are coming from, for args[0],args[1], args[2] let radix = ctx.get_as_constant(args[1]).unwrap().to_u128() as u32; let limb_size = ctx.get_as_constant(args[2]).unwrap().to_u128() as u32; let l_c = acir_gen.var_cache.get_or_compute_internal_var_unwrap(args[0], evaluator, ctx); - outputs = to_radix_base(l_c.expression(), radix, limb_size, endianess, evaluator); + outputs = to_radix_base(l_c.expression(), radix, limb_size, endianness, evaluator); if let ObjectType::Pointer(a) = res_type { acir_gen.memory.map_array(a, &outputs, ctx); } diff --git a/crates/noirc_evaluator/src/ssa/acir_gen/operations/sort.rs b/crates/noirc_evaluator/src/ssa/acir_gen/operations/sort.rs index 48837136083..fe7c39de7ce 100644 --- a/crates/noirc_evaluator/src/ssa/acir_gen/operations/sort.rs +++ b/crates/noirc_evaluator/src/ssa/acir_gen/operations/sort.rs @@ -45,7 +45,7 @@ pub(crate) fn evaluate_permutation_with_witness( // in_expr: inputs of the sorting network // if generate_witness is false, it uses the witness provided in bits instead of generating them // in both cases it returns the witness of the network configuration -// if generate_witnes is true, bits is ignored +// if generate_witness is true, bits is ignored fn permutation_layer( in_expr: &Vec, bits: &[Witness], @@ -93,7 +93,7 @@ fn permutation_layer( let (w1, b1) = permutation_layer(&in_sub1, bits1, generate_witness, evaluator); let bits2 = if generate_witness { bits } else { &bits[n1 + (n - 1) / 2 + w1.len()..] }; let (w2, b2) = permutation_layer(&in_sub2, bits2, generate_witness, evaluator); - // apply the output swithces + // apply the output switches for i in 0..(n - 1) / 2 { let c = if generate_witness { evaluator.add_witness_to_cs() } else { bits[n1 + i] }; conf.push(c); diff --git a/crates/noirc_frontend/src/hir/resolution/resolver.rs b/crates/noirc_frontend/src/hir/resolution/resolver.rs index f7dfeb8496d..d01952f7c49 100644 --- a/crates/noirc_frontend/src/hir/resolution/resolver.rs +++ b/crates/noirc_frontend/src/hir/resolution/resolver.rs @@ -685,7 +685,7 @@ impl<'a> Resolver<'a> { // Don't issue a warning if these are unused // // We can fail to find the generic in self.generics if it is an implicit one created - // by the compiler. This can happen when, e.g. elliding array lengths using the slice + // by the compiler. This can happen when, e.g. eliding array lengths using the slice // syntax [T]. if let Some((name, _, span)) = self.generics.iter().find(|(name, _, _)| name.as_ref() == &name_to_find) diff --git a/crates/noirc_frontend/src/hir_def/mod.rs b/crates/noirc_frontend/src/hir_def/mod.rs index 378652738d7..3dc2407486d 100644 --- a/crates/noirc_frontend/src/hir_def/mod.rs +++ b/crates/noirc_frontend/src/hir_def/mod.rs @@ -1,7 +1,7 @@ //! Noir's Hir is the result of the name resolution step (defined in the //! hir module) and is essentially identical to the Ast with some small transformations. //! The HIR is the input to the name resolution pass, the type checking pass, and the -//! monomorphisation pass. +//! monomorphization pass. //! //! Name Resolution takes the AST as input and produces the initial Hir which strongly //! resembles the Ast except: diff --git a/crates/noirc_frontend/src/hir_def/types.rs b/crates/noirc_frontend/src/hir_def/types.rs index e75f2dc79ca..f22ebb621d7 100644 --- a/crates/noirc_frontend/src/hir_def/types.rs +++ b/crates/noirc_frontend/src/hir_def/types.rs @@ -24,7 +24,7 @@ pub enum Type { /// E.g. `u32` would be `Integer(CompTime::No(None), Unsigned, 32)` Integer(CompTime, Signedness, u32), - /// The primitive `bool` type. Like other primitive types, whether bools are known at CompTime + /// The primitive `bool` type. Like other primitive types, whether booleans are known at CompTime /// is also tracked. Unlike the other primitives however, it isn't as useful since it is /// primarily only used when converting between a bool and an integer type for indexing arrays. Bool(CompTime), diff --git a/cspell.json b/cspell.json index 43bf6916bbb..37667e96ba3 100644 --- a/cspell.json +++ b/cspell.json @@ -11,8 +11,10 @@ "blackbox", "codegen", "coeff", + "combinators", "comptime", "desugared", + "endianness", "forall", "foralls", "Guillaume", @@ -27,10 +29,12 @@ "krate", "lvalue", "merkle", + "metas", "monomorphization", "monomorphize", "monomorphized", "monomorphizer", + "monomorphizes", "pedersen", "peekable", "preprocess", @@ -41,6 +45,7 @@ "stdlib", "struct", "subexpression", + "subtyping", "typevar", "typevars", "udiv", From 883e1f6bf28ef87a1afa8db34c46f8253d153c03 Mon Sep 17 00:00:00 2001 From: Tom French <15848336+TomAFrench@users.noreply.github.com> Date: Thu, 30 Mar 2023 18:02:16 +0100 Subject: [PATCH 2/2] Update errors.rs --- crates/noirc_evaluator/src/errors.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/noirc_evaluator/src/errors.rs b/crates/noirc_evaluator/src/errors.rs index 764a900a057..935ef093f4f 100644 --- a/crates/noirc_evaluator/src/errors.rs +++ b/crates/noirc_evaluator/src/errors.rs @@ -23,7 +23,7 @@ impl RuntimeError { } // Keep one of the two location which is Some, if possible - // This is used when we optimize instructions so that we do not loose track of location + // This is used when we optimize instructions so that we do not lose track of location pub fn merge_location(a: Option, b: Option) -> Option { match (a, b) { (Some(loc), _) | (_, Some(loc)) => Some(loc),