-
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.
Parse error on identifiers that are too long.
SnarkVM requires that identifiers fit in a field element.
- Loading branch information
1 parent
4afc757
commit 47d78cd
Showing
11 changed files
with
110 additions
and
33 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
4 changes: 2 additions & 2 deletions
4
tests/expectations/compiler/function/inline_expr_statement.out
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
23 changes: 23 additions & 0 deletions
23
tests/expectations/parser/identifiers/long_identifier_fail.out
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
namespace = "Parse" | ||
expectation = "Fail" | ||
outputs = [""" | ||
Error [EPAR0370044]: Identifier S012345678901234567890123456789q too long (32 bytes; maximum is 31) | ||
--> test:19:12 | ||
| | ||
19 | struct S012345678901234567890123456789q { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
Error [EPAR0370044]: Identifier m012345678901234567890123456789q too long (32 bytes; maximum is 31) | ||
--> test:20:9 | ||
| | ||
20 | m012345678901234567890123456789q: u8, | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
Error [EPAR0370044]: Identifier x012345678901234567890123456789q too long (32 bytes; maximum is 31) | ||
--> test:23:14 | ||
| | ||
23 | function x012345678901234567890123456789q(y012345678901234567890123456789q: u8) -> u8 { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
Error [EPAR0370044]: Identifier y012345678901234567890123456789q too long (32 bytes; maximum is 31) | ||
--> test:23:47 | ||
| | ||
23 | function x012345678901234567890123456789q(y012345678901234567890123456789q: u8) -> 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
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
namespace = "Parse" | ||
expectation = "Fail" | ||
*/ | ||
|
||
program test.aleo { | ||
transition main() -> bool { | ||
return true; | ||
} | ||
|
||
// These identifiers are 31 characters long and should be fine. | ||
struct S012345678901234567890123456789 { | ||
m012345678901234567890123456789: u8, | ||
} | ||
|
||
function x012345678901234567890123456789(y012345678901234567890123456789: u8) -> u8 { | ||
let z012345678901234567890123456789: u8 = 1u8; | ||
return z012345678901234567890123456789 + y012345678901234567890123456789; | ||
} | ||
|
||
// These identifiers are 32 characters long and should fail. | ||
struct S012345678901234567890123456789q { | ||
m012345678901234567890123456789q: u8, | ||
} | ||
|
||
function x012345678901234567890123456789q(y012345678901234567890123456789q: u8) -> u8 { | ||
let z012345678901234567890123456789q: u8 = 1u8; | ||
return z012345678901234567890123456789q + y012345678901234567890123456789q; | ||
} | ||
} |