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] empty struct causes build to fail with cryptic error message #2058

Open
cwkang1998 opened this issue Oct 8, 2023 · 0 comments
Open
Labels
bug Something isn't working

Comments

@cwkang1998
Copy link

馃悰 Bug Report

Per title, when defining an empty struct the program fails with a cryptic error message as such:

Error: Failed to parse string. Parsing Error: VerboseError { errors: [("struct MyEmptyStruct:\n\n\nfunction main:\n    input r0 as u32.public;\n    input r1 as u32.private;\n    add r0 r1 into r2;\n    output r2 as u32.private;\n", Nom(Tag)), ("\n\nstruct MyEmptyStruct:\n\n\nfunction main:\n    input r0 as u32.public;\n    input r1 as u32.private;\n    add r0 r1 into r2;\n    output r2 as u32.private;\n", Nom(Alt)), ("\n\nstruct MyEmptyStruct:\n\n\nfunction main:\n    input r0 as u32.public;\n    input r1 as u32.private;\n    add r0 r1 into r2;\n    output r2 as u32.private;\n", Nom(Many1))] }

Below is the program generated from leo build that fails during snarkvm build.
If running directly with snarkvm buildsame error occurs.

program empty_struct_error_message.aleo;

struct MyEmptyStruct:


function main:
    input r0 as u32.public;
    input r1 as u32.private;
    add r0 r1 into r2;
    output r2 as u32.private;

If this was intended, the language server should pick it up and the docs should also have this information available.

Steps to Reproduce

  1. Write a leo and aleo program with an empty struct defined.
  2. Build the program
  3. The error should occur.

A minimal reproduction is available here:
https://github.com/cwkang1998/aleo-bug-report-reproduction/tree/main/empty_struct_error_message

Expected Behavior

Either an appropriate error should be shown during compilation and language server, or this behavior should be allowed.

Your Environment

  • leo 1.9.4
  • snarkVM commit fa509f033aa747c5f924f7b776aabcfa07c431fd
  • rustc 1.73.0 (cc66ad468 2023-10-03)
  • PopOS (Ubuntu) 22.04
@cwkang1998 cwkang1998 added the bug Something isn't working label Oct 8, 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
Projects
None yet
Development

No branches or pull requests

1 participant