Skip to content

Commit

Permalink
PR Feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
jfecher committed Feb 10, 2023
1 parent 237308a commit d42cb7d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion crates/noirc_frontend/src/ast/structure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use noirc_errors::Span;
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct NoirStruct {
pub name: Ident,
pub generics: Vec<Ident>,
pub generics: UnresolvedGenerics,
pub fields: Vec<(Ident, UnresolvedType)>,
pub span: Span,
}
Expand Down
9 changes: 6 additions & 3 deletions crates/noirc_frontend/src/hir/def_collector/dc_crate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ pub struct DefCollector {
pub(crate) collected_impls: ImplMap,
}

/// collected impls maps the type and the module id in which
/// the impl is defined to the functions contained in that impl
/// along with the generics declared on the impl itself.
/// Maps the type and the module id in which the impl is defined to the functions contained in that
/// impl along with the generics declared on the impl itself. This also contains the Span
/// of the object_type of the impl, used to issue an error if the object type fails to resolve.
type ImplMap =
HashMap<(UnresolvedType, LocalModuleId), Vec<(UnresolvedGenerics, Span, UnresolvedFunctions)>>;

Expand Down Expand Up @@ -433,6 +433,9 @@ fn resolve_function_set(
StandardPathResolver::new(ModuleId { local_id: mod_id, krate: crate_id });

let mut resolver = Resolver::new(interner, &path_resolver, def_maps, file_id);
// Must use set_generics here to ensure we re-use the same generics from when
// the impl was originally collected. Otherwise the function will be using different
// TypeVariables for the same generic, causing it to instantiate incorrectly.
resolver.set_generics(impl_generics.clone());
resolver.set_self_type(self_type.clone());

Expand Down
2 changes: 1 addition & 1 deletion crates/noirc_frontend/src/hir/resolution/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ impl<'a> Resolver<'a> {
}
Pattern::Struct(name, fields, span) => {
let error_identifier = |this: &mut Self| {
// Must create a name here to return a HirPattern::Identifer. Allowing
// Must create a name here to return a HirPattern::Identifier. Allowing
// shadowing here lets us avoid further errors if we define ERROR_IDENT
// multiple times.
let name = ERROR_IDENT.into();
Expand Down

0 comments on commit d42cb7d

Please sign in to comment.