Skip to content

Commit

Permalink
chore: remove panic for unimplemented trait dispatch (#5329)
Browse files Browse the repository at this point in the history
# Description

## Problem\*


## Summary\*

This PR replaces a panic with a nicer error plus a link to the relevant
issue: #4925

## Additional Context



## 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.

---------

Co-authored-by: jfecher <[email protected]>
  • Loading branch information
TomAFrench and jfecher authored Jun 25, 2024
1 parent 0bd22bb commit 558a614
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions compiler/noirc_frontend/src/hir/comptime/interpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -609,10 +609,13 @@ impl<'a> Interpreter<'a> {
let rhs = self.evaluate(infix.rhs)?;

// TODO: Need to account for operator overloading
assert!(
self.interner.get_selected_impl_for_expression(id).is_none(),
"Operator overloading is unimplemented in the interpreter"
);
// See https://github.com/noir-lang/noir/issues/4925
if self.interner.get_selected_impl_for_expression(id).is_some() {
return Err(InterpreterError::Unimplemented {
item: "Operator overloading in the interpreter".to_string(),
location: infix.operator.location,
});
}

use InterpreterError::InvalidValuesForBinary;
match infix.operator.kind {
Expand Down

0 comments on commit 558a614

Please sign in to comment.