From 756ffc4fdb760bfa1f4a4fb420ecdc8160d7c377 Mon Sep 17 00:00:00 2001 From: "Michael J. Klein" Date: Mon, 30 Sep 2024 17:41:40 -0400 Subject: [PATCH] chore: rename DefinitionKind::GenericType -> DefinitionKind::NumericGeneric --- compiler/noirc_frontend/src/elaborator/mod.rs | 2 +- compiler/noirc_frontend/src/elaborator/patterns.rs | 2 +- compiler/noirc_frontend/src/hir/comptime/interpreter.rs | 2 +- compiler/noirc_frontend/src/monomorphization/mod.rs | 2 +- compiler/noirc_frontend/src/node_interner.rs | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/compiler/noirc_frontend/src/elaborator/mod.rs b/compiler/noirc_frontend/src/elaborator/mod.rs index c5e457c405b..c9195fdc267 100644 --- a/compiler/noirc_frontend/src/elaborator/mod.rs +++ b/compiler/noirc_frontend/src/elaborator/mod.rs @@ -360,7 +360,7 @@ impl<'context> Elaborator<'context> { // Introduce all numeric generics into scope for generic in &all_generics { if let Kind::Numeric(typ) = &generic.kind { - let definition = DefinitionKind::GenericType(generic.type_var.clone()); + let definition = DefinitionKind::NumericGeneric(generic.type_var.clone()); let ident = Ident::new(generic.name.to_string(), generic.span); let hir_ident = self.add_variable_decl( ident, false, // mutable diff --git a/compiler/noirc_frontend/src/elaborator/patterns.rs b/compiler/noirc_frontend/src/elaborator/patterns.rs index 6ed59a61e4e..56b7eb30b3b 100644 --- a/compiler/noirc_frontend/src/elaborator/patterns.rs +++ b/compiler/noirc_frontend/src/elaborator/patterns.rs @@ -557,7 +557,7 @@ impl<'context> Elaborator<'context> { self.interner.add_global_reference(global_id, hir_ident.location); } - DefinitionKind::GenericType(_) => { + DefinitionKind::NumericGeneric(_) => { // Initialize numeric generics to a polymorphic integer type in case // they're used in expressions. We must do this here since type_check_variable // does not check definition kinds and otherwise expects parameters to diff --git a/compiler/noirc_frontend/src/hir/comptime/interpreter.rs b/compiler/noirc_frontend/src/hir/comptime/interpreter.rs index e920073b453..16f154e3ec0 100644 --- a/compiler/noirc_frontend/src/hir/comptime/interpreter.rs +++ b/compiler/noirc_frontend/src/hir/comptime/interpreter.rs @@ -582,7 +582,7 @@ impl<'local, 'interner> Interpreter<'local, 'interner> { Ok(value) } } - DefinitionKind::GenericType(type_variable) => { + DefinitionKind::NumericGeneric(type_variable) => { let value = match &*type_variable.borrow() { TypeBinding::Unbound(_) => None, TypeBinding::Bound(binding) => binding.evaluate_to_u32(), diff --git a/compiler/noirc_frontend/src/monomorphization/mod.rs b/compiler/noirc_frontend/src/monomorphization/mod.rs index 12cc3b55b1f..fea15b26c5b 100644 --- a/compiler/noirc_frontend/src/monomorphization/mod.rs +++ b/compiler/noirc_frontend/src/monomorphization/mod.rs @@ -916,7 +916,7 @@ impl<'interner> Monomorphizer<'interner> { ast::Expression::Ident(ident) } }, - DefinitionKind::GenericType(type_variable) => { + DefinitionKind::NumericGeneric(type_variable) => { let value = match &*type_variable.borrow() { TypeBinding::Unbound(_) => { unreachable!("Unbound type variable used in expression") diff --git a/compiler/noirc_frontend/src/node_interner.rs b/compiler/noirc_frontend/src/node_interner.rs index a95282a1ec9..8d665ceacbf 100644 --- a/compiler/noirc_frontend/src/node_interner.rs +++ b/compiler/noirc_frontend/src/node_interner.rs @@ -586,7 +586,7 @@ pub enum DefinitionKind { /// Generic types in functions (T, U in `fn foo(...)` are declared as variables /// in scope in case they resolve to numeric generics later. - GenericType(TypeVariable), + NumericGeneric(TypeVariable), } impl DefinitionKind { @@ -601,7 +601,7 @@ impl DefinitionKind { DefinitionKind::Function(_) => None, DefinitionKind::Global(_) => None, DefinitionKind::Local(id) => *id, - DefinitionKind::GenericType(_) => None, + DefinitionKind::NumericGeneric(_) => None, } } }