-
Notifications
You must be signed in to change notification settings - Fork 207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Calling trait method from its full path panics #5557
Labels
bug
Something isn't working
Comments
This seems to be related to imports of traits somehow: use std::cmp::Eq;
fn main() {
let x: Field = 0 ;
let _ = Eq::eq(x, x);
} Works but the following does not: fn main() {
let x: Field = 0 ;
let _ = std::cmp::Eq::eq(x, x);
} I've confirmed this is still the case when using a locally defined |
jfecher
changed the title
Calling trait method as a normal function panics
Calling trait method from its full path panics
Jul 18, 2024
Merged
5 tasks
github-merge-queue bot
pushed a commit
that referenced
this issue
Jul 22, 2024
…actly two segments (#5577) # Description ## Problem Resolves #5557 ## Summary For something like `Add::add` the logic was checking if `Add` was a trait, then looking for a method `add` in it. It only worked if the path had exactly two segments. I initially thought the fix was simple: also make it work if there are more segments. However, it got tricky if there's just one segment: we need to find out the trait associated with the found function. This wasn't tracked in `FuncMeta` (well, there was a boolean for it but not the optional `TraitId`) so in this PR this information is now tracked, and the lookup works in all cases. ## Additional Context None. ## 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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Aim
Attempted to call
Add::add
function without using a method call:Expected Behavior
Expected a user error
Bug
The application panicked (crashed). Message: assertion `left == right` failed left: 1 right: 0 Location: compiler/noirc_evaluator/src/ssa/opt/inlining.rs:583
To Reproduce
Project Impact
None
Impact Context
No response
Workaround
Yes
Workaround Description
Bisect the program to find the error
Additional Context
No response
Installation Method
None
Nargo Version
nargo version = 0.31.0 noirc version = 0.31.0+45e82a672b9ba7f7326e8d9f8800e2489013e2e8 (git version hash: 45e82a6, is dirty: false)
NoirJS Version
No response
Would you like to submit a PR for this Issue?
None
Support Needs
No response
The text was updated successfully, but these errors were encountered: