Skip to content

Commit

Permalink
fix: Don't type error when calling certain trait impls in the interpr…
Browse files Browse the repository at this point in the history
…eter (#5471)

# Description

## Problem\*

Resolves #5428

## Summary\*

The interpreter was calling into `perform_impl_bindings` in more cases
than the monomorphizer.
Where the former calls into it for every trait impl method, the later
only calls into it for methods called from a `TraitMethodExpr` or
`ImplKind::TraitMethod` on an ident/operator.
It seemed more correct to call into this function in all cases so I
removed the bug by also replacing NamedGenerics in the trait itself with
bindable type variables.

## Additional Context

I've moved around some methods in `hir_def/types.rs` so that we don't
have 3 separate `impl Type {`s in the one file. The only two changes in
that file are the addition of
`replace_named_generics_with_type_variables` and the formatting change
for debugging NamedGenerics.

## 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
jfecher authored Jul 12, 2024
1 parent 010c835 commit 299703c
Show file tree
Hide file tree
Showing 5 changed files with 309 additions and 223 deletions.
Loading

0 comments on commit 299703c

Please sign in to comment.