snarkVM
snarkVM copied to clipboard
[Bug] empty struct causes build to fail with cryptic error message
🐛 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
- Write a leo and aleo program with an empty struct defined.
- Build the program
- 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
@d0cd @evan-schott Is this still a relevant concern?