Skip to content

Commit

Permalink
fix: move use parsing to outer match arm
Browse files Browse the repository at this point in the history
  • Loading branch information
winstxnhdw committed Jul 23, 2024
1 parent 7815a49 commit 0cee49d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
12 changes: 6 additions & 6 deletions crates/parser/src/grammar/generic_params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,12 @@ fn type_bound(p: &mut Parser<'_>) -> bool {
match p.current() {
LIFETIME_IDENT => lifetime(p),
T![for] => types::for_type(p, false),
// test precise_capturing
// fn captures<'a: 'a, 'b: 'b, T>() -> impl Sized + use<'b, T> {}
T![use] => {
p.bump_any();
generic_param_list(p)
}
T![?] if p.nth_at(1, T![for]) => {
// test question_for_type_trait_bound
// fn f<T>() where T: ?for<> Sized {}
Expand All @@ -167,12 +173,6 @@ fn type_bound(p: &mut Parser<'_>) -> bool {
T![async] => {
p.bump_any();
}
// test precise_capturing
// fn captures<'a: 'a, 'b: 'b, T>() -> impl Sized + use<'b, T> {}
T![use] => {
p.bump_any();
generic_param_list(p);
}
_ => (),
}
if paths::is_use_path_start(p) {
Expand Down
25 changes: 13 additions & 12 deletions crates/parser/test_data/parser/inline/ok/precise_capturing.rast
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,19 @@ SOURCE_FILE
WHITESPACE " "
PLUS "+"
WHITESPACE " "
USE_KW "use"
GENERIC_PARAM_LIST
L_ANGLE "<"
LIFETIME_PARAM
LIFETIME
LIFETIME_IDENT "'b"
COMMA ","
WHITESPACE " "
TYPE_PARAM
NAME
IDENT "T"
R_ANGLE ">"
TYPE_BOUND
USE_KW "use"
GENERIC_PARAM_LIST
L_ANGLE "<"
LIFETIME_PARAM
LIFETIME
LIFETIME_IDENT "'b"
COMMA ","
WHITESPACE " "
TYPE_PARAM
NAME
IDENT "T"
R_ANGLE ">"
WHITESPACE " "
BLOCK_EXPR
STMT_LIST
Expand Down

0 comments on commit 0cee49d

Please sign in to comment.