Skip to content

Commit

Permalink
chore: rename DefinitionKind::GenericType (#6182)
Browse files Browse the repository at this point in the history
# Description

## Problem\*

Resolves #6181

## Summary\*



## Additional Context



## Documentation\*

Check one:
- [x] No documentation needed.
- [ ] Documentation included in this PR.
- [ ] **[For Experimental Features]** Documentation to be submitted in a
separate PR.

# PR Checklist\*

- [x] I have tested the changes locally.
- [x] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.
  • Loading branch information
michaeljklein authored Oct 1, 2024
1 parent be9dcfe commit 79f8954
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion compiler/noirc_frontend/src/elaborator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion compiler/noirc_frontend/src/elaborator/patterns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion compiler/noirc_frontend/src/hir/comptime/interpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
2 changes: 1 addition & 1 deletion compiler/noirc_frontend/src/monomorphization/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
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 @@ -586,7 +586,7 @@ pub enum DefinitionKind {

/// Generic types in functions (T, U in `fn foo<T, U>(...)` are declared as variables
/// in scope in case they resolve to numeric generics later.
GenericType(TypeVariable),
NumericGeneric(TypeVariable),
}

impl DefinitionKind {
Expand All @@ -601,7 +601,7 @@ impl DefinitionKind {
DefinitionKind::Function(_) => None,
DefinitionKind::Global(_) => None,
DefinitionKind::Local(id) => *id,
DefinitionKind::GenericType(_) => None,
DefinitionKind::NumericGeneric(_) => None,
}
}
}
Expand Down

0 comments on commit 79f8954

Please sign in to comment.