diff options
Diffstat (limited to 'crates/ra_syntax')
4 files changed, 121 insertions, 0 deletions
diff --git a/crates/ra_syntax/tests/data/parser/inline/err/0014_default_fn_type.rs b/crates/ra_syntax/tests/data/parser/inline/err/0014_default_fn_type.rs new file mode 100644 index 000000000..15ba8f4a8 --- /dev/null +++ b/crates/ra_syntax/tests/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/tests/data/parser/inline/err/0014_default_fn_type.txt b/crates/ra_syntax/tests/data/parser/inline/err/0014_default_fn_type.txt new file mode 100644 index 000000000..7da4e243f --- /dev/null +++ b/crates/ra_syntax/tests/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 | ||
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0132_default_fn_type.rs b/crates/ra_syntax/tests/data/parser/inline/ok/0132_default_fn_type.rs new file mode 100644 index 000000000..8f5d61113 --- /dev/null +++ b/crates/ra_syntax/tests/data/parser/inline/ok/0132_default_fn_type.rs | |||
@@ -0,0 +1,4 @@ | |||
1 | impl T for Foo { | ||
2 | default type T = Bar; | ||
3 | default fn foo() {} | ||
4 | } | ||
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0132_default_fn_type.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0132_default_fn_type.txt new file mode 100644 index 000000000..384b203d3 --- /dev/null +++ b/crates/ra_syntax/tests/data/parser/inline/ok/0132_default_fn_type.txt | |||
@@ -0,0 +1,55 @@ | |||
1 | SOURCE_FILE@[0; 69) | ||
2 | IMPL_BLOCK@[0; 68) | ||
3 | IMPL_KW@[0; 4) "impl" | ||
4 | WHITESPACE@[4; 5) " " | ||
5 | PATH_TYPE@[5; 6) | ||
6 | PATH@[5; 6) | ||
7 | PATH_SEGMENT@[5; 6) | ||
8 | NAME_REF@[5; 6) | ||
9 | IDENT@[5; 6) "T" | ||
10 | WHITESPACE@[6; 7) " " | ||
11 | FOR_KW@[7; 10) "for" | ||
12 | WHITESPACE@[10; 11) " " | ||
13 | PATH_TYPE@[11; 14) | ||
14 | PATH@[11; 14) | ||
15 | PATH_SEGMENT@[11; 14) | ||
16 | NAME_REF@[11; 14) | ||
17 | IDENT@[11; 14) "Foo" | ||
18 | WHITESPACE@[14; 15) " " | ||
19 | ITEM_LIST@[15; 68) | ||
20 | L_CURLY@[15; 16) "{" | ||
21 | WHITESPACE@[16; 21) "\n " | ||
22 | TYPE_ALIAS_DEF@[21; 42) | ||
23 | DEFAULT_KW@[21; 28) "default" | ||
24 | WHITESPACE@[28; 29) " " | ||
25 | TYPE_KW@[29; 33) "type" | ||
26 | WHITESPACE@[33; 34) " " | ||
27 | NAME@[34; 35) | ||
28 | IDENT@[34; 35) "T" | ||
29 | WHITESPACE@[35; 36) " " | ||
30 | EQ@[36; 37) "=" | ||
31 | WHITESPACE@[37; 38) " " | ||
32 | PATH_TYPE@[38; 41) | ||
33 | PATH@[38; 41) | ||
34 | PATH_SEGMENT@[38; 41) | ||
35 | NAME_REF@[38; 41) | ||
36 | IDENT@[38; 41) "Bar" | ||
37 | SEMI@[41; 42) ";" | ||
38 | WHITESPACE@[42; 47) "\n " | ||
39 | FN_DEF@[47; 66) | ||
40 | DEFAULT_KW@[47; 54) "default" | ||
41 | WHITESPACE@[54; 55) " " | ||
42 | FN_KW@[55; 57) "fn" | ||
43 | WHITESPACE@[57; 58) " " | ||
44 | NAME@[58; 61) | ||
45 | IDENT@[58; 61) "foo" | ||
46 | PARAM_LIST@[61; 63) | ||
47 | L_PAREN@[61; 62) "(" | ||
48 | R_PAREN@[62; 63) ")" | ||
49 | WHITESPACE@[63; 64) " " | ||
50 | BLOCK@[64; 66) | ||
51 | L_CURLY@[64; 65) "{" | ||
52 | R_CURLY@[65; 66) "}" | ||
53 | WHITESPACE@[66; 67) "\n" | ||
54 | R_CURLY@[67; 68) "}" | ||
55 | WHITESPACE@[68; 69) "\n" | ||