-
Notifications
You must be signed in to change notification settings - Fork 206
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
Confusing error message when trying to mutate a string #4267
Labels
bug
Something isn't working
Comments
5 tasks
github-merge-queue bot
pushed a commit
that referenced
this issue
Mar 21, 2024
# Description ## Problem\* Resolves #4267 ## Summary\* New error: ```bash error: Strings do not support indexed assignment ┌─ /Users/michaelklein/Coding/rust/noir/test_programs/compile_failure/mutable_str_index/src/main.nr:3:5 │ 3 │ example[0] = "?"; │ ------- │ Aborting due to 1 previous error ``` ## 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.
TomAFrench
pushed a commit
that referenced
this issue
Apr 3, 2024
# Description ## Problem\* Resolves #4267 ## Summary\* New error: ```bash error: Strings do not support indexed assignment ┌─ /Users/michaelklein/Coding/rust/noir/test_programs/compile_failure/mutable_str_index/src/main.nr:3:5 │ 3 │ example[0] = "?"; │ ------- │ Aborting due to 1 previous error ``` ## 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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Aim
Given this test program:
Expected Behavior
Either a successful compilation, or an error message saying that string cannot be mutated.
Bug
The compiler produces the following confusing error message instead:
It seems the compiler expects
s
to be of type array, but the error location is located on the RHS of the assignment.To Reproduce
Compile the above program with
nargo compile
.Installation Method
None
Nargo Version
No response
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: