-
Notifications
You must be signed in to change notification settings - Fork 214
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
Cannot resolve static struct methods in global declarations #1440
Comments
@jfecher is this still an issue? |
@kevaundray yes, name resolution still does not check if a module name is actually a typename |
@f01dab1e assigning this issue to you! |
any hints? |
@f01dab1e I think this may have to do with resolution order of globals. Since globals are currently resolved before structs, I think |
if I change the resolution order, it solves the problem above, but creates a new one:
|
@f01dab1e It looks like your current error is related to globals not being known when those types are resolved, so the array types using globals default to a size of |
@jfecher I think that we added new dependency resolution logic to the compiler which closes this issue. Is this correct? |
@TomAFrench no, this is still an issue. The dependency graph verifies we don't have cyclic dependencies but does not actually change resolution order. |
# Description ## Problem\* Resolves #1440 ## Summary\* This was a fairly simple change - non-integer globals used to be resolved before struct methods were even collected. I've moved this to after methods are collected. Now global resolution is the first step of resolving in general. Integer globals are still resolved early since structs may refer to them in numeric generics. ## Additional Context ## Documentation\* Check one: - [x] No documentation needed. - [ ] Documentation included in this PR. - [ ] **[Exceptional Case]** 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.
Aim
I was trying to create a global struct instance with a property computed by a static method of another struct. A boiled down version of this would be:
Expected Behavior
It should compile without issues, given that the following code does work and is functionally equivalent:
Bug
Seems like a resolution issue (maybe static struct methods are not globals?):
To Reproduce
Installation Method
Compiled from source
Nargo Version
nargo 0.6.0 (git version hash: 8778a1d, 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: