diff options
author | Aleksey Kladov <[email protected]> | 2019-07-24 10:38:21 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-07-24 10:49:19 +0100 |
commit | 459241f272748ff2e57b2c7e84f5a04f78d67edb (patch) | |
tree | 2353f8f068962313d0b2748aab58b71c4ca456d2 /crates/ra_syntax/test_data/parser/inline/err | |
parent | 4d544fbf9b664b6a29d358d3cb41cdd7cd15e4d6 (diff) |
move syntax tests to unit tests
Diffstat (limited to 'crates/ra_syntax/test_data/parser/inline/err')
24 files changed, 496 insertions, 0 deletions
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0001_array_type_missing_semi.rs b/crates/ra_syntax/test_data/parser/inline/err/0001_array_type_missing_semi.rs new file mode 100644 index 000000000..a94851443 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/err/0001_array_type_missing_semi.rs | |||
@@ -0,0 +1 @@ | |||
type T = [() 92]; | |||
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0001_array_type_missing_semi.txt b/crates/ra_syntax/test_data/parser/inline/err/0001_array_type_missing_semi.txt new file mode 100644 index 000000000..3f0f1b480 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/err/0001_array_type_missing_semi.txt | |||
@@ -0,0 +1,27 @@ | |||
1 | SOURCE_FILE@[0; 18) | ||
2 | TYPE_ALIAS_DEF@[0; 12) | ||
3 | TYPE_KW@[0; 4) "type" | ||
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 | WHITESPACE@[12; 13) " " | ||
16 | ERROR@[13; 15) | ||
17 | INT_NUMBER@[13; 15) "92" | ||
18 | ERROR@[15; 16) | ||
19 | R_BRACK@[15; 16) "]" | ||
20 | ERROR@[16; 17) | ||
21 | SEMI@[16; 17) ";" | ||
22 | WHITESPACE@[17; 18) "\n" | ||
23 | error 12: expected `;` or `]` | ||
24 | error 12: expected SEMI | ||
25 | error 13: expected an item | ||
26 | error 15: expected an item | ||
27 | error 16: expected an item | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0002_misplaced_label_err.rs b/crates/ra_syntax/test_data/parser/inline/err/0002_misplaced_label_err.rs new file mode 100644 index 000000000..a2164c510 --- /dev/null +++ b/crates/ra_syntax/test_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/test_data/parser/inline/err/0002_misplaced_label_err.txt b/crates/ra_syntax/test_data/parser/inline/err/0002_misplaced_label_err.txt new file mode 100644 index 000000000..7abc49d5e --- /dev/null +++ b/crates/ra_syntax/test_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) "fn" | ||
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) "\n " | ||
14 | EXPR_STMT@[16; 22) | ||
15 | ERROR@[16; 22) | ||
16 | LABEL@[16; 22) | ||
17 | LIFETIME@[16; 21) "\'loop" | ||
18 | COLON@[21; 22) ":" | ||
19 | WHITESPACE@[22; 23) " " | ||
20 | IMPL_BLOCK@[23; 27) | ||
21 | IMPL_KW@[23; 27) "impl" | ||
22 | WHITESPACE@[27; 28) "\n" | ||
23 | R_CURLY@[28; 29) "}" | ||
24 | WHITESPACE@[29; 30) "\n" | ||
25 | error 22: expected a loop | ||
26 | error 22: expected SEMI | ||
27 | error 27: expected type | ||
28 | error 27: expected `{` | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0003_pointer_type_no_mutability.rs b/crates/ra_syntax/test_data/parser/inline/err/0003_pointer_type_no_mutability.rs new file mode 100644 index 000000000..fae705131 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/err/0003_pointer_type_no_mutability.rs | |||
@@ -0,0 +1 @@ | |||
type T = *(); | |||
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0003_pointer_type_no_mutability.txt b/crates/ra_syntax/test_data/parser/inline/err/0003_pointer_type_no_mutability.txt new file mode 100644 index 000000000..b97e339bb --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/err/0003_pointer_type_no_mutability.txt | |||
@@ -0,0 +1,17 @@ | |||
1 | SOURCE_FILE@[0; 14) | ||
2 | TYPE_ALIAS_DEF@[0; 13) | ||
3 | TYPE_KW@[0; 4) "type" | ||
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 | TUPLE_TYPE@[10; 12) | ||
13 | L_PAREN@[10; 11) "(" | ||
14 | R_PAREN@[11; 12) ")" | ||
15 | SEMI@[12; 13) ";" | ||
16 | WHITESPACE@[13; 14) "\n" | ||
17 | error 10: expected mut or const in raw pointer type (use `*mut T` or `*const T` as appropriate) | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0004_impl_type.rs b/crates/ra_syntax/test_data/parser/inline/err/0004_impl_type.rs new file mode 100644 index 000000000..b8c7b65e3 --- /dev/null +++ b/crates/ra_syntax/test_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/test_data/parser/inline/err/0004_impl_type.txt b/crates/ra_syntax/test_data/parser/inline/err/0004_impl_type.txt new file mode 100644 index 000000000..43321b1ed --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/err/0004_impl_type.txt | |||
@@ -0,0 +1,79 @@ | |||
1 | SOURCE_FILE@[0; 87) | ||
2 | IMPL_BLOCK@[0; 12) | ||
3 | IMPL_KW@[0; 4) "impl" | ||
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) "\n" | ||
15 | IMPL_BLOCK@[13; 33) | ||
16 | IMPL_KW@[13; 17) "impl" | ||
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) "for" | ||
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) "\n" | ||
36 | IMPL_BLOCK@[34; 38) | ||
37 | IMPL_KW@[34; 38) "impl" | ||
38 | WHITESPACE@[38; 39) " " | ||
39 | IMPL_BLOCK@[39; 54) | ||
40 | IMPL_KW@[39; 43) "impl" | ||
41 | WHITESPACE@[43; 44) " " | ||
42 | PATH_TYPE@[44; 51) | ||
43 | PATH@[44; 51) | ||
44 | PATH_SEGMENT@[44; 51) | ||
45 | NAME_REF@[44; 51) | ||
46 | IDENT@[44; 51) "NotType" | ||
47 | WHITESPACE@[51; 52) " " | ||
48 | ITEM_LIST@[52; 54) | ||
49 | L_CURLY@[52; 53) "{" | ||
50 | R_CURLY@[53; 54) "}" | ||
51 | WHITESPACE@[54; 55) "\n" | ||
52 | IMPL_BLOCK@[55; 70) | ||
53 | IMPL_KW@[55; 59) "impl" | ||
54 | WHITESPACE@[59; 60) " " | ||
55 | PATH_TYPE@[60; 66) | ||
56 | PATH@[60; 66) | ||
57 | PATH_SEGMENT@[60; 66) | ||
58 | NAME_REF@[60; 66) | ||
59 | IDENT@[60; 66) "Trait2" | ||
60 | WHITESPACE@[66; 67) " " | ||
61 | FOR_KW@[67; 70) "for" | ||
62 | WHITESPACE@[70; 71) " " | ||
63 | IMPL_BLOCK@[71; 86) | ||
64 | IMPL_KW@[71; 75) "impl" | ||
65 | WHITESPACE@[75; 76) " " | ||
66 | PATH_TYPE@[76; 83) | ||
67 | PATH@[76; 83) | ||
68 | PATH_SEGMENT@[76; 83) | ||
69 | NAME_REF@[76; 83) | ||
70 | IDENT@[76; 83) "NotType" | ||
71 | WHITESPACE@[83; 84) " " | ||
72 | ITEM_LIST@[84; 86) | ||
73 | L_CURLY@[84; 85) "{" | ||
74 | R_CURLY@[85; 86) "}" | ||
75 | WHITESPACE@[86; 87) "\n" | ||
76 | error 38: expected trait or type | ||
77 | error 38: expected `{` | ||
78 | error 70: expected trait or type | ||
79 | error 70: expected `{` | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.rs b/crates/ra_syntax/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.rs new file mode 100644 index 000000000..f014914ff --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.rs | |||
@@ -0,0 +1 @@ | |||
type F = unsafe (); | |||
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.txt b/crates/ra_syntax/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.txt new file mode 100644 index 000000000..451f29d39 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.txt | |||
@@ -0,0 +1,23 @@ | |||
1 | SOURCE_FILE@[0; 20) | ||
2 | TYPE_ALIAS_DEF@[0; 15) | ||
3 | TYPE_KW@[0; 4) "type" | ||
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) "unsafe" | ||
11 | WHITESPACE@[15; 16) " " | ||
12 | ERROR@[16; 17) | ||
13 | L_PAREN@[16; 17) "(" | ||
14 | ERROR@[17; 18) | ||
15 | R_PAREN@[17; 18) ")" | ||
16 | ERROR@[18; 19) | ||
17 | SEMI@[18; 19) ";" | ||
18 | WHITESPACE@[19; 20) "\n" | ||
19 | error 15: expected `fn` | ||
20 | error 15: expected SEMI | ||
21 | error 16: expected an item | ||
22 | error 17: expected an item | ||
23 | error 18: expected an item | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0006_unsafe_block_in_mod.rs b/crates/ra_syntax/test_data/parser/inline/err/0006_unsafe_block_in_mod.rs new file mode 100644 index 000000000..26141e904 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/err/0006_unsafe_block_in_mod.rs | |||
@@ -0,0 +1 @@ | |||
fn foo(){} unsafe { } fn bar(){} | |||
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0006_unsafe_block_in_mod.txt b/crates/ra_syntax/test_data/parser/inline/err/0006_unsafe_block_in_mod.txt new file mode 100644 index 000000000..a1871ec08 --- /dev/null +++ b/crates/ra_syntax/test_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) "fn" | ||
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 | ERROR@[11; 17) | ||
15 | UNSAFE_KW@[11; 17) "unsafe" | ||
16 | WHITESPACE@[17; 18) " " | ||
17 | ERROR@[18; 21) | ||
18 | L_CURLY@[18; 19) "{" | ||
19 | WHITESPACE@[19; 20) " " | ||
20 | R_CURLY@[20; 21) "}" | ||
21 | WHITESPACE@[21; 22) " " | ||
22 | FN_DEF@[22; 32) | ||
23 | FN_KW@[22; 24) "fn" | ||
24 | WHITESPACE@[24; 25) " " | ||
25 | NAME@[25; 28) | ||
26 | IDENT@[25; 28) "bar" | ||
27 | PARAM_LIST@[28; 30) | ||
28 | L_PAREN@[28; 29) "(" | ||
29 | R_PAREN@[29; 30) ")" | ||
30 | BLOCK@[30; 32) | ||
31 | L_CURLY@[30; 31) "{" | ||
32 | R_CURLY@[31; 32) "}" | ||
33 | WHITESPACE@[32; 33) "\n" | ||
34 | error 11: expected an item | ||
35 | error 18: expected an item | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0007_async_without_semicolon.rs b/crates/ra_syntax/test_data/parser/inline/err/0007_async_without_semicolon.rs new file mode 100644 index 000000000..9a423248c --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/err/0007_async_without_semicolon.rs | |||
@@ -0,0 +1 @@ | |||
fn foo() { let _ = async {} } | |||
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0007_async_without_semicolon.txt b/crates/ra_syntax/test_data/parser/inline/err/0007_async_without_semicolon.txt new file mode 100644 index 000000000..f70adc25d --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/err/0007_async_without_semicolon.txt | |||
@@ -0,0 +1,31 @@ | |||
1 | SOURCE_FILE@[0; 30) | ||
2 | FN_DEF@[0; 29) | ||
3 | FN_KW@[0; 2) "fn" | ||
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 | WHITESPACE@[8; 9) " " | ||
11 | BLOCK@[9; 29) | ||
12 | L_CURLY@[9; 10) "{" | ||
13 | WHITESPACE@[10; 11) " " | ||
14 | LET_STMT@[11; 27) | ||
15 | LET_KW@[11; 14) "let" | ||
16 | WHITESPACE@[14; 15) " " | ||
17 | PLACEHOLDER_PAT@[15; 16) | ||
18 | UNDERSCORE@[15; 16) "_" | ||
19 | WHITESPACE@[16; 17) " " | ||
20 | EQ@[17; 18) "=" | ||
21 | WHITESPACE@[18; 19) " " | ||
22 | BLOCK_EXPR@[19; 27) | ||
23 | ASYNC_KW@[19; 24) "async" | ||
24 | WHITESPACE@[24; 25) " " | ||
25 | BLOCK@[25; 27) | ||
26 | L_CURLY@[25; 26) "{" | ||
27 | R_CURLY@[26; 27) "}" | ||
28 | WHITESPACE@[27; 28) " " | ||
29 | R_CURLY@[28; 29) "}" | ||
30 | WHITESPACE@[29; 30) "\n" | ||
31 | error 27: expected SEMI | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0008_pub_expr.rs b/crates/ra_syntax/test_data/parser/inline/err/0008_pub_expr.rs new file mode 100644 index 000000000..2976f6862 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/err/0008_pub_expr.rs | |||
@@ -0,0 +1 @@ | |||
fn foo() { pub 92; } | |||
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0008_pub_expr.txt b/crates/ra_syntax/test_data/parser/inline/err/0008_pub_expr.txt new file mode 100644 index 000000000..1dbfca698 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/err/0008_pub_expr.txt | |||
@@ -0,0 +1,25 @@ | |||
1 | SOURCE_FILE@[0; 21) | ||
2 | FN_DEF@[0; 20) | ||
3 | FN_KW@[0; 2) "fn" | ||
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 | WHITESPACE@[8; 9) " " | ||
11 | BLOCK@[9; 20) | ||
12 | L_CURLY@[9; 10) "{" | ||
13 | WHITESPACE@[10; 11) " " | ||
14 | ERROR@[11; 14) | ||
15 | VISIBILITY@[11; 14) | ||
16 | PUB_KW@[11; 14) "pub" | ||
17 | WHITESPACE@[14; 15) " " | ||
18 | EXPR_STMT@[15; 18) | ||
19 | LITERAL@[15; 17) | ||
20 | INT_NUMBER@[15; 17) "92" | ||
21 | SEMI@[17; 18) ";" | ||
22 | WHITESPACE@[18; 19) " " | ||
23 | R_CURLY@[19; 20) "}" | ||
24 | WHITESPACE@[20; 21) "\n" | ||
25 | error 14: expected an item | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0009_attr_on_expr_not_allowed.rs b/crates/ra_syntax/test_data/parser/inline/err/0009_attr_on_expr_not_allowed.rs new file mode 100644 index 000000000..d725a07ce --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/err/0009_attr_on_expr_not_allowed.rs | |||
@@ -0,0 +1,4 @@ | |||
1 | fn foo() { | ||
2 | #[A] 1 + 2; | ||
3 | #[B] if true {}; | ||
4 | } | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0009_attr_on_expr_not_allowed.txt b/crates/ra_syntax/test_data/parser/inline/err/0009_attr_on_expr_not_allowed.txt new file mode 100644 index 000000000..338776a72 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/err/0009_attr_on_expr_not_allowed.txt | |||
@@ -0,0 +1,55 @@ | |||
1 | SOURCE_FILE@[0; 48) | ||
2 | FN_DEF@[0; 47) | ||
3 | FN_KW@[0; 2) "fn" | ||
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 | WHITESPACE@[8; 9) " " | ||
11 | BLOCK@[9; 47) | ||
12 | L_CURLY@[9; 10) "{" | ||
13 | WHITESPACE@[10; 14) "\n " | ||
14 | EXPR_STMT@[14; 25) | ||
15 | ATTR@[14; 18) | ||
16 | POUND@[14; 15) "#" | ||
17 | TOKEN_TREE@[15; 18) | ||
18 | L_BRACK@[15; 16) "[" | ||
19 | IDENT@[16; 17) "A" | ||
20 | R_BRACK@[17; 18) "]" | ||
21 | WHITESPACE@[18; 19) " " | ||
22 | BIN_EXPR@[19; 24) | ||
23 | LITERAL@[19; 20) | ||
24 | INT_NUMBER@[19; 20) "1" | ||
25 | WHITESPACE@[20; 21) " " | ||
26 | PLUS@[21; 22) "+" | ||
27 | WHITESPACE@[22; 23) " " | ||
28 | LITERAL@[23; 24) | ||
29 | INT_NUMBER@[23; 24) "2" | ||
30 | SEMI@[24; 25) ";" | ||
31 | WHITESPACE@[25; 29) "\n " | ||
32 | EXPR_STMT@[29; 45) | ||
33 | ATTR@[29; 33) | ||
34 | POUND@[29; 30) "#" | ||
35 | TOKEN_TREE@[30; 33) | ||
36 | L_BRACK@[30; 31) "[" | ||
37 | IDENT@[31; 32) "B" | ||
38 | R_BRACK@[32; 33) "]" | ||
39 | WHITESPACE@[33; 34) " " | ||
40 | IF_EXPR@[34; 44) | ||
41 | IF_KW@[34; 36) "if" | ||
42 | WHITESPACE@[36; 37) " " | ||
43 | CONDITION@[37; 41) | ||
44 | LITERAL@[37; 41) | ||
45 | TRUE_KW@[37; 41) "true" | ||
46 | WHITESPACE@[41; 42) " " | ||
47 | BLOCK@[42; 44) | ||
48 | L_CURLY@[42; 43) "{" | ||
49 | R_CURLY@[43; 44) "}" | ||
50 | SEMI@[44; 45) ";" | ||
51 | WHITESPACE@[45; 46) "\n" | ||
52 | R_CURLY@[46; 47) "}" | ||
53 | WHITESPACE@[47; 48) "\n" | ||
54 | error 24: attributes are not allowed on BIN_EXPR | ||
55 | error 44: attributes are not allowed on IF_EXPR | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0010_bad_tuple_index_expr.rs b/crates/ra_syntax/test_data/parser/inline/err/0010_bad_tuple_index_expr.rs new file mode 100644 index 000000000..30cc49138 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/err/0010_bad_tuple_index_expr.rs | |||
@@ -0,0 +1,5 @@ | |||
1 | fn foo() { | ||
2 | x.0.; | ||
3 | x.1i32; | ||
4 | x.0x01; | ||
5 | } | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0010_bad_tuple_index_expr.txt b/crates/ra_syntax/test_data/parser/inline/err/0010_bad_tuple_index_expr.txt new file mode 100644 index 000000000..a21b29c80 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/err/0010_bad_tuple_index_expr.txt | |||
@@ -0,0 +1,51 @@ | |||
1 | SOURCE_FILE@[0; 47) | ||
2 | FN_DEF@[0; 46) | ||
3 | FN_KW@[0; 2) "fn" | ||
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 | WHITESPACE@[8; 9) " " | ||
11 | BLOCK@[9; 46) | ||
12 | L_CURLY@[9; 10) "{" | ||
13 | WHITESPACE@[10; 15) "\n " | ||
14 | EXPR_STMT@[15; 20) | ||
15 | FIELD_EXPR@[15; 19) | ||
16 | PATH_EXPR@[15; 16) | ||
17 | PATH@[15; 16) | ||
18 | PATH_SEGMENT@[15; 16) | ||
19 | NAME_REF@[15; 16) | ||
20 | IDENT@[15; 16) "x" | ||
21 | DOT@[16; 17) "." | ||
22 | FLOAT_NUMBER@[17; 19) "0." | ||
23 | SEMI@[19; 20) ";" | ||
24 | WHITESPACE@[20; 25) "\n " | ||
25 | EXPR_STMT@[25; 32) | ||
26 | FIELD_EXPR@[25; 31) | ||
27 | PATH_EXPR@[25; 26) | ||
28 | PATH@[25; 26) | ||
29 | PATH_SEGMENT@[25; 26) | ||
30 | NAME_REF@[25; 26) | ||
31 | IDENT@[25; 26) "x" | ||
32 | DOT@[26; 27) "." | ||
33 | INT_NUMBER@[27; 31) "1i32" | ||
34 | SEMI@[31; 32) ";" | ||
35 | WHITESPACE@[32; 37) "\n " | ||
36 | EXPR_STMT@[37; 44) | ||
37 | FIELD_EXPR@[37; 43) | ||
38 | PATH_EXPR@[37; 38) | ||
39 | PATH@[37; 38) | ||
40 | PATH_SEGMENT@[37; 38) | ||
41 | NAME_REF@[37; 38) | ||
42 | IDENT@[37; 38) "x" | ||
43 | DOT@[38; 39) "." | ||
44 | INT_NUMBER@[39; 43) "0x01" | ||
45 | SEMI@[43; 44) ";" | ||
46 | WHITESPACE@[44; 45) "\n" | ||
47 | R_CURLY@[45; 46) "}" | ||
48 | WHITESPACE@[46; 47) "\n" | ||
49 | error [17; 19): Tuple (struct) field access is only allowed through decimal integers with no underscores or suffix | ||
50 | error [27; 31): Tuple (struct) field access is only allowed through decimal integers with no underscores or suffix | ||
51 | error [39; 43): Tuple (struct) field access is only allowed through decimal integers with no underscores or suffix | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0010_wrong_order_fns.rs b/crates/ra_syntax/test_data/parser/inline/err/0010_wrong_order_fns.rs new file mode 100644 index 000000000..16edee95d --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/err/0010_wrong_order_fns.rs | |||
@@ -0,0 +1,2 @@ | |||
1 | async unsafe fn foo() {} | ||
2 | unsafe const fn bar() {} | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0010_wrong_order_fns.txt b/crates/ra_syntax/test_data/parser/inline/err/0010_wrong_order_fns.txt new file mode 100644 index 000000000..b1ef210d3 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/err/0010_wrong_order_fns.txt | |||
@@ -0,0 +1,39 @@ | |||
1 | SOURCE_FILE@[0; 50) | ||
2 | ERROR@[0; 5) | ||
3 | ASYNC_KW@[0; 5) "async" | ||
4 | WHITESPACE@[5; 6) " " | ||
5 | FN_DEF@[6; 24) | ||
6 | UNSAFE_KW@[6; 12) "unsafe" | ||
7 | WHITESPACE@[12; 13) " " | ||
8 | FN_KW@[13; 15) "fn" | ||
9 | WHITESPACE@[15; 16) " " | ||
10 | NAME@[16; 19) | ||
11 | IDENT@[16; 19) "foo" | ||
12 | PARAM_LIST@[19; 21) | ||
13 | L_PAREN@[19; 20) "(" | ||
14 | R_PAREN@[20; 21) ")" | ||
15 | WHITESPACE@[21; 22) " " | ||
16 | BLOCK@[22; 24) | ||
17 | L_CURLY@[22; 23) "{" | ||
18 | R_CURLY@[23; 24) "}" | ||
19 | WHITESPACE@[24; 25) "\n" | ||
20 | ERROR@[25; 31) | ||
21 | UNSAFE_KW@[25; 31) "unsafe" | ||
22 | WHITESPACE@[31; 32) " " | ||
23 | FN_DEF@[32; 49) | ||
24 | CONST_KW@[32; 37) "const" | ||
25 | WHITESPACE@[37; 38) " " | ||
26 | FN_KW@[38; 40) "fn" | ||
27 | WHITESPACE@[40; 41) " " | ||
28 | NAME@[41; 44) | ||
29 | IDENT@[41; 44) "bar" | ||
30 | PARAM_LIST@[44; 46) | ||
31 | L_PAREN@[44; 45) "(" | ||
32 | R_PAREN@[45; 46) ")" | ||
33 | WHITESPACE@[46; 47) " " | ||
34 | BLOCK@[47; 49) | ||
35 | L_CURLY@[47; 48) "{" | ||
36 | R_CURLY@[48; 49) "}" | ||
37 | WHITESPACE@[49; 50) "\n" | ||
38 | error 5: expected existential, fn, trait or impl | ||
39 | error 31: expected existential, fn, trait or impl | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0014_default_fn_type.rs b/crates/ra_syntax/test_data/parser/inline/err/0014_default_fn_type.rs new file mode 100644 index 000000000..15ba8f4a8 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/err/0014_default_fn_type.rs | |||
@@ -0,0 +1,4 @@ | |||
1 | trait T { | ||
2 | default type T = Bar; | ||
3 | default fn foo() {} | ||
4 | } | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0014_default_fn_type.txt b/crates/ra_syntax/test_data/parser/inline/err/0014_default_fn_type.txt new file mode 100644 index 000000000..7da4e243f --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/err/0014_default_fn_type.txt | |||
@@ -0,0 +1,58 @@ | |||
1 | SOURCE_FILE@[0; 62) | ||
2 | TRAIT_DEF@[0; 61) | ||
3 | TRAIT_KW@[0; 5) "trait" | ||
4 | WHITESPACE@[5; 6) " " | ||
5 | NAME@[6; 7) | ||
6 | IDENT@[6; 7) "T" | ||
7 | WHITESPACE@[7; 8) " " | ||
8 | ITEM_LIST@[8; 61) | ||
9 | L_CURLY@[8; 9) "{" | ||
10 | WHITESPACE@[9; 14) "\n " | ||
11 | MACRO_CALL@[14; 21) | ||
12 | PATH@[14; 21) | ||
13 | PATH_SEGMENT@[14; 21) | ||
14 | NAME_REF@[14; 21) | ||
15 | IDENT@[14; 21) "default" | ||
16 | WHITESPACE@[21; 22) " " | ||
17 | TYPE_ALIAS_DEF@[22; 35) | ||
18 | TYPE_KW@[22; 26) "type" | ||
19 | WHITESPACE@[26; 27) " " | ||
20 | NAME@[27; 28) | ||
21 | IDENT@[27; 28) "T" | ||
22 | WHITESPACE@[28; 29) " " | ||
23 | EQ@[29; 30) "=" | ||
24 | WHITESPACE@[30; 31) " " | ||
25 | PATH_TYPE@[31; 34) | ||
26 | PATH@[31; 34) | ||
27 | PATH_SEGMENT@[31; 34) | ||
28 | NAME_REF@[31; 34) | ||
29 | IDENT@[31; 34) "Bar" | ||
30 | SEMI@[34; 35) ";" | ||
31 | WHITESPACE@[35; 40) "\n " | ||
32 | MACRO_CALL@[40; 47) | ||
33 | PATH@[40; 47) | ||
34 | PATH_SEGMENT@[40; 47) | ||
35 | NAME_REF@[40; 47) | ||
36 | IDENT@[40; 47) "default" | ||
37 | WHITESPACE@[47; 48) " " | ||
38 | FN_DEF@[48; 59) | ||
39 | FN_KW@[48; 50) "fn" | ||
40 | WHITESPACE@[50; 51) " " | ||
41 | NAME@[51; 54) | ||
42 | IDENT@[51; 54) "foo" | ||
43 | PARAM_LIST@[54; 56) | ||
44 | L_PAREN@[54; 55) "(" | ||
45 | R_PAREN@[55; 56) ")" | ||
46 | WHITESPACE@[56; 57) " " | ||
47 | BLOCK@[57; 59) | ||
48 | L_CURLY@[57; 58) "{" | ||
49 | R_CURLY@[58; 59) "}" | ||
50 | WHITESPACE@[59; 60) "\n" | ||
51 | R_CURLY@[60; 61) "}" | ||
52 | WHITESPACE@[61; 62) "\n" | ||
53 | error 21: expected EXCL | ||
54 | error 21: expected `{`, `[`, `(` | ||
55 | error 21: expected SEMI | ||
56 | error 47: expected EXCL | ||
57 | error 47: expected `{`, `[`, `(` | ||
58 | error 47: expected SEMI | ||