-
Notifications
You must be signed in to change notification settings - Fork 230
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(acir_gen): Nested dynamic array initialization (#5810)
# Description ## Problem\* Resolves #5782 ## Summary\* We are using our recursive `initialize_array_inner` function to also check whether the outer AcirValue we are trying to initialize is a dynamic array. We should be able to initialize a new AcirValue::Array with internal AcirValue::DynamicArray types. ## Additional Context ## 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.
- Loading branch information
Showing
4 changed files
with
35 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
test_programs/execution_success/nested_dyn_array_regression_5782/Nargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[package] | ||
name = "nested_dyn_array_regression_5782" | ||
type = "bin" | ||
authors = [""] | ||
compiler_version = ">=0.33.0" | ||
|
||
[dependencies] |
2 changes: 2 additions & 0 deletions
2
test_programs/execution_success/nested_dyn_array_regression_5782/Prover.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
array = [5, 10] | ||
i = 1 |
13 changes: 13 additions & 0 deletions
13
test_programs/execution_success/nested_dyn_array_regression_5782/src/main.nr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
fn main(mut array: [Field; 2], i: u32) { | ||
assert_eq(array[i - 1], 5); | ||
assert_eq(array[i], 10); | ||
|
||
array[i] = 2; | ||
|
||
let array2 = [array, array]; | ||
|
||
assert_eq(array2[0][0], 5); | ||
assert_eq(array2[0][i], 2); | ||
assert_eq(array2[i][0], 5); | ||
assert_eq(array2[i][i], 2); | ||
} |