forked from NomicFoundation/slang
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: Add a try expr with call options
This needs a lookahead of two tokens (ident, colon) to disambiguate between the try block and the call options.
- Loading branch information
Showing
5 changed files
with
138 additions
and
0 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
crates/solidity/outputs/cargo/tests/src/cst_output/generated/try_statement.rs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
...ting/snapshots/cst_output/TryStatement/try_expr_call_options/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,22 @@ | ||
# This file is generated automatically by infrastructure scripts. Please don't edit by hand. | ||
|
||
Source: > | ||
1 │ try foo() { x: 1 } { │ 0..20 | ||
2 │ bar(); │ 21..29 | ||
3 │ } catch { │ 30..39 | ||
4 │ } │ 40..41 | ||
Errors: # 1 total | ||
- > | ||
Error: Expected end of file. | ||
╭─[crates/solidity/testing/snapshots/cst_output/TryStatement/try_expr_call_options/input.sol:1:1] | ||
│ | ||
1 │ ╭─▶ try foo() { x: 1 } { | ||
┆ ┆ | ||
4 │ ├─▶ } | ||
│ │ | ||
│ ╰─────── Error occurred here. | ||
───╯ | ||
Tree: | ||
- (SKIPPED): "try foo() { x: 1 } {\n bar();\n} catch {\n}\n" # (0..42) |
48 changes: 48 additions & 0 deletions
48
...sting/snapshots/cst_output/TryStatement/try_expr_call_options/generated/0.6.0-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,48 @@ | ||
# This file is generated automatically by infrastructure scripts. Please don't edit by hand. | ||
|
||
Source: > | ||
1 │ try foo() { x: 1 } { │ 0..20 | ||
2 │ bar(); │ 21..29 | ||
3 │ } catch { │ 30..39 | ||
4 │ } │ 40..41 | ||
Errors: # 2 total | ||
- > | ||
Error: Expected Ampersand or AmpersandAmpersand or AmpersandEqual or Asterisk or AsteriskAsterisk or AsteriskEqual or BangEqual or Bar or BarBar or BarEqual or Caret or CaretEqual or Equal or EqualEqual or GreaterThan or GreaterThanEqual or GreaterThanGreaterThan or GreaterThanGreaterThanEqual or GreaterThanGreaterThanGreaterThan or GreaterThanGreaterThanGreaterThanEqual or LessThan or LessThanEqual or LessThanLessThan or LessThanLessThanEqual or Minus or MinusEqual or Percent or PercentEqual or Plus or PlusEqual or Semicolon or Slash or SlashEqual. | ||
╭─[crates/solidity/testing/snapshots/cst_output/TryStatement/try_expr_call_options/input.sol:1:14] | ||
│ | ||
1 │ try foo() { x: 1 } { | ||
│ ──┬─ | ||
│ ╰─── Error occurred here. | ||
───╯ | ||
- > | ||
Error: Expected CatchKeyword. | ||
╭─[crates/solidity/testing/snapshots/cst_output/TryStatement/try_expr_call_options/input.sol:1:19] | ||
│ | ||
1 │ ╭─▶ try foo() { x: 1 } { | ||
┆ ┆ | ||
4 │ ├─▶ } | ||
│ │ | ||
│ ╰─────── Error occurred here. | ||
───╯ | ||
Tree: | ||
- (TryStatement): # "try foo() { x: 1 } {\n bar();\n} catch {\n}\n" (0..42) | ||
- (try_keyword꞉ TryKeyword): "try" # (0..3) | ||
- (expression꞉ Expression) ► (variant꞉ FunctionCallExpression): # " foo()" (3..9) | ||
- (operand꞉ Expression): # " foo" (3..7) | ||
- (LeadingTrivia) ► (Whitespace): " " # (3..4) | ||
- (variant꞉ Identifier): "foo" # (4..7) | ||
- (arguments꞉ ArgumentsDeclaration) ► (variant꞉ PositionalArgumentsDeclaration): # "()" (7..9) | ||
- (open_paren꞉ OpenParen): "(" # (7..8) | ||
- (close_paren꞉ CloseParen): ")" # (8..9) | ||
- (body꞉ Block): # " { x: 1 }" (9..18) | ||
- (LeadingTrivia) ► (Whitespace): " " # (9..10) | ||
- (open_brace꞉ OpenBrace): "{" # (10..11) | ||
- (statements꞉ Statements): # " x" (11..13) | ||
- (item꞉ Statement) ► (variant꞉ ExpressionStatement) ► (expression꞉ Expression): # " x" (11..13) | ||
- (LeadingTrivia) ► (Whitespace): " " # (11..12) | ||
- (variant꞉ Identifier): "x" # (12..13) | ||
- (SKIPPED): ": 1 " # (13..17) | ||
- (close_brace꞉ CloseBrace): "}" # (17..18) | ||
- (SKIPPED): " {\n bar();\n} catch {\n}\n" # (18..42) |
59 changes: 59 additions & 0 deletions
59
...sting/snapshots/cst_output/TryStatement/try_expr_call_options/generated/0.6.2-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,59 @@ | ||
# This file is generated automatically by infrastructure scripts. Please don't edit by hand. | ||
|
||
Source: > | ||
1 │ try foo() { x: 1 } { │ 0..20 | ||
2 │ bar(); │ 21..29 | ||
3 │ } catch { │ 30..39 | ||
4 │ } │ 40..41 | ||
Errors: [] | ||
|
||
Tree: | ||
- (TryStatement): # "try foo() { x: 1 } {\n bar();\n} catch {\n}\n" (0..42) | ||
- (try_keyword꞉ TryKeyword): "try" # (0..3) | ||
- (expression꞉ Expression) ► (variant꞉ CallOptionsExpression): # " foo() { x: 1 }" (3..18) | ||
- (operand꞉ Expression) ► (variant꞉ FunctionCallExpression): # " foo()" (3..9) | ||
- (operand꞉ Expression): # " foo" (3..7) | ||
- (LeadingTrivia) ► (Whitespace): " " # (3..4) | ||
- (variant꞉ Identifier): "foo" # (4..7) | ||
- (arguments꞉ ArgumentsDeclaration) ► (variant꞉ PositionalArgumentsDeclaration): # "()" (7..9) | ||
- (open_paren꞉ OpenParen): "(" # (7..8) | ||
- (close_paren꞉ CloseParen): ")" # (8..9) | ||
- (LeadingTrivia) ► (Whitespace): " " # (9..10) | ||
- (open_brace꞉ OpenBrace): "{" # (10..11) | ||
- (arguments꞉ NamedArguments): # " x: 1" (11..16) | ||
- (item꞉ NamedArgument): # " x: 1" (11..16) | ||
- (LeadingTrivia) ► (Whitespace): " " # (11..12) | ||
- (name꞉ Identifier): "x" # (12..13) | ||
- (colon꞉ Colon): ":" # (13..14) | ||
- (value꞉ Expression) ► (variant꞉ DecimalNumberExpression): # " 1" (14..16) | ||
- (LeadingTrivia) ► (Whitespace): " " # (14..15) | ||
- (literal꞉ DecimalLiteral): "1" # (15..16) | ||
- (LeadingTrivia) ► (Whitespace): " " # (16..17) | ||
- (close_brace꞉ CloseBrace): "}" # (17..18) | ||
- (body꞉ Block): # " {\n bar();\n}" (18..31) | ||
- (LeadingTrivia) ► (Whitespace): " " # (18..19) | ||
- (open_brace꞉ OpenBrace): "{" # (19..20) | ||
- (TrailingTrivia) ► (EndOfLine): "\n" # (20..21) | ||
- (statements꞉ Statements): # " bar();\n" (21..30) | ||
- (item꞉ Statement) ► (variant꞉ ExpressionStatement): # " bar();\n" (21..30) | ||
- (expression꞉ Expression) ► (variant꞉ FunctionCallExpression): # " bar()" (21..28) | ||
- (operand꞉ Expression): # " bar" (21..26) | ||
- (LeadingTrivia) ► (Whitespace): " " # (21..23) | ||
- (variant꞉ Identifier): "bar" # (23..26) | ||
- (arguments꞉ ArgumentsDeclaration) ► (variant꞉ PositionalArgumentsDeclaration): # "()" (26..28) | ||
- (open_paren꞉ OpenParen): "(" # (26..27) | ||
- (close_paren꞉ CloseParen): ")" # (27..28) | ||
- (semicolon꞉ Semicolon): ";" # (28..29) | ||
- (TrailingTrivia) ► (EndOfLine): "\n" # (29..30) | ||
- (close_brace꞉ CloseBrace): "}" # (30..31) | ||
- (catch_clauses꞉ CatchClauses): # " catch {\n}\n" (31..42) | ||
- (item꞉ CatchClause): # " catch {\n}\n" (31..42) | ||
- (LeadingTrivia) ► (Whitespace): " " # (31..32) | ||
- (catch_keyword꞉ CatchKeyword): "catch" # (32..37) | ||
- (body꞉ Block): # " {\n}\n" (37..42) | ||
- (LeadingTrivia) ► (Whitespace): " " # (37..38) | ||
- (open_brace꞉ OpenBrace): "{" # (38..39) | ||
- (TrailingTrivia) ► (EndOfLine): "\n" # (39..40) | ||
- (close_brace꞉ CloseBrace): "}" # (40..41) | ||
- (TrailingTrivia) ► (EndOfLine): "\n" # (41..42) |
4 changes: 4 additions & 0 deletions
4
crates/solidity/testing/snapshots/cst_output/TryStatement/try_expr_call_options/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,4 @@ | ||
try foo() { x: 1 } { | ||
bar(); | ||
} catch { | ||
} |