aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/parser/src/grammar.rs6
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0153_pub_parens_typepath.rast54
-rw-r--r--crates/syntax/test_data/parser/inline/ok/0153_pub_parens_typepath.rs2
3 files changed, 61 insertions, 1 deletions
diff --git a/crates/parser/src/grammar.rs b/crates/parser/src/grammar.rs
index 562e92252..4ab206a83 100644
--- a/crates/parser/src/grammar.rs
+++ b/crates/parser/src/grammar.rs
@@ -184,7 +184,11 @@ fn opt_visibility(p: &mut Parser) -> bool {
184 // pub(self) struct S; 184 // pub(self) struct S;
185 // pub(self) struct S; 185 // pub(self) struct S;
186 // pub(self) struct S; 186 // pub(self) struct S;
187 T![crate] | T![self] | T![super] => { 187
188 // test pub_parens_typepath
189 // struct B(pub (super::A));
190 // struct B(pub (crate::A,));
191 T![crate] | T![self] | T![super] if p.nth(2) != T![:] => {
188 p.bump_any(); 192 p.bump_any();
189 p.bump_any(); 193 p.bump_any();
190 p.expect(T![')']); 194 p.expect(T![')']);
diff --git a/crates/syntax/test_data/parser/inline/ok/0153_pub_parens_typepath.rast b/crates/syntax/test_data/parser/inline/ok/0153_pub_parens_typepath.rast
new file mode 100644
index 000000000..c204f0e2d
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0153_pub_parens_typepath.rast
@@ -0,0 +1,54 @@
1[email protected]
2 [email protected]
3 [email protected] "struct"
4 [email protected] " "
5 [email protected]
6 [email protected] "B"
7 [email protected]
8 [email protected] "("
9 [email protected]
10 [email protected]
11 [email protected] "pub"
12 [email protected] " "
13 [email protected]
14 [email protected] "("
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected]
19 [email protected] "super"
20 [email protected] "::"
21 [email protected]
22 [email protected]
23 [email protected] "A"
24 [email protected] ")"
25 [email protected] ")"
26 [email protected] ";"
27 [email protected] "\n"
28 [email protected]
29 [email protected] "struct"
30 [email protected] " "
31 [email protected]
32 [email protected] "B"
33 [email protected]
34 [email protected] "("
35 [email protected]
36 [email protected]
37 [email protected] "pub"
38 [email protected] " "
39 [email protected]
40 [email protected] "("
41 [email protected]
42 [email protected]
43 [email protected]
44 [email protected]
45 [email protected] "crate"
46 [email protected] "::"
47 [email protected]
48 [email protected]
49 [email protected] "A"
50 [email protected] ","
51 [email protected] ")"
52 [email protected] ")"
53 [email protected] ";"
54 [email protected] "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0153_pub_parens_typepath.rs b/crates/syntax/test_data/parser/inline/ok/0153_pub_parens_typepath.rs
new file mode 100644
index 000000000..d4c163822
--- /dev/null
+++ b/crates/syntax/test_data/parser/inline/ok/0153_pub_parens_typepath.rs
@@ -0,0 +1,2 @@
1struct B(pub (super::A));
2struct B(pub (crate::A,));