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 2831241
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
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 2831241

Please sign in to comment.