Skip to content

Commit

Permalink
Revert "Just trying something"
Browse files Browse the repository at this point in the history
This reverts commit 133bf59.
  • Loading branch information
asterite committed Jan 14, 2025
1 parent 133bf59 commit a52a95d
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions compiler/noirc_frontend/src/elaborator/patterns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,18 @@ impl<'context> Elaborator<'context> {
let (typ, bindings) =
self.instantiate(t, bindings, generics, function_generic_count, span, location);

// Push any trait constraints required by this definition to the context
// to be checked later when the type of this variable is further constrained.
if let Some(definition) = self.interner.try_definition(ident.id) {
if let DefinitionKind::Function(function) = definition.kind {
let function = self.interner.function_meta(&function);
for mut constraint in function.trait_constraints.clone() {
constraint.apply_bindings(&bindings);
self.push_trait_constraint(constraint, expr_id);
}
}
}

if let ImplKind::TraitMethod(mut method) = ident.impl_kind {
method.constraint.apply_bindings(&bindings);
if method.assumed {
Expand All @@ -757,16 +769,6 @@ impl<'context> Elaborator<'context> {
// that monomorphization can resolve this trait method to the correct impl.
self.push_trait_constraint(method.constraint, expr_id);
}
} else if let Some(definition) = self.interner.try_definition(ident.id) {
// Push any trait constraints required by this definition to the context
// to be checked later when the type of this variable is further constrained.
if let DefinitionKind::Function(function) = definition.kind {
let function = self.interner.function_meta(&function);
for mut constraint in function.trait_constraints.clone() {
constraint.apply_bindings(&bindings);
self.push_trait_constraint(constraint, expr_id);
}
}
}

self.interner.store_instantiation_bindings(expr_id, bindings);
Expand Down

0 comments on commit a52a95d

Please sign in to comment.