-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
597 additions
and
0 deletions.
There are no files selected for viewing
66 changes: 66 additions & 0 deletions
66
crates/parser/test_data/parser/err/0056_let_else_right_curly_brace_struct.rast
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,66 @@ | ||
SOURCE_FILE | ||
STRUCT | ||
STRUCT_KW "struct" | ||
WHITESPACE " " | ||
NAME | ||
IDENT "X" | ||
WHITESPACE " " | ||
RECORD_FIELD_LIST | ||
L_CURLY "{" | ||
RECORD_FIELD | ||
NAME | ||
IDENT "a" | ||
COLON ":" | ||
WHITESPACE " " | ||
PATH_TYPE | ||
PATH | ||
PATH_SEGMENT | ||
NAME_REF | ||
IDENT "i32" | ||
R_CURLY "}" | ||
WHITESPACE "\r\n" | ||
ERROR | ||
LET_KW "let" | ||
WHITESPACE " " | ||
IDENT_PAT | ||
NAME | ||
IDENT "foo" | ||
WHITESPACE " " | ||
EQ "=" | ||
WHITESPACE " " | ||
RECORD_EXPR | ||
PATH | ||
PATH_SEGMENT | ||
NAME_REF | ||
IDENT "X" | ||
WHITESPACE " " | ||
RECORD_EXPR_FIELD_LIST | ||
L_CURLY "{" | ||
WHITESPACE "\r\n " | ||
RECORD_EXPR_FIELD | ||
NAME_REF | ||
IDENT "a" | ||
COLON ":" | ||
WHITESPACE " " | ||
LITERAL | ||
INT_NUMBER "1" | ||
WHITESPACE "\r\n" | ||
R_CURLY "}" | ||
WHITESPACE " " | ||
LET_ELSE | ||
ELSE_KW "else" | ||
WHITESPACE " " | ||
BLOCK_EXPR | ||
STMT_LIST | ||
L_CURLY "{" | ||
WHITESPACE "\r\n " | ||
EXPR_STMT | ||
RETURN_EXPR | ||
RETURN_KW "return" | ||
SEMICOLON ";" | ||
WHITESPACE "\r\n" | ||
R_CURLY "}" | ||
SEMICOLON ";" | ||
WHITESPACE "\r\n" | ||
error 19: expected an item | ||
error 45: right curly brace `}` before `else` in a `let...else` statement not allowed |
6 changes: 6 additions & 0 deletions
6
crates/parser/test_data/parser/err/0056_let_else_right_curly_brace_struct.rs
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,6 @@ | ||
struct X {a: i32} | ||
let foo = X { | ||
a: 1 | ||
} else { | ||
return; | ||
}; |
42 changes: 42 additions & 0 deletions
42
crates/parser/test_data/parser/err/0057_let_else_right_curly_brace_arithmetic.rast
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 @@ | ||
SOURCE_FILE | ||
ERROR | ||
LET_KW "let" | ||
WHITESPACE " " | ||
IDENT_PAT | ||
NAME | ||
IDENT "foo" | ||
WHITESPACE " " | ||
EQ "=" | ||
WHITESPACE " " | ||
BIN_EXPR | ||
LITERAL | ||
INT_NUMBER "1" | ||
WHITESPACE " " | ||
PLUS "+" | ||
WHITESPACE " " | ||
BLOCK_EXPR | ||
STMT_LIST | ||
L_CURLY "{" | ||
WHITESPACE "\r\n " | ||
LITERAL | ||
INT_NUMBER "1" | ||
WHITESPACE "\r\n" | ||
R_CURLY "}" | ||
WHITESPACE " " | ||
LET_ELSE | ||
ELSE_KW "else" | ||
WHITESPACE " " | ||
BLOCK_EXPR | ||
STMT_LIST | ||
L_CURLY "{" | ||
WHITESPACE "\r\n " | ||
EXPR_STMT | ||
RETURN_EXPR | ||
RETURN_KW "return" | ||
SEMICOLON ";" | ||
WHITESPACE "\r\n" | ||
R_CURLY "}" | ||
SEMICOLON ";" | ||
WHITESPACE "\r\n" | ||
error 0: expected an item | ||
error 25: right curly brace `}` before `else` in a `let...else` statement not allowed |
5 changes: 5 additions & 0 deletions
5
crates/parser/test_data/parser/err/0057_let_else_right_curly_brace_arithmetic.rs
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,5 @@ | ||
let foo = 1 + { | ||
1 | ||
} else { | ||
return; | ||
}; |
90 changes: 90 additions & 0 deletions
90
crates/parser/test_data/parser/err/0057_let_else_right_curly_brace_format_args.rast
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,90 @@ | ||
SOURCE_FILE | ||
FN | ||
FN_KW "fn" | ||
WHITESPACE " " | ||
NAME | ||
IDENT "r" | ||
PARAM_LIST | ||
L_PAREN "(" | ||
R_PAREN ")" | ||
WHITESPACE " " | ||
BLOCK_EXPR | ||
STMT_LIST | ||
L_CURLY "{" | ||
WHITESPACE "\r\n " | ||
LET_STMT | ||
LET_KW "let" | ||
WHITESPACE " " | ||
IDENT_PAT | ||
NAME | ||
IDENT "ok" | ||
WHITESPACE " " | ||
EQ "=" | ||
WHITESPACE " " | ||
MACRO_EXPR | ||
MACRO_CALL | ||
PATH | ||
PATH_SEGMENT | ||
NAME_REF | ||
IDENT "format_args" | ||
BANG "!" | ||
TOKEN_TREE | ||
L_PAREN "(" | ||
STRING "\"\"" | ||
R_PAREN ")" | ||
WHITESPACE " " | ||
LET_ELSE | ||
ELSE_KW "else" | ||
WHITESPACE " " | ||
BLOCK_EXPR | ||
STMT_LIST | ||
L_CURLY "{" | ||
WHITESPACE " " | ||
EXPR_STMT | ||
RETURN_EXPR | ||
RETURN_KW "return" | ||
SEMICOLON ";" | ||
WHITESPACE " " | ||
R_CURLY "}" | ||
SEMICOLON ";" | ||
WHITESPACE "\r\n\r\n " | ||
LET_STMT | ||
LET_KW "let" | ||
WHITESPACE " " | ||
IDENT_PAT | ||
NAME | ||
IDENT "bad" | ||
WHITESPACE " " | ||
EQ "=" | ||
WHITESPACE " " | ||
MACRO_EXPR | ||
MACRO_CALL | ||
PATH | ||
PATH_SEGMENT | ||
NAME_REF | ||
IDENT "format_args" | ||
BANG "!" | ||
WHITESPACE " " | ||
TOKEN_TREE | ||
L_CURLY "{" | ||
STRING "\"\"" | ||
R_CURLY "}" | ||
WHITESPACE " " | ||
LET_ELSE | ||
ELSE_KW "else" | ||
WHITESPACE " " | ||
BLOCK_EXPR | ||
STMT_LIST | ||
L_CURLY "{" | ||
WHITESPACE " " | ||
EXPR_STMT | ||
RETURN_EXPR | ||
RETURN_KW "return" | ||
SEMICOLON ";" | ||
WHITESPACE " " | ||
R_CURLY "}" | ||
SEMICOLON ";" | ||
WHITESPACE "\r\n" | ||
R_CURLY "}" | ||
WHITESPACE "\r\n" | ||
error 92: right curly brace `}` before `else` in a `let...else` statement not allowed |
5 changes: 5 additions & 0 deletions
5
crates/parser/test_data/parser/err/0057_let_else_right_curly_brace_format_args.rs
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,5 @@ | ||
fn r() { | ||
let ok = format_args!("") else { return; }; | ||
|
||
let bad = format_args! {""} else { return; }; | ||
} |
40 changes: 40 additions & 0 deletions
40
crates/parser/test_data/parser/err/0058_let_else_right_curly_brace_range.rast
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 @@ | ||
SOURCE_FILE | ||
ERROR | ||
LET_KW "let" | ||
WHITESPACE " " | ||
IDENT_PAT | ||
NAME | ||
IDENT "foo" | ||
WHITESPACE " " | ||
EQ "=" | ||
WHITESPACE " " | ||
RANGE_EXPR | ||
LITERAL | ||
INT_NUMBER "1" | ||
DOT2 ".." | ||
BLOCK_EXPR | ||
STMT_LIST | ||
L_CURLY "{" | ||
WHITESPACE "\r\n " | ||
LITERAL | ||
INT_NUMBER "1" | ||
WHITESPACE "\r\n" | ||
R_CURLY "}" | ||
WHITESPACE " " | ||
LET_ELSE | ||
ELSE_KW "else" | ||
WHITESPACE " " | ||
BLOCK_EXPR | ||
STMT_LIST | ||
L_CURLY "{" | ||
WHITESPACE "\r\n " | ||
EXPR_STMT | ||
RETURN_EXPR | ||
RETURN_KW "return" | ||
SEMICOLON ";" | ||
WHITESPACE "\r\n" | ||
R_CURLY "}" | ||
SEMICOLON ";" | ||
WHITESPACE "\r\n" | ||
error 0: expected an item | ||
error 24: right curly brace `}` before `else` in a `let...else` statement not allowed |
5 changes: 5 additions & 0 deletions
5
crates/parser/test_data/parser/err/0058_let_else_right_curly_brace_range.rs
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,5 @@ | ||
let foo = 1..{ | ||
1 | ||
} else { | ||
return; | ||
}; |
55 changes: 55 additions & 0 deletions
55
crates/parser/test_data/parser/err/0059_let_else_right_curly_brace_closure.rast
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,55 @@ | ||
SOURCE_FILE | ||
ERROR | ||
LET_KW "let" | ||
WHITESPACE " " | ||
IDENT_PAT | ||
NAME | ||
IDENT "foo" | ||
WHITESPACE " " | ||
EQ "=" | ||
WHITESPACE " " | ||
CLOSURE_EXPR | ||
PARAM_LIST | ||
PIPE "|" | ||
PARAM | ||
IDENT_PAT | ||
NAME | ||
IDENT "x" | ||
COLON ":" | ||
WHITESPACE " " | ||
PATH_TYPE | ||
PATH | ||
PATH_SEGMENT | ||
NAME_REF | ||
IDENT "i32" | ||
PIPE "|" | ||
WHITESPACE " " | ||
BLOCK_EXPR | ||
STMT_LIST | ||
L_CURLY "{" | ||
WHITESPACE "\r\n " | ||
PATH_EXPR | ||
PATH | ||
PATH_SEGMENT | ||
NAME_REF | ||
IDENT "x" | ||
WHITESPACE "\r\n" | ||
R_CURLY "}" | ||
WHITESPACE " " | ||
LET_ELSE | ||
ELSE_KW "else" | ||
WHITESPACE " " | ||
BLOCK_EXPR | ||
STMT_LIST | ||
L_CURLY "{" | ||
WHITESPACE "\r\n " | ||
EXPR_STMT | ||
RETURN_EXPR | ||
RETURN_KW "return" | ||
SEMICOLON ";" | ||
WHITESPACE "\r\n" | ||
R_CURLY "}" | ||
SEMICOLON ";" | ||
WHITESPACE "\r\n" | ||
error 0: expected an item | ||
error 30: right curly brace `}` before `else` in a `let...else` statement not allowed |
5 changes: 5 additions & 0 deletions
5
crates/parser/test_data/parser/err/0059_let_else_right_curly_brace_closure.rs
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,5 @@ | ||
let foo = |x: i32| { | ||
x | ||
} else { | ||
return; | ||
}; |
38 changes: 38 additions & 0 deletions
38
crates/parser/test_data/parser/err/0060_let_else_right_curly_brace_unary.rast
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,38 @@ | ||
SOURCE_FILE | ||
ERROR | ||
LET_KW "let" | ||
WHITESPACE " " | ||
IDENT_PAT | ||
NAME | ||
IDENT "foo" | ||
WHITESPACE " " | ||
EQ "=" | ||
WHITESPACE " " | ||
PREFIX_EXPR | ||
MINUS "-" | ||
BLOCK_EXPR | ||
STMT_LIST | ||
L_CURLY "{" | ||
WHITESPACE "\r\n " | ||
LITERAL | ||
INT_NUMBER "1" | ||
WHITESPACE "\r\n" | ||
R_CURLY "}" | ||
WHITESPACE " " | ||
LET_ELSE | ||
ELSE_KW "else" | ||
WHITESPACE " " | ||
BLOCK_EXPR | ||
STMT_LIST | ||
L_CURLY "{" | ||
WHITESPACE "\r\n " | ||
EXPR_STMT | ||
RETURN_EXPR | ||
RETURN_KW "return" | ||
SEMICOLON ";" | ||
WHITESPACE "\r\n" | ||
R_CURLY "}" | ||
SEMICOLON ";" | ||
WHITESPACE "\r\n" | ||
error 0: expected an item | ||
error 22: right curly brace `}` before `else` in a `let...else` statement not allowed |
5 changes: 5 additions & 0 deletions
5
crates/parser/test_data/parser/err/0060_let_else_right_curly_brace_unary.rs
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,5 @@ | ||
let foo = -{ | ||
1 | ||
} else { | ||
return; | ||
}; |
Oops, something went wrong.