-
Notifications
You must be signed in to change notification settings - Fork 18
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Only allow an identifier in the Yul variable declaration position #948
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@nomicfoundation/slang": patch | ||
--- | ||
|
||
Restrict the grammar to correctly only allow an identifier in Yul variable declaration |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# This file is generated automatically by infrastructure scripts. Please don't edit by hand. | ||
|
||
Source: > | ||
1 │ let a.b.c := 1 │ 0..14 | ||
|
||
Errors: # 1 total | ||
- > | ||
Error: Expected Colon or ColonEqual. | ||
╭─[crates/solidity/testing/snapshots/cst_output/YulVariableDeclarationStatement/identifier_with_dots/input.sol:1:6] | ||
│ | ||
1 │ let a.b.c := 1 | ||
│ ─────┬──── | ||
│ ╰────── Error occurred here. | ||
───╯ | ||
|
||
Tree: | ||
- (YulVariableDeclarationStatement): # "let a.b.c := 1\n" (0..15) | ||
- (let_keyword꞉ YulLetKeyword): "let" # (0..3) | ||
- (leading_trivia꞉ Whitespace): " " # (3..4) | ||
- (names꞉ YulIdentifier): "a" # (4..5) | ||
- (SKIPPED): ".b.c := 1\n" # (5..15) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# This file is generated automatically by infrastructure scripts. Please don't edit by hand. | ||
|
||
Source: > | ||
1 │ let a.b.c := 1 │ 0..14 | ||
|
||
Errors: # 1 total | ||
- > | ||
Error: Expected ColonEqual. | ||
╭─[crates/solidity/testing/snapshots/cst_output/YulVariableDeclarationStatement/identifier_with_dots/input.sol:1:6] | ||
│ | ||
1 │ let a.b.c := 1 | ||
│ ─────┬──── | ||
│ ╰────── Error occurred here. | ||
───╯ | ||
|
||
Tree: | ||
- (YulVariableDeclarationStatement): # "let a.b.c := 1\n" (0..15) | ||
- (let_keyword꞉ YulLetKeyword): "let" # (0..3) | ||
- (leading_trivia꞉ Whitespace): " " # (3..4) | ||
- (names꞉ YulIdentifier): "a" # (4..5) | ||
- (SKIPPED): ".b.c := 1\n" # (5..15) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# This file is generated automatically by infrastructure scripts. Please don't edit by hand. | ||
|
||
Source: > | ||
1 │ let a.b.c := 1 │ 0..14 | ||
|
||
Errors: [] | ||
|
||
Tree: | ||
- (YulVariableDeclarationStatement): # "let a.b.c := 1\n" (0..15) | ||
- (let_keyword꞉ YulLetKeyword): "let" # (0..3) | ||
- (leading_trivia꞉ Whitespace): " " # (3..4) | ||
- (names꞉ YulIdentifier): "a.b.c" # (4..9) | ||
- (value꞉ YulVariableDeclarationValue): # " := 1\n" (9..15) | ||
- (assignment꞉ YulAssignmentOperator): # " :=" (9..12) | ||
- (leading_trivia꞉ Whitespace): " " # (9..10) | ||
- (variant꞉ ColonEqual): ":=" # (10..12) | ||
- (expression꞉ YulExpression) ► (variant꞉ YulLiteral): # " 1\n" (12..15) | ||
- (leading_trivia꞉ Whitespace): " " # (12..13) | ||
- (variant꞉ YulDecimalLiteral): "1" # (13..14) | ||
- (trailing_trivia꞉ EndOfLine): "\n" # (14..15) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# This file is generated automatically by infrastructure scripts. Please don't edit by hand. | ||
|
||
Source: > | ||
1 │ let a.b.c := 1 │ 0..14 | ||
|
||
Errors: # 1 total | ||
- > | ||
Error: Expected ColonEqual. | ||
╭─[crates/solidity/testing/snapshots/cst_output/YulVariableDeclarationStatement/identifier_with_dots/input.sol:1:6] | ||
│ | ||
1 │ let a.b.c := 1 | ||
│ ─────┬──── | ||
│ ╰────── Error occurred here. | ||
───╯ | ||
|
||
Tree: | ||
- (YulVariableDeclarationStatement): # "let a.b.c := 1\n" (0..15) | ||
- (let_keyword꞉ YulLetKeyword): "let" # (0..3) | ||
- (leading_trivia꞉ Whitespace): " " # (3..4) | ||
- (names꞉ YulIdentifier): "a" # (4..5) | ||
- (SKIPPED): ".b.c := 1\n" # (5..15) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
let a.b.c := 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tested with
dissect
and we now exactly match this case withsolc
: this was allowed since 0.5.8 until 0.7, where we started disallowing dots in user-defined identifiers.