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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] cannot assign to non-const array index #935

Closed
0rphon opened this issue May 10, 2021 · 6 comments 路 Fixed by #1019
Closed

[Bug] cannot assign to non-const array index #935

0rphon opened this issue May 10, 2021 · 6 comments 路 Fixed by #1019
Assignees
Labels
bug Something isn't working priority-critical A critical bug that is stopping developers writing Leo programs.

Comments

@0rphon
Copy link
Contributor

0rphon commented May 10, 2021

馃悰 Bug Report

Code snippet to reproduce

function main (x: u8) {
    let y = [0u8; 4];
    // works fine
    y[x] = 1u8;
    // error
    y[x > 1u8? 1u8 : 2u8] = 1u8;
}

Stack trace & error message

D:\Work\leo-playground>D:\Work\leo_repos\leo\target\release\leo clean && D:\Work\leo_repos\leo\target\release\leo run
      Done Finished in 1 milliseconds 

     Build Starting...
     Build Compiling main program... ("D:\\Work\\leo-playground\\src/main.leo")
     Build Number of constraints - 46
     Build Complete
      Done Finished in 5 milliseconds

     Setup Starting...
     Setup     --> D:\Work\leo-playground\src/main.leo:6:5
     |
   6 |     y[x > 1u8? 1u8 : 2u8] = 1u8;
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = Cannot assign to non-const array index
      Done Finished in 2 milliseconds

Error: Unable to setup, see command output for more details

Your Environment

  • leo commit 04e9bf2
  • rustc version 1.53.0-nightly
  • Windows 10.0.19042 (Windows 10 Pro) [64-bit]
@0rphon 0rphon added bug Something isn't working fuzz-bug labels May 10, 2021
@0rphon
Copy link
Contributor Author

0rphon commented May 10, 2021

im looking over some old bugs and i realized that this is likely related to #889

@damirka damirka self-assigned this May 27, 2021
@damons
Copy link

damons commented Jun 4, 2021

Bumping up the priority on this as it's affecting our community pretty dramatically. Marking it so we fix it this sprint.

@damons damons added the priority-critical A critical bug that is stopping developers writing Leo programs. label Jun 4, 2021
@0rphon
Copy link
Contributor Author

0rphon commented Jun 4, 2021

@damons bump #889 as well since its related

@howardwu
Copy link
Member

howardwu commented Jun 4, 2021

@collinc97 can you take a look at this?

@howardwu
Copy link
Member

howardwu commented Jun 4, 2021

Assigning to @Protryon

@0rphon
Copy link
Contributor Author

0rphon commented Jun 7, 2021

it seems like this only causes an invalid proof instead of an error now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority-critical A critical bug that is stopping developers writing Leo programs.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants