You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to create a global by calling a static method on a struct which is defined in another module.
My program is then
global some_wrapped_value: thing::FooStruct = thing::FooStruct::new();mod thing {structFooStruct{inner:Field}implFooStruct{pubfnnew() -> Self{FooStruct{inner:0}}}}
Expected Behavior
This program should compile successfully with some_wrapped_value being equal to FooStruct { inner: 0 }.
Bug
Compilation fails with the error below:
$ nargo execute
error: Could not resolve 'FooStruct' in path
┌─ /home/tom/Programming/aztec/noir/test_programs/execution_success/global_consts/src/main.nr:80:13
│
80 │ FooStruct { inner: 0 }
│ ---------
│
Aborting due to 1 previous error
To Reproduce
copy-paste above code into program with an empty fn main() {} and compile
Project Impact
None
Impact Context
No response
Workaround
None
Workaround Description
No response
Additional Context
This bug seems to specifically hit static methods on structs which are being referred to using full path as opposed to being imported into the current module as the following programs compile:
FooStruct is imported into current module:
global some_wrapped_value:FooStruct = FooStruct::new();use thing::FooStruct;mod thing {structFooStruct{inner:Field}implFooStruct{pubfnnew() -> Self{FooStruct{inner:0}}}}
some_wrapped_value is being initialized to be equal to a FooStruct constructed in the same module as where it is defined.
global some_wrapped_value: thing::FooStruct = thing::foo_thing;mod thing {
global foo_thing:FooStruct = FooStruct::new();structFooStruct{inner:Field}implFooStruct{pubfnnew() -> Self{FooStruct{inner:0}}}}
Installation Method
None
Nargo Version
No response
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:
# Description
## Problem\*
Resolves#5271
## Summary\*
Lazily elaborating functions wasn't correct since the FuncMeta object
never stored the LocalModuleId carried by the set of unresolved
functions. This lead to lazily elaborated functions be elaborated in a
different module than intended.
## Additional Context
Lazily elaborated functions seem to no longer be necessary to run our
tests, nor to run the tests in aztec-nr so I've just removed them rather
than adding the additional fields to FuncMeta.
## 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.
Aim
I would like to create a
global
by calling a static method on a struct which is defined in another module.My program is then
Expected Behavior
This program should compile successfully with
some_wrapped_value
being equal toFooStruct { inner: 0 }
.Bug
Compilation fails with the error below:
To Reproduce
copy-paste above code into program with an empty
fn main() {}
and compileProject Impact
None
Impact Context
No response
Workaround
None
Workaround Description
No response
Additional Context
This bug seems to specifically hit static methods on structs which are being referred to using full path as opposed to being imported into the current module as the following programs compile:
FooStruct
is imported into current module:some_wrapped_value
is being initialized to be equal to aFooStruct
constructed in the same module as where it is defined.Installation Method
None
Nargo Version
No response
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: