diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-12-20 18:45:24 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-12-20 18:45:24 +0000 |
commit | 057c95d3dd72725f13bfef25827b9034f19ba877 (patch) | |
tree | 67f280325c9bf3310b8a85f5d35dad2f2030c8c6 /crates/ra_syntax/tests/data/parser/inline/err | |
parent | c626e4a52688bfc63b9d29ed89025b61e00d4326 (diff) | |
parent | 0ffba1e8965a75d2c07a053a0803a186fb7fa1f7 (diff) |
Merge #299
299: Ensure that the parser errors or not for the parser tests r=matklad a=DJMcNab
Co-authored-by: DJMcNab <[email protected]>
Diffstat (limited to 'crates/ra_syntax/tests/data/parser/inline/err')
12 files changed, 220 insertions, 0 deletions
diff --git a/crates/ra_syntax/tests/data/parser/inline/err/0001_array_type_missing_semi.rs b/crates/ra_syntax/tests/data/parser/inline/err/0001_array_type_missing_semi.rs new file mode 100644 index 000000000..a94851443 --- /dev/null +++ b/crates/ra_syntax/tests/data/parser/inline/err/0001_array_type_missing_semi.rs | |||
@@ -0,0 +1 @@ | |||
type T = [() 92]; | |||
diff --git a/crates/ra_syntax/tests/data/parser/inline/err/0001_array_type_missing_semi.txt b/crates/ra_syntax/tests/data/parser/inline/err/0001_array_type_missing_semi.txt new file mode 100644 index 000000000..036363587 --- /dev/null +++ b/crates/ra_syntax/tests/data/parser/inline/err/0001_array_type_missing_semi.txt | |||
@@ -0,0 +1,27 @@ | |||
1 | SOURCE_FILE@[0; 18) | ||
2 | TYPE_DEF@[0; 12) | ||
3 | TYPE_KW@[0; 4) | ||
4 | WHITESPACE@[4; 5) | ||
5 | NAME@[5; 6) | ||
6 | IDENT@[5; 6) "T" | ||
7 | WHITESPACE@[6; 7) | ||
8 | EQ@[7; 8) | ||
9 | WHITESPACE@[8; 9) | ||
10 | SLICE_TYPE@[9; 12) | ||
11 | L_BRACK@[9; 10) | ||
12 | TUPLE_TYPE@[10; 12) | ||
13 | L_PAREN@[10; 11) | ||
14 | R_PAREN@[11; 12) | ||
15 | err: `expected `;` or `]`` | ||
16 | err: `expected SEMI` | ||
17 | WHITESPACE@[12; 13) | ||
18 | err: `expected an item` | ||
19 | ERROR@[13; 15) | ||
20 | INT_NUMBER@[13; 15) "92" | ||
21 | err: `expected an item` | ||
22 | ERROR@[15; 16) | ||
23 | R_BRACK@[15; 16) | ||
24 | err: `expected an item` | ||
25 | ERROR@[16; 17) | ||
26 | SEMI@[16; 17) | ||
27 | WHITESPACE@[17; 18) | ||
diff --git a/crates/ra_syntax/tests/data/parser/inline/err/0002_misplaced_label_err.rs b/crates/ra_syntax/tests/data/parser/inline/err/0002_misplaced_label_err.rs new file mode 100644 index 000000000..a2164c510 --- /dev/null +++ b/crates/ra_syntax/tests/data/parser/inline/err/0002_misplaced_label_err.rs | |||
@@ -0,0 +1,3 @@ | |||
1 | fn main() { | ||
2 | 'loop: impl | ||
3 | } | ||
diff --git a/crates/ra_syntax/tests/data/parser/inline/err/0002_misplaced_label_err.txt b/crates/ra_syntax/tests/data/parser/inline/err/0002_misplaced_label_err.txt new file mode 100644 index 000000000..75533ecc1 --- /dev/null +++ b/crates/ra_syntax/tests/data/parser/inline/err/0002_misplaced_label_err.txt | |||
@@ -0,0 +1,28 @@ | |||
1 | SOURCE_FILE@[0; 30) | ||
2 | FN_DEF@[0; 29) | ||
3 | FN_KW@[0; 2) | ||
4 | WHITESPACE@[2; 3) | ||
5 | NAME@[3; 7) | ||
6 | IDENT@[3; 7) "main" | ||
7 | PARAM_LIST@[7; 9) | ||
8 | L_PAREN@[7; 8) | ||
9 | R_PAREN@[8; 9) | ||
10 | WHITESPACE@[9; 10) | ||
11 | BLOCK@[10; 29) | ||
12 | L_CURLY@[10; 11) | ||
13 | WHITESPACE@[11; 16) | ||
14 | EXPR_STMT@[16; 22) | ||
15 | ERROR@[16; 22) | ||
16 | LABEL@[16; 22) | ||
17 | LIFETIME@[16; 21) "'loop" | ||
18 | COLON@[21; 22) | ||
19 | err: `expected a loop` | ||
20 | err: `expected SEMI` | ||
21 | WHITESPACE@[22; 23) | ||
22 | IMPL_ITEM@[23; 27) | ||
23 | IMPL_KW@[23; 27) | ||
24 | err: `expected type` | ||
25 | err: `expected `{`` | ||
26 | WHITESPACE@[27; 28) | ||
27 | R_CURLY@[28; 29) | ||
28 | WHITESPACE@[29; 30) | ||
diff --git a/crates/ra_syntax/tests/data/parser/inline/err/0003_pointer_type_no_mutability.rs b/crates/ra_syntax/tests/data/parser/inline/err/0003_pointer_type_no_mutability.rs new file mode 100644 index 000000000..fae705131 --- /dev/null +++ b/crates/ra_syntax/tests/data/parser/inline/err/0003_pointer_type_no_mutability.rs | |||
@@ -0,0 +1 @@ | |||
type T = *(); | |||
diff --git a/crates/ra_syntax/tests/data/parser/inline/err/0003_pointer_type_no_mutability.txt b/crates/ra_syntax/tests/data/parser/inline/err/0003_pointer_type_no_mutability.txt new file mode 100644 index 000000000..189aa563e --- /dev/null +++ b/crates/ra_syntax/tests/data/parser/inline/err/0003_pointer_type_no_mutability.txt | |||
@@ -0,0 +1,17 @@ | |||
1 | SOURCE_FILE@[0; 14) | ||
2 | TYPE_DEF@[0; 13) | ||
3 | TYPE_KW@[0; 4) | ||
4 | WHITESPACE@[4; 5) | ||
5 | NAME@[5; 6) | ||
6 | IDENT@[5; 6) "T" | ||
7 | WHITESPACE@[6; 7) | ||
8 | EQ@[7; 8) | ||
9 | WHITESPACE@[8; 9) | ||
10 | POINTER_TYPE@[9; 12) | ||
11 | STAR@[9; 10) | ||
12 | err: `expected mut or const in raw pointer type (use `*mut T` or `*const T` as appropriate)` | ||
13 | TUPLE_TYPE@[10; 12) | ||
14 | L_PAREN@[10; 11) | ||
15 | R_PAREN@[11; 12) | ||
16 | SEMI@[12; 13) | ||
17 | WHITESPACE@[13; 14) | ||
diff --git a/crates/ra_syntax/tests/data/parser/inline/err/0004_impl_type.rs b/crates/ra_syntax/tests/data/parser/inline/err/0004_impl_type.rs new file mode 100644 index 000000000..b8c7b65e3 --- /dev/null +++ b/crates/ra_syntax/tests/data/parser/inline/err/0004_impl_type.rs | |||
@@ -0,0 +1,4 @@ | |||
1 | impl Type {} | ||
2 | impl Trait1 for T {} | ||
3 | impl impl NotType {} | ||
4 | impl Trait2 for impl NotType {} | ||
diff --git a/crates/ra_syntax/tests/data/parser/inline/err/0004_impl_type.txt b/crates/ra_syntax/tests/data/parser/inline/err/0004_impl_type.txt new file mode 100644 index 000000000..7279d5cae --- /dev/null +++ b/crates/ra_syntax/tests/data/parser/inline/err/0004_impl_type.txt | |||
@@ -0,0 +1,79 @@ | |||
1 | SOURCE_FILE@[0; 87) | ||
2 | IMPL_ITEM@[0; 12) | ||
3 | IMPL_KW@[0; 4) | ||
4 | WHITESPACE@[4; 5) | ||
5 | PATH_TYPE@[5; 9) | ||
6 | PATH@[5; 9) | ||
7 | PATH_SEGMENT@[5; 9) | ||
8 | NAME_REF@[5; 9) | ||
9 | IDENT@[5; 9) "Type" | ||
10 | WHITESPACE@[9; 10) | ||
11 | ITEM_LIST@[10; 12) | ||
12 | L_CURLY@[10; 11) | ||
13 | R_CURLY@[11; 12) | ||
14 | WHITESPACE@[12; 13) | ||
15 | IMPL_ITEM@[13; 33) | ||
16 | IMPL_KW@[13; 17) | ||
17 | WHITESPACE@[17; 18) | ||
18 | PATH_TYPE@[18; 24) | ||
19 | PATH@[18; 24) | ||
20 | PATH_SEGMENT@[18; 24) | ||
21 | NAME_REF@[18; 24) | ||
22 | IDENT@[18; 24) "Trait1" | ||
23 | WHITESPACE@[24; 25) | ||
24 | FOR_KW@[25; 28) | ||
25 | WHITESPACE@[28; 29) | ||
26 | PATH_TYPE@[29; 30) | ||
27 | PATH@[29; 30) | ||
28 | PATH_SEGMENT@[29; 30) | ||
29 | NAME_REF@[29; 30) | ||
30 | IDENT@[29; 30) "T" | ||
31 | WHITESPACE@[30; 31) | ||
32 | ITEM_LIST@[31; 33) | ||
33 | L_CURLY@[31; 32) | ||
34 | R_CURLY@[32; 33) | ||
35 | WHITESPACE@[33; 34) | ||
36 | IMPL_ITEM@[34; 38) | ||
37 | IMPL_KW@[34; 38) | ||
38 | err: `expected trait or type` | ||
39 | err: `expected `{`` | ||
40 | WHITESPACE@[38; 39) | ||
41 | IMPL_ITEM@[39; 54) | ||
42 | IMPL_KW@[39; 43) | ||
43 | WHITESPACE@[43; 44) | ||
44 | PATH_TYPE@[44; 51) | ||
45 | PATH@[44; 51) | ||
46 | PATH_SEGMENT@[44; 51) | ||
47 | NAME_REF@[44; 51) | ||
48 | IDENT@[44; 51) "NotType" | ||
49 | WHITESPACE@[51; 52) | ||
50 | ITEM_LIST@[52; 54) | ||
51 | L_CURLY@[52; 53) | ||
52 | R_CURLY@[53; 54) | ||
53 | WHITESPACE@[54; 55) | ||
54 | IMPL_ITEM@[55; 70) | ||
55 | IMPL_KW@[55; 59) | ||
56 | WHITESPACE@[59; 60) | ||
57 | PATH_TYPE@[60; 66) | ||
58 | PATH@[60; 66) | ||
59 | PATH_SEGMENT@[60; 66) | ||
60 | NAME_REF@[60; 66) | ||
61 | IDENT@[60; 66) "Trait2" | ||
62 | WHITESPACE@[66; 67) | ||
63 | FOR_KW@[67; 70) | ||
64 | err: `expected trait or type` | ||
65 | err: `expected `{`` | ||
66 | WHITESPACE@[70; 71) | ||
67 | IMPL_ITEM@[71; 86) | ||
68 | IMPL_KW@[71; 75) | ||
69 | WHITESPACE@[75; 76) | ||
70 | PATH_TYPE@[76; 83) | ||
71 | PATH@[76; 83) | ||
72 | PATH_SEGMENT@[76; 83) | ||
73 | NAME_REF@[76; 83) | ||
74 | IDENT@[76; 83) "NotType" | ||
75 | WHITESPACE@[83; 84) | ||
76 | ITEM_LIST@[84; 86) | ||
77 | L_CURLY@[84; 85) | ||
78 | R_CURLY@[85; 86) | ||
79 | WHITESPACE@[86; 87) | ||
diff --git a/crates/ra_syntax/tests/data/parser/inline/err/0005_fn_pointer_type_missing_fn.rs b/crates/ra_syntax/tests/data/parser/inline/err/0005_fn_pointer_type_missing_fn.rs new file mode 100644 index 000000000..f014914ff --- /dev/null +++ b/crates/ra_syntax/tests/data/parser/inline/err/0005_fn_pointer_type_missing_fn.rs | |||
@@ -0,0 +1 @@ | |||
type F = unsafe (); | |||
diff --git a/crates/ra_syntax/tests/data/parser/inline/err/0005_fn_pointer_type_missing_fn.txt b/crates/ra_syntax/tests/data/parser/inline/err/0005_fn_pointer_type_missing_fn.txt new file mode 100644 index 000000000..f97db4bff --- /dev/null +++ b/crates/ra_syntax/tests/data/parser/inline/err/0005_fn_pointer_type_missing_fn.txt | |||
@@ -0,0 +1,23 @@ | |||
1 | SOURCE_FILE@[0; 20) | ||
2 | TYPE_DEF@[0; 15) | ||
3 | TYPE_KW@[0; 4) | ||
4 | WHITESPACE@[4; 5) | ||
5 | NAME@[5; 6) | ||
6 | IDENT@[5; 6) "F" | ||
7 | WHITESPACE@[6; 7) | ||
8 | EQ@[7; 8) | ||
9 | WHITESPACE@[8; 9) | ||
10 | UNSAFE_KW@[9; 15) | ||
11 | err: `expected `fn`` | ||
12 | err: `expected SEMI` | ||
13 | WHITESPACE@[15; 16) | ||
14 | err: `expected an item` | ||
15 | ERROR@[16; 17) | ||
16 | L_PAREN@[16; 17) | ||
17 | err: `expected an item` | ||
18 | ERROR@[17; 18) | ||
19 | R_PAREN@[17; 18) | ||
20 | err: `expected an item` | ||
21 | ERROR@[18; 19) | ||
22 | SEMI@[18; 19) | ||
23 | WHITESPACE@[19; 20) | ||
diff --git a/crates/ra_syntax/tests/data/parser/inline/err/0006_unsafe_block_in_mod.rs b/crates/ra_syntax/tests/data/parser/inline/err/0006_unsafe_block_in_mod.rs new file mode 100644 index 000000000..26141e904 --- /dev/null +++ b/crates/ra_syntax/tests/data/parser/inline/err/0006_unsafe_block_in_mod.rs | |||
@@ -0,0 +1 @@ | |||
fn foo(){} unsafe { } fn bar(){} | |||
diff --git a/crates/ra_syntax/tests/data/parser/inline/err/0006_unsafe_block_in_mod.txt b/crates/ra_syntax/tests/data/parser/inline/err/0006_unsafe_block_in_mod.txt new file mode 100644 index 000000000..d2da2bad7 --- /dev/null +++ b/crates/ra_syntax/tests/data/parser/inline/err/0006_unsafe_block_in_mod.txt | |||
@@ -0,0 +1,35 @@ | |||
1 | SOURCE_FILE@[0; 33) | ||
2 | FN_DEF@[0; 10) | ||
3 | FN_KW@[0; 2) | ||
4 | WHITESPACE@[2; 3) | ||
5 | NAME@[3; 6) | ||
6 | IDENT@[3; 6) "foo" | ||
7 | PARAM_LIST@[6; 8) | ||
8 | L_PAREN@[6; 7) | ||
9 | R_PAREN@[7; 8) | ||
10 | BLOCK@[8; 10) | ||
11 | L_CURLY@[8; 9) | ||
12 | R_CURLY@[9; 10) | ||
13 | WHITESPACE@[10; 11) | ||
14 | err: `expected an item` | ||
15 | ERROR@[11; 17) | ||
16 | UNSAFE_KW@[11; 17) | ||
17 | WHITESPACE@[17; 18) | ||
18 | err: `expected an item` | ||
19 | ERROR@[18; 21) | ||
20 | L_CURLY@[18; 19) | ||
21 | WHITESPACE@[19; 20) | ||
22 | R_CURLY@[20; 21) | ||
23 | WHITESPACE@[21; 22) | ||
24 | FN_DEF@[22; 32) | ||
25 | FN_KW@[22; 24) | ||
26 | WHITESPACE@[24; 25) | ||
27 | NAME@[25; 28) | ||
28 | IDENT@[25; 28) "bar" | ||
29 | PARAM_LIST@[28; 30) | ||
30 | L_PAREN@[28; 29) | ||
31 | R_PAREN@[29; 30) | ||
32 | BLOCK@[30; 32) | ||
33 | L_CURLY@[30; 31) | ||
34 | R_CURLY@[31; 32) | ||
35 | WHITESPACE@[32; 33) | ||