Skip to content

Commit f43cd56

Browse files
committed
Fix generic_arg not parsing opt_generic_arg_list properly in arg lists
1 parent d571ca8 commit f43cd56

File tree

3 files changed

+81
-67
lines changed

3 files changed

+81
-67
lines changed

crates/parser/src/grammar/type_args.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,13 @@ fn generic_arg(p: &mut Parser) {
6565
m.complete(p, LIFETIME_ARG);
6666
}
6767
// test associated_type_bounds
68-
// fn print_all<T: Iterator<Item, Item::Item, Item: Display, Item<'a> = Item>>(printables: T) {}
68+
// fn print_all<T: Iterator<Item, Item::Item, Item::<true>, Item: Display, Item<'a> = Item>>(printables: T) {}
6969
IDENT if [T![<], T![=], T![:]].contains(&p.nth(1)) => {
7070
let path_ty = p.start();
7171
let path = p.start();
7272
let path_seg = p.start();
7373
name_ref(p);
74-
if p.current() == T![<] {
75-
opt_generic_arg_list(p, false);
76-
}
74+
opt_generic_arg_list(p, false);
7775
match p.current() {
7876
// NameRef<...> =
7977
T![=] => {
@@ -89,6 +87,7 @@ fn generic_arg(p: &mut Parser) {
8987
// NameRef::, this is a path type
9088
path_seg.complete(p, PATH_SEGMENT);
9189
let qual = path.complete(p, PATH);
90+
opt_generic_arg_list(p, false);
9291
paths::type_path_for_qualifier(p, qual);
9392
path_ty.complete(p, PATH_TYPE);
9493
m.complete(p, TYPE_ARG);
Lines changed: 77 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
SOURCE_FILE@0..94
2-
FN@0..93
1+
SOURCE_FILE@0..108
2+
FN@0..107
33
44
55
66
[email protected] "print_all"
7-
GENERIC_PARAM_LIST@12..75
7+
GENERIC_PARAM_LIST@12..89
88
9-
TYPE_PARAM@13..74
9+
TYPE_PARAM@13..88
1010
1111
1212
1313
14-
TYPE_BOUND_LIST@16..74
15-
TYPE_BOUND@16..74
16-
PATH_TYPE@16..74
17-
PATH@16..74
18-
PATH_SEGMENT@16..74
14+
TYPE_BOUND_LIST@16..88
15+
TYPE_BOUND@16..88
16+
PATH_TYPE@16..88
17+
PATH@16..88
18+
PATH_SEGMENT@16..88
1919
2020
[email protected] "Iterator"
21-
GENERIC_ARG_LIST@24..74
21+
GENERIC_ARG_LIST@24..88
2222
2323
2424
@@ -41,55 +41,70 @@ [email protected]
4141
4242
4343
44-
45-
46-
47-
48-
49-
50-
51-
52-
53-
54-
55-
56-
57-
58-
59-
60-
61-
62-
63-
64-
65-
66-
67-
68-
69-
70-
71-
72-
73-
74-
75-
76-
77-
78-
79-
80-
81-
82-
[email protected] "printables"
83-
84-
85-
86-
87-
88-
89-
90-
91-
92-
93-
94-
95-
44+
45+
46+
47+
48+
49+
50+
51+
52+
53+
54+
55+
56+
57+
58+
59+
60+
61+
62+
63+
64+
65+
66+
67+
68+
69+
70+
71+
72+
73+
74+
75+
76+
77+
78+
79+
80+
81+
82+
83+
84+
85+
86+
87+
88+
89+
90+
91+
92+
93+
94+
95+
96+
97+
[email protected] "printables"
98+
99+
100+
101+
102+
103+
104+
105+
106+
107+
108+
109+
110+
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
fn print_all<T: Iterator<Item, Item::Item, Item: Display, Item<'a> = Item>>(printables: T) {}
1+
fn print_all<T: Iterator<Item, Item::Item, Item::<true>, Item: Display, Item<'a> = Item>>(printables: T) {}

0 commit comments

Comments
 (0)