-
Notifications
You must be signed in to change notification settings - Fork 219
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
Self
doesn't resolve when calling static struct methods as Self::f
#1791
Labels
bug
Something isn't working
compiler frontend
`noirc_frontend` crate
good first issue
Good for newcomers
Comments
"We need an explicit check for Self" - @jfecher |
@jfecher is this still an issue? |
Just ran into this: struct Foo { }
impl Foo {
fn foo() { }
fn bar() {
Self::foo()
}
} |
5 tasks
github-merge-queue bot
pushed a commit
that referenced
this issue
Jul 31, 2024
# Description ## Problem Resolves #1791 ## Summary When resolving a path (any path), we now check if the first segment is `Self` (a similar check is done in another places of our codebase). If so, resolve the next path segments relative to that type. Only struct types are supported here... in theory a trait type can also show up, but that case is handled as a special case in the compiler. I'll create a follow-up PR removing that special case and seeing if it works. ## 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
Labels
bug
Something isn't working
compiler frontend
`noirc_frontend` crate
good first issue
Good for newcomers
Aim
I was trying to use the
Self
keyword as a path to call the staticone()
method in noirExpected Behavior
Self
keyword should be resolved in the path, allowing for the method to be called, just as it would be in Rust.Bug
When attempting to use the
Self
keyword in noir, the following error is thrown:To Reproduce
nargo compile --allow-warnings
Installation Method
Compiled from source
Nargo Version
nargo 0.6.0 (git version hash: 0181813, is dirty: false)
Additional Context
No response
Would you like to submit a PR for this Issue?
No
Support Needs
No response
The text was updated successfully, but these errors were encountered: