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

Format printing a string or array panics when > 2 characters #2906

Closed
vezenovm opened this issue Sep 29, 2023 · 0 comments · Fixed by #2947
Closed

Format printing a string or array panics when > 2 characters #2906

vezenovm opened this issue Sep 29, 2023 · 0 comments · Fixed by #2947
Assignees
Labels
bug Something isn't working compiler nargo Noir's CLI development tool

Comments

@vezenovm
Copy link
Contributor

Aim

I want to be able to format print string and array values.

Run either of these tests:

#[test]
fn test_print_bytes()
{
    let label_f = [1, 2, 3];
    dep::std::println(f"{label_f}");  
}

or

#[test] 
fn test_print_bytes()
{
    let label_f = "123";
    dep::std::println(f"{label_f}");  
}

Expected Behavior

I was expecting to be able to print both the array and string as expected.

Bug

Instead we get a panic with:

The application panicked (crashed).
Message:  range end index 3 out of range for slice of length 2
Location: compiler/noirc_printable_type/src/lib.rs:135

To Reproduce

  1. Copy the snippet in the issue
  2. Run nargo test --show-output

Installation Method

None

Nargo Version

No response

Additional Context

This is labelled both compiler and nargo as our println is provided type information by the compiler but is implemented using the brillig foreign call functionality that is implemented in nargo.

Would you like to submit a PR for this Issue?

No

Support Needs

No response

@vezenovm vezenovm added bug Something isn't working compiler nargo Noir's CLI development tool P-MEDIUM labels Sep 29, 2023
@vezenovm vezenovm self-assigned this Sep 29, 2023
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir Sep 29, 2023
@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in Noir Oct 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compiler nargo Noir's CLI development tool
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant