-
Notifications
You must be signed in to change notification settings - Fork 659
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle closures that are invalid for Aleo.
In particular, 1. Insert a dummy instruction for empty closures. SnarkVM won't parse closures with no instructions. 2. Give a parse error for Leo functions with no parameters (rather than just generating an invalid Aleo closure). Fixes #28401
- Loading branch information
1 parent
a15db14
commit 5cadd8c
Showing
6 changed files
with
29 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,8 @@ | ||
namespace = "Parse" | ||
expectation = "Pass" | ||
|
||
[[outputs]] | ||
|
||
[outputs.imports] | ||
|
||
[outputs.stubs] | ||
|
||
[outputs.program_scopes.test] | ||
program_id = '{"name":"test","network":"\"{\\\"id\\\":\\\"1\\\",\\\"name\\\":\\\"aleo\\\",\\\"span\\\":\\\"{\\\\\\\"lo\\\\\\\":0,\\\\\\\"hi\\\\\\\":0}\\\"}\""}' | ||
consts = [] | ||
structs = [] | ||
mappings = [] | ||
functions = [[ | ||
"x", | ||
{ annotations = [], variant = "Function", identifier = '{"id":"2","name":"x","span":"{\"lo\":39,\"hi\":40}"}', input = [], id = 5, output = [{ mode = "None", id = 3, type_ = { Integer = "U8" }, span = { lo = 46, hi = 48 } }], output_type = { Integer = "U8" }, block = { statements = [], id = 4, span = { lo = 49, hi = 51 } }, span = { lo = 30, hi = 51 } }, | ||
]] | ||
|
||
[outputs.program_scopes.test.span] | ||
lo = 2 | ||
hi = 52 | ||
expectation = "Fail" | ||
outputs = [""" | ||
Error [EPAR0370044]: Cannot define a function with no parameters. | ||
--> test:4:15 | ||
| | ||
4 | function x() -> u8 {} | ||
| ^^"""] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ program test.aleo { | |
owner: bool, | ||
} | ||
|
||
function main() -> bool { | ||
function main(x: field) -> bool { | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
/* | ||
namespace = "Parse" | ||
expectation = "Pass" | ||
expectation = "Fail" | ||
*/ | ||
|
||
program test.aleo { | ||
function x() -> u8 {}} | ||
function x() -> u8 {} | ||
} |