-
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.
Auto merge of #16553 - Veykril:field-lit-recovery, r=Veykril
fix: Imrpove recover on `=` for record field initializer and pattern
- Loading branch information
Showing
7 changed files
with
137 additions
and
27 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
41 changes: 41 additions & 0 deletions
41
crates/parser/test_data/parser/inline/err/0032_record_literal_field_eq_recovery.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,41 @@ | ||
SOURCE_FILE | ||
FN | ||
FN_KW "fn" | ||
WHITESPACE " " | ||
NAME | ||
IDENT "main" | ||
PARAM_LIST | ||
L_PAREN "(" | ||
R_PAREN ")" | ||
WHITESPACE " " | ||
BLOCK_EXPR | ||
STMT_LIST | ||
L_CURLY "{" | ||
WHITESPACE "\n " | ||
RECORD_EXPR | ||
PATH | ||
PATH_SEGMENT | ||
NAME_REF | ||
IDENT "S" | ||
WHITESPACE " " | ||
RECORD_EXPR_FIELD_LIST | ||
L_CURLY "{" | ||
WHITESPACE " " | ||
RECORD_EXPR_FIELD | ||
NAME_REF | ||
IDENT "field" | ||
WHITESPACE " " | ||
ERROR | ||
EQ "=" | ||
WHITESPACE " " | ||
PATH_EXPR | ||
PATH | ||
PATH_SEGMENT | ||
NAME_REF | ||
IDENT "foo" | ||
WHITESPACE " " | ||
R_CURLY "}" | ||
WHITESPACE "\n" | ||
R_CURLY "}" | ||
WHITESPACE "\n" | ||
error 26: expected `:` |
3 changes: 3 additions & 0 deletions
3
crates/parser/test_data/parser/inline/err/0032_record_literal_field_eq_recovery.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,3 @@ | ||
fn main() { | ||
S { field = foo } | ||
} |
43 changes: 43 additions & 0 deletions
43
crates/parser/test_data/parser/inline/err/0033_record_pat_field_eq_recovery.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,43 @@ | ||
SOURCE_FILE | ||
FN | ||
FN_KW "fn" | ||
WHITESPACE " " | ||
NAME | ||
IDENT "main" | ||
PARAM_LIST | ||
L_PAREN "(" | ||
R_PAREN ")" | ||
WHITESPACE " " | ||
BLOCK_EXPR | ||
STMT_LIST | ||
L_CURLY "{" | ||
WHITESPACE "\n " | ||
LET_STMT | ||
LET_KW "let" | ||
WHITESPACE " " | ||
RECORD_PAT | ||
PATH | ||
PATH_SEGMENT | ||
NAME_REF | ||
IDENT "S" | ||
WHITESPACE " " | ||
RECORD_PAT_FIELD_LIST | ||
L_CURLY "{" | ||
WHITESPACE " " | ||
RECORD_PAT_FIELD | ||
NAME_REF | ||
IDENT "field" | ||
WHITESPACE " " | ||
ERROR | ||
EQ "=" | ||
WHITESPACE " " | ||
IDENT_PAT | ||
NAME | ||
IDENT "foo" | ||
WHITESPACE " " | ||
R_CURLY "}" | ||
SEMICOLON ";" | ||
WHITESPACE "\n" | ||
R_CURLY "}" | ||
WHITESPACE "\n" | ||
error 30: expected `:` |
3 changes: 3 additions & 0 deletions
3
crates/parser/test_data/parser/inline/err/0033_record_pat_field_eq_recovery.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,3 @@ | ||
fn main() { | ||
let S { field = foo }; | ||
} |