-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Forbid some empty separated lists in v2 (#667)
Part of #652 These are a bug-fixes along with regression tests added for each case, we use a definition from v0/v1 for these.
- Loading branch information
Showing
17 changed files
with
268 additions
and
8 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
5 changes: 5 additions & 0 deletions
5
crates/solidity/outputs/cargo/tests/src/cst_output/generated/FunctionDefinition.rs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
5 changes: 5 additions & 0 deletions
5
crates/solidity/outputs/cargo/tests/src/cst_output/generated/ImportDirective.rs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
5 changes: 5 additions & 0 deletions
5
crates/solidity/outputs/cargo/tests/src/cst_output/generated/TupleDeconstructionStatement.rs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
5 changes: 5 additions & 0 deletions
5
crates/solidity/outputs/cargo/tests/src/cst_output/generated/UsingDirective.rs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
43 changes: 43 additions & 0 deletions
43
...y/testing/snapshots/cst_output/FunctionDefinition/overridden/generated/0.4.11-success.yml
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,43 @@ | ||
# This file is generated automatically by infrastructure scripts. Please don't edit by hand. | ||
|
||
Source: > | ||
1 │ function some() public virtual override returns (uint256) { │ 0..59 | ||
2 │ return 1; │ 60..70 | ||
3 │ } │ 71..72 | ||
Errors: [] | ||
|
||
Tree: | ||
- FunctionDefinition (Rule): # 0..73 "function some() public virtual override returns (u..." | ||
- FunctionKeyword (Token): "function" # 0..8 | ||
- Identifier (Token): "some" # 9..13 | ||
- ParametersDeclaration (Rule): # 13..15 "()" | ||
- OpenParen (Token): "(" # 13..14 | ||
- CloseParen (Token): ")" # 14..15 | ||
- FunctionAttributes (Rule): # 15..39 " public virtual override" | ||
- PublicKeyword (Token): "public" # 16..22 | ||
- ModifierInvocation (Rule): # 22..30 " virtual" | ||
- IdentifierPath (Rule): # 22..30 " virtual" | ||
- Identifier (Token): "virtual" # 23..30 | ||
- ModifierInvocation (Rule): # 30..39 " override" | ||
- IdentifierPath (Rule): # 30..39 " override" | ||
- Identifier (Token): "override" # 31..39 | ||
- ReturnsDeclaration (Rule): # 39..57 " returns (uint256)" | ||
- ReturnsKeyword (Token): "returns" # 40..47 | ||
- ParametersDeclaration (Rule): # 47..57 " (uint256)" | ||
- OpenParen (Token): "(" # 48..49 | ||
- Parameters (Rule): # 49..56 "uint256" | ||
- Parameter (Rule): # 49..56 "uint256" | ||
- TypeName (Rule): # 49..56 "uint256" | ||
- UintKeyword (Token): "uint256" # 49..56 | ||
- CloseParen (Token): ")" # 56..57 | ||
- Block (Rule): # 57..73 " {\n\treturn 1;\n}\n" | ||
- OpenBrace (Token): "{" # 58..59 | ||
- Statements (Rule): # 60..71 "\treturn 1;\n" | ||
- ReturnStatement (Rule): # 60..71 "\treturn 1;\n" | ||
- ReturnKeyword (Token): "return" # 61..67 | ||
- Expression (Rule): # 67..69 " 1" | ||
- DecimalNumberExpression (Rule): # 67..69 " 1" | ||
- DecimalLiteral (Token): "1" # 68..69 | ||
- Semicolon (Token): ";" # 69..70 | ||
- CloseBrace (Token): "}" # 71..72 |
42 changes: 42 additions & 0 deletions
42
...ty/testing/snapshots/cst_output/FunctionDefinition/overridden/generated/0.5.0-success.yml
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,42 @@ | ||
# This file is generated automatically by infrastructure scripts. Please don't edit by hand. | ||
|
||
Source: > | ||
1 │ function some() public virtual override returns (uint256) { │ 0..59 | ||
2 │ return 1; │ 60..70 | ||
3 │ } │ 71..72 | ||
Errors: [] | ||
|
||
Tree: | ||
- FunctionDefinition (Rule): # 0..73 "function some() public virtual override returns (u..." | ||
- FunctionKeyword (Token): "function" # 0..8 | ||
- Identifier (Token): "some" # 9..13 | ||
- ParametersDeclaration (Rule): # 13..15 "()" | ||
- OpenParen (Token): "(" # 13..14 | ||
- CloseParen (Token): ")" # 14..15 | ||
- FunctionAttributes (Rule): # 15..39 " public virtual override" | ||
- PublicKeyword (Token): "public" # 16..22 | ||
- ModifierInvocation (Rule): # 22..30 " virtual" | ||
- IdentifierPath (Rule): # 22..30 " virtual" | ||
- Identifier (Token): "virtual" # 23..30 | ||
- OverrideSpecifier (Rule): # 30..39 " override" | ||
- OverrideKeyword (Token): "override" # 31..39 | ||
- ReturnsDeclaration (Rule): # 39..57 " returns (uint256)" | ||
- ReturnsKeyword (Token): "returns" # 40..47 | ||
- ParametersDeclaration (Rule): # 47..57 " (uint256)" | ||
- OpenParen (Token): "(" # 48..49 | ||
- Parameters (Rule): # 49..56 "uint256" | ||
- Parameter (Rule): # 49..56 "uint256" | ||
- TypeName (Rule): # 49..56 "uint256" | ||
- UintKeyword (Token): "uint256" # 49..56 | ||
- CloseParen (Token): ")" # 56..57 | ||
- Block (Rule): # 57..73 " {\n\treturn 1;\n}\n" | ||
- OpenBrace (Token): "{" # 58..59 | ||
- Statements (Rule): # 60..71 "\treturn 1;\n" | ||
- ReturnStatement (Rule): # 60..71 "\treturn 1;\n" | ||
- ReturnKeyword (Token): "return" # 61..67 | ||
- Expression (Rule): # 67..69 " 1" | ||
- DecimalNumberExpression (Rule): # 67..69 " 1" | ||
- DecimalLiteral (Token): "1" # 68..69 | ||
- Semicolon (Token): ";" # 69..70 | ||
- CloseBrace (Token): "}" # 71..72 |
40 changes: 40 additions & 0 deletions
40
...ty/testing/snapshots/cst_output/FunctionDefinition/overridden/generated/0.6.0-success.yml
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,40 @@ | ||
# This file is generated automatically by infrastructure scripts. Please don't edit by hand. | ||
|
||
Source: > | ||
1 │ function some() public virtual override returns (uint256) { │ 0..59 | ||
2 │ return 1; │ 60..70 | ||
3 │ } │ 71..72 | ||
Errors: [] | ||
|
||
Tree: | ||
- FunctionDefinition (Rule): # 0..73 "function some() public virtual override returns (u..." | ||
- FunctionKeyword (Token): "function" # 0..8 | ||
- Identifier (Token): "some" # 9..13 | ||
- ParametersDeclaration (Rule): # 13..15 "()" | ||
- OpenParen (Token): "(" # 13..14 | ||
- CloseParen (Token): ")" # 14..15 | ||
- FunctionAttributes (Rule): # 15..39 " public virtual override" | ||
- PublicKeyword (Token): "public" # 16..22 | ||
- VirtualKeyword (Token): "virtual" # 23..30 | ||
- OverrideSpecifier (Rule): # 30..39 " override" | ||
- OverrideKeyword (Token): "override" # 31..39 | ||
- ReturnsDeclaration (Rule): # 39..57 " returns (uint256)" | ||
- ReturnsKeyword (Token): "returns" # 40..47 | ||
- ParametersDeclaration (Rule): # 47..57 " (uint256)" | ||
- OpenParen (Token): "(" # 48..49 | ||
- Parameters (Rule): # 49..56 "uint256" | ||
- Parameter (Rule): # 49..56 "uint256" | ||
- TypeName (Rule): # 49..56 "uint256" | ||
- UintKeyword (Token): "uint256" # 49..56 | ||
- CloseParen (Token): ")" # 56..57 | ||
- Block (Rule): # 57..73 " {\n\treturn 1;\n}\n" | ||
- OpenBrace (Token): "{" # 58..59 | ||
- Statements (Rule): # 60..71 "\treturn 1;\n" | ||
- ReturnStatement (Rule): # 60..71 "\treturn 1;\n" | ||
- ReturnKeyword (Token): "return" # 61..67 | ||
- Expression (Rule): # 67..69 " 1" | ||
- DecimalNumberExpression (Rule): # 67..69 " 1" | ||
- DecimalLiteral (Token): "1" # 68..69 | ||
- Semicolon (Token): ";" # 69..70 | ||
- CloseBrace (Token): "}" # 71..72 |
3 changes: 3 additions & 0 deletions
3
crates/solidity/testing/snapshots/cst_output/FunctionDefinition/overridden/input.sol
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,3 @@ | ||
function some() public virtual override returns (uint256) { | ||
return 1; | ||
} |
28 changes: 28 additions & 0 deletions
28
...napshots/cst_output/ImportDirective/destructure_import_empty/generated/0.4.11-failure.yml
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,28 @@ | ||
# This file is generated automatically by infrastructure scripts. Please don't edit by hand. | ||
|
||
Source: > | ||
1 │ // Empty imports are not valid │ 0..30 | ||
2 │ import {} from "foo"; │ 31..52 | ||
Errors: # 1 total | ||
- > | ||
Error: Expected Identifier. | ||
╭─[crates/solidity/testing/snapshots/cst_output/ImportDirective/destructure_import_empty/input.sol:2:9] | ||
│ | ||
2 │ import {} from "foo"; | ||
│ │ | ||
│ ╰─ Error occurred here. | ||
───╯ | ||
Tree: | ||
- ImportDirective (Rule): # 0..53 '// Empty imports are not valid\nimport {} from "foo...' | ||
- LeadingTrivia (Rule): # 0..31 "// Empty imports are not valid\n" | ||
- SingleLineComment (Trivia): "// Empty imports are not valid" # 0..30 | ||
- ImportKeyword (Token): "import" # 31..37 | ||
- DeconstructionImport (Rule): # 37..51 ' {} from "foo"' | ||
- OpenBrace (Token): "{" # 38..39 | ||
- SKIPPED (Token): "" # 39..39 | ||
- CloseBrace (Token): "}" # 39..40 | ||
- FromKeyword (Token): "from" # 41..45 | ||
- AsciiStringLiteral (Token): '"foo"' # 46..51 | ||
- Semicolon (Token): ";" # 51..52 |
2 changes: 2 additions & 0 deletions
2
.../solidity/testing/snapshots/cst_output/ImportDirective/destructure_import_empty/input.sol
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,2 @@ | ||
// Empty imports are not valid | ||
import {} from "foo"; |
23 changes: 23 additions & 0 deletions
23
...ting/snapshots/cst_output/TupleDeconstructionStatement/empty/generated/0.4.11-success.yml
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 @@ | ||
# This file is generated automatically by infrastructure scripts. Please don't edit by hand. | ||
|
||
Source: > | ||
1 │ // TODO(#671): Tuple expressions can't be empty │ 0..47 | ||
2 │ () = (); │ 48..56 | ||
Errors: [] | ||
|
||
Tree: | ||
- TupleDeconstructionStatement (Rule): # 0..57 "// TODO(#671): Tuple expressions can't be empty\n()..." | ||
- LeadingTrivia (Rule): # 0..48 "// TODO(#671): Tuple expressions can't be empty\n" | ||
- SingleLineComment (Trivia): "// TODO(#671): Tuple expressions can't be empty" # 0..47 | ||
- OpenParen (Token): "(" # 48..49 | ||
- TupleMembers (Rule): # 49..49 | ||
- TupleMember (Rule): [] # 49..49 | ||
- CloseParen (Token): ")" # 49..50 | ||
- Equal (Token): "=" # 51..52 | ||
- Expression (Rule): # 52..55 " ()" | ||
- TupleExpression (Rule): # 52..55 " ()" | ||
- OpenParen (Token): "(" # 53..54 | ||
- TupleValues (Rule): [] # 54..54 | ||
- CloseParen (Token): ")" # 54..55 | ||
- Semicolon (Token): ";" # 55..56 |
2 changes: 2 additions & 0 deletions
2
crates/solidity/testing/snapshots/cst_output/TupleDeconstructionStatement/empty/input.sol
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,2 @@ | ||
// TODO(#671): Tuple expressions can't be empty | ||
() = (); |
23 changes: 23 additions & 0 deletions
23
...esting/snapshots/cst_output/UsingDirective/destructure_empty/generated/0.4.11-failure.yml
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 @@ | ||
# This file is generated automatically by infrastructure scripts. Please don't edit by hand. | ||
|
||
Source: > | ||
1 │ // Empty using symbols list is not valid │ 0..40 | ||
2 │ using {} for *; │ 41..56 | ||
Errors: # 1 total | ||
- > | ||
Error: Expected Identifier. | ||
╭─[crates/solidity/testing/snapshots/cst_output/UsingDirective/destructure_empty/input.sol:2:7] | ||
│ | ||
2 │ using {} for *; | ||
│ ────┬─── | ||
│ ╰───── Error occurred here. | ||
───╯ | ||
Tree: | ||
- UsingDirective (Rule): # 0..57 "// Empty using symbols list is not valid\nusing {} ..." | ||
- LeadingTrivia (Rule): # 0..41 "// Empty using symbols list is not valid\n" | ||
- SingleLineComment (Trivia): "// Empty using symbols list is not valid" # 0..40 | ||
- UsingKeyword (Token): "using" # 41..46 | ||
- SKIPPED (Token): "{} for *" # 47..55 | ||
- Semicolon (Token): ";" # 55..56 |
28 changes: 28 additions & 0 deletions
28
...esting/snapshots/cst_output/UsingDirective/destructure_empty/generated/0.8.13-failure.yml
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,28 @@ | ||
# This file is generated automatically by infrastructure scripts. Please don't edit by hand. | ||
|
||
Source: > | ||
1 │ // Empty using symbols list is not valid │ 0..40 | ||
2 │ using {} for *; │ 41..56 | ||
Errors: # 1 total | ||
- > | ||
Error: Expected Identifier. | ||
╭─[crates/solidity/testing/snapshots/cst_output/UsingDirective/destructure_empty/input.sol:2:8] | ||
│ | ||
2 │ using {} for *; | ||
│ │ | ||
│ ╰─ Error occurred here. | ||
───╯ | ||
Tree: | ||
- UsingDirective (Rule): # 0..57 "// Empty using symbols list is not valid\nusing {} ..." | ||
- LeadingTrivia (Rule): # 0..41 "// Empty using symbols list is not valid\n" | ||
- SingleLineComment (Trivia): "// Empty using symbols list is not valid" # 0..40 | ||
- UsingKeyword (Token): "using" # 41..46 | ||
- UsingDirectiveDeconstruction (Rule): # 46..49 " {}" | ||
- OpenBrace (Token): "{" # 47..48 | ||
- SKIPPED (Token): "" # 48..48 | ||
- CloseBrace (Token): "}" # 48..49 | ||
- ForKeyword (Token): "for" # 50..53 | ||
- Asterisk (Token): "*" # 54..55 | ||
- Semicolon (Token): ";" # 55..56 |
2 changes: 2 additions & 0 deletions
2
crates/solidity/testing/snapshots/cst_output/UsingDirective/destructure_empty/input.sol
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,2 @@ | ||
// Empty using symbols list is not valid | ||
using {} for *; |
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