-
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
Closure environments aren't added to a closure's parameters #2120
Comments
Looking at the lambda from this example in the monomorphized IR:
We can see that the "variable not found" panic is correct since |
Also, this may help with debugging: To get the above output I added a |
@jfecher I've submitted a PR that should fix this this: #2257
However another unrelated codegen issue popped up, that still prevents this example from working properly: #2255 |
* master: (80 commits) fix: properly capture lvalues in closure environments (#2120) (#2257) fix: Optimize contracts built by `nargo info` (#2259) chore: impl Display for DebugType (#2258) chore: update `noir_wasm` build process to match `acvm_js` (#2067) feat: Implement traits - parser support #2094 (#2230) chore: Refactor DefCollector duplicate errors (#2231) chore: Address clippy warnings (#2246) feat: Support `contract` package type in `nargo info` command (#2249) feat: Add slice append (#2241) chore: Bump `async-lsp` to v0.0.5 (#2186) chore: Move the remaining `nargo_cli` lib funcs into `nargo` crate (#2225) chore: Add test for eddsa (#2237) chore: Split `Nargo.toml` operations into separate package (#2224) fix(stdlib): correct `tecurve::contains` formula (#1821) feat: Remove `comptime` and warn upon usage (#2178) fix: Remove last vestige of array of structs to struct of arrays conversion (#2217) fix: Add foreign impl error (#2216) feat(nargo)!: Replace `--contracts` flag with `contract` package type (#2204) feat: Optimize `x < 0` for unsigned `x` to false (#2206) fix: Initialize numeric generics' type to a polymorphic integer when used in an expression (#2179) ...
* master: (29 commits) feat(nargo): Add support for contracts in `nargo check` (#2267) chore(ci): Name wasm job more clearly (#2269) chore(ci): Create cache key with consideration to target (#2273) chore(ci): Run publish workflow against PRs (#2268) chore: Merge in contents of `build-nargo` repository (#2211) fix(lsp): Improve dependency resolution in context of `Nargo.toml` (#2226) chore: Remove unnecessary duplication in how we test Noir compiler (#2248) fix: properly capture lvalues in closure environments (#2120) (#2257) fix: Optimize contracts built by `nargo info` (#2259) chore: impl Display for DebugType (#2258) chore: update `noir_wasm` build process to match `acvm_js` (#2067) feat: Implement traits - parser support #2094 (#2230) chore: Refactor DefCollector duplicate errors (#2231) chore: Address clippy warnings (#2246) feat: Support `contract` package type in `nargo info` command (#2249) feat: Add slice append (#2241) chore: Bump `async-lsp` to v0.0.5 (#2186) chore: Move the remaining `nargo_cli` lib funcs into `nargo` crate (#2225) chore: Add test for eddsa (#2237) chore: Split `Nargo.toml` operations into separate package (#2224) ...
* master: feat(nargo): Add support for contracts in `nargo check` (#2267) chore(ci): Name wasm job more clearly (#2269) chore(ci): Create cache key with consideration to target (#2273) chore(ci): Run publish workflow against PRs (#2268) chore: Merge in contents of `build-nargo` repository (#2211) fix(lsp): Improve dependency resolution in context of `Nargo.toml` (#2226) chore: Remove unnecessary duplication in how we test Noir compiler (#2248) fix: properly capture lvalues in closure environments (#2120) (#2257) fix: Optimize contracts built by `nargo info` (#2259) chore: impl Display for DebugType (#2258) chore: update `noir_wasm` build process to match `acvm_js` (#2067) feat: Implement traits - parser support #2094 (#2230) chore: Refactor DefCollector duplicate errors (#2231) chore: Address clippy warnings (#2246) feat: Support `contract` package type in `nargo info` command (#2249)
# Description This issue has been resolved, presumably by github.com//pull/2457, but this test no longer appears to be in the repo so re-adding it to prevent regressions. ## Problem\* Resolves #2120 ## Summary\* This just adds a test. ## 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.
* master: (22 commits) feat: remove predicate from `sort` intrinsic function (#4228) chore: add test for missing lambda closure environment (#2120) (#4212) chore(docs): Updates following `is_recursive` flag removal (#4199) fix: from field with constant values (#4226) feat: Option expect method (#4219) feat: Evaluation of dynamic assert messages (#4101) chore(docs): XOR typo in docs (#4223) fix: apply range constraints to return values from unconstrained functions (#4217) fix(lsp): replace panics with errors (#4209) feat: Improve Error Handling for Cargo in Bootstrap Script (#4211) fix: prevent declarations of blackbox functions outside of the stdlib (#4177) feat: disable unused variable checks on low-level and oracle functions (#4179) chore: Rename acir_docs.md to README.md (#4208) feat: remove replacement of boolean range opcodes with `AssertZero` opcodes (#4107) chore(docs): updating docs to match new recursion interfacee (#4187) feat!: Sync commits from `aztec-packages` (#4144) feat: multiply first to allow more ACIR gen optimizations (#4201) feat: Move bounded_vec into the noir stdlib (#4197) chore: simplify marking black box function outputs as solvable (#4194) chore(doc): Add docs for `assert_max_bit_size` (#4196) ...
Aim
Try to assign to a value using a captured mutable reference to it in a closure:
(example by @jfecher ):
run
nargo execute
in this projectExpected Behavior
assertions pass correctly, no error
Bug
A lookup ssa ICE:
To Reproduce
No response
Installation Method
Compiled from source
Nargo Version
nargo 0.9.0 (git version hash: 39610af, is dirty: true)
Additional Context
originated here #1959 (comment)
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: