Skip to content

Commit

Permalink
clarify some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
alexvitkov committed Sep 19, 2023
1 parent 4236e6d commit 49da5e7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion compiler/noirc_frontend/src/hir/type_check/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,9 @@ impl<'interner> TypeChecker<'interner> {

for constraint in func_meta.trait_constraints {
if let Some(trait_id) = constraint.trait_id {
// TODO: this == check *seems* to work?
// TODO: == on types is sketchy, because Field != TypeVar::Bound(Field)
// unify() is sketchier here though, since it may accidentally commit typebindings.
// this works for now, but probably needs to be revisited when implementing generic traits
if *object_type == constraint.typ {
let the_trait = self.interner.get_trait(trait_id);
let the_trait = the_trait.borrow();
Expand Down
3 changes: 3 additions & 0 deletions compiler/noirc_frontend/src/monomorphization/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,9 @@ impl<'interner> Monomorphizer<'interner> {
) -> ast::Expression {
let function_type = self.interner.id_type(expr_id);

// the substitute() here is to replace all internal occurences of the 'Self' typevar
// with whatever 'Self' is currently bound to, so we don't lose type information
// if we need to rebind the trait.
let trait_impl = self
.interner
.get_trait_implementation(&TraitImplKey {
Expand Down

0 comments on commit 49da5e7

Please sign in to comment.