Skip to content

Commit

Permalink
chore: apply spellcheck (#3143)
Browse files Browse the repository at this point in the history
Co-authored-by: Tom French <git@tomfren.ch>
  • Loading branch information
TomAFrench and TomAFrench authored Oct 13, 2023
1 parent 281c696 commit 99f44a4
Show file tree
Hide file tree
Showing 26 changed files with 107 additions and 97 deletions.
8 changes: 4 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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))

Expand Down
2 changes: 1 addition & 1 deletion acvm-repo/acir/src/circuit/directives.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion compiler/fm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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}"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<T>(a: T, b: T) -> (T,T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ fn collect_variables_of_value(value_id: ValueId, dfg: &DataFlowGraph) -> Vec<Val
Value::Instruction { .. } | Value::Param { .. } => {
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();

Expand Down
4 changes: 2 additions & 2 deletions compiler/noirc_evaluator/src/ssa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)?;

Expand All @@ -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)?;

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion compiler/noirc_evaluator/src/ssa/ir/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
Expand Down
4 changes: 2 additions & 2 deletions compiler/noirc_evaluator/src/ssa/opt/mem2reg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion compiler/noirc_evaluator/src/ssa/ssa_gen/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion compiler/noirc_evaluator/src/ssa/ssa_gen/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub(super) enum Tree<T> {
///
/// 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 {
Expand Down
2 changes: 1 addition & 1 deletion compiler/noirc_frontend/src/ast/expression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
}
}
Expand Down
6 changes: 3 additions & 3 deletions compiler/noirc_frontend/src/hir/aztec_library.rs
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ fn abstract_return_values(func: &NoirFunction) -> Option<Statement> {
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
Expand Down Expand Up @@ -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
)))
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/noirc_frontend/src/hir/def_collector/dc_crate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
10 changes: 5 additions & 5 deletions compiler/noirc_frontend/src/hir/def_collector/dc_mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ impl<'a> ModCollector<'a> {
types: Vec<NoirStruct>,
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();

Expand All @@ -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;
}
};
Expand All @@ -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.
Expand Down Expand Up @@ -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,
};
Expand Down
4 changes: 2 additions & 2 deletions compiler/noirc_frontend/src/hir/def_collector/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {},
Expand Down Expand Up @@ -189,7 +189,7 @@ impl From<DefCollectorErrorKind> 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)
Expand Down
2 changes: 1 addition & 1 deletion compiler/noirc_frontend/src/hir/resolution/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions compiler/noirc_frontend/src/hir/type_check/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
Expand Down
4 changes: 2 additions & 2 deletions compiler/noirc_frontend/src/hir_def/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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),
}

Expand Down
4 changes: 2 additions & 2 deletions compiler/noirc_frontend/src/node_interner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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());
Expand Down
Loading

0 comments on commit 99f44a4

Please sign in to comment.