Skip to content
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

Incorrect error message "Index out of bounds..." - size and index values are swapped #3629

Closed
akonior opened this issue Nov 29, 2023 · 0 comments · Fixed by #3630
Closed
Labels
bug Something isn't working

Comments

@akonior
Copy link
Contributor

akonior commented Nov 29, 2023

Aim

Accessing an array element out of range generates an invalid message. size and index values are swapped with each other. For example for the following code

fn main() -> pub u8 {
     [][3]
}

Compiler fails with

error: Index out of bounds, array has size 3, but index was 0

Expected Behavior

Proper error message "Index out of bounds, array has size 0, but index was 3"

Bug

Example code with configured CI https://github.com/akonior/noir_example/actions/runs/7030885432/job/19131368752

To Reproduce

Write simple Noir program

fn main() -> pub u8 {
     [][3]
}

and run

nargo compile

Installation Method

Binary

Nargo Version

0.19.2

Additional Context

No response

Would you like to submit a PR for this Issue?

Yes

Support Needs

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant