aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/test_data/parser/err/0041_illegal_super_keyword_location.rast
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-05-01 20:24:25 +0100
committerGitHub <[email protected]>2020-05-01 20:24:25 +0100
commit21588e15dfa8b117b503769119320e718bade351 (patch)
treec10be6c66f2d6220d98c316c44bb3f9677ad1a1d /crates/ra_syntax/test_data/parser/err/0041_illegal_super_keyword_location.rast
parent302777f0041540bf6790fde2acc3bb5b04e72427 (diff)
parent3bb46042fb5b8ee421e350c54079cb68b4edc996 (diff)
Merge #4246
4246: Validate uses of self and super r=matklad a=djrenren This change follows on the validation of the `crate` keyword in paths. It verifies the following things: `super`: - May only be preceded by other `super` segments - If in a `UseItem` then all semantically preceding paths also consist only of `super` `self` - May only be the start of a path Just a note, a couple times while working on this I found myself really wanting a Visitor of some sort so that I could traverse descendants while skipping sub-trees that are unimportant. Iterators don't really work for this, so as you can see I reached for recursion. Considering paths are generally small a fancy debounced visitor probably isn't important but figured I'd say something in case we had something like this lying around and I wasn't using it. Co-authored-by: John Renner <[email protected]>
Diffstat (limited to 'crates/ra_syntax/test_data/parser/err/0041_illegal_super_keyword_location.rast')
-rw-r--r--crates/ra_syntax/test_data/parser/err/0041_illegal_super_keyword_location.rast70
1 files changed, 70 insertions, 0 deletions
diff --git a/crates/ra_syntax/test_data/parser/err/0041_illegal_super_keyword_location.rast b/crates/ra_syntax/test_data/parser/err/0041_illegal_super_keyword_location.rast
new file mode 100644
index 000000000..d0360c467
--- /dev/null
+++ b/crates/ra_syntax/test_data/parser/err/0041_illegal_super_keyword_location.rast
@@ -0,0 +1,70 @@
1[email protected]
2 [email protected]
3 [email protected] "use"
4 [email protected] " "
5 [email protected]
6 [email protected]
7 [email protected]
8 [email protected] "::"
9 [email protected] "super"
10 [email protected] ";"
11 [email protected] "\n"
12 [email protected]
13 [email protected] "use"
14 [email protected] " "
15 [email protected]
16 [email protected]
17 [email protected]
18 [email protected]
19 [email protected]
20 [email protected] "a"
21 [email protected] "::"
22 [email protected]
23 [email protected] "super"
24 [email protected] ";"
25 [email protected] "\n"
26 [email protected]
27 [email protected] "use"
28 [email protected] " "
29 [email protected]
30 [email protected]
31 [email protected]
32 [email protected]
33 [email protected]
34 [email protected] "super"
35 [email protected] "::"
36 [email protected]
37 [email protected]
38 [email protected] "a"
39 [email protected] "::"
40 [email protected]
41 [email protected] "super"
42 [email protected] ";"
43 [email protected] "\n"
44 [email protected]
45 [email protected] "use"
46 [email protected] " "
47 [email protected]
48 [email protected]
49 [email protected]
50 [email protected]
51 [email protected] "a"
52 [email protected] "::"
53 [email protected]
54 [email protected] "{"
55 [email protected]
56 [email protected]
57 [email protected]
58 [email protected]
59 [email protected] "super"
60 [email protected] "::"
61 [email protected]
62 [email protected]
63 [email protected] "b"
64 [email protected] "}"
65 [email protected] ";"
66 [email protected] "\n"
67error 6..11: The `super` keyword may only be preceded by other `super`s
68error 20..25: The `super` keyword may only be preceded by other `super`s
69error 41..46: The `super` keyword may only be preceded by other `super`s
70error 56..61: The `super` keyword may only be preceded by other `super`s