diff options
author | Aleksey Kladov <[email protected]> | 2018-02-11 09:51:09 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-02-11 09:51:09 +0000 |
commit | 8a3f17a4e263781deac5e503ad5116ec78004618 (patch) | |
tree | 0b489b1784c572011dd9e25d6d0ba53e8a50f148 /tests/data/parser/inline | |
parent | 2fb33b2d0d14f09ee06a42bca252dccbf57185e1 (diff) |
G: fn pointer type
Diffstat (limited to 'tests/data/parser/inline')
6 files changed, 102 insertions, 0 deletions
diff --git a/tests/data/parser/inline/0028_fn_pointer_type.rs b/tests/data/parser/inline/0028_fn_pointer_type.rs new file mode 100644 index 000000000..c9bf3bdb4 --- /dev/null +++ b/tests/data/parser/inline/0028_fn_pointer_type.rs | |||
@@ -0,0 +1,3 @@ | |||
1 | type A = fn(); | ||
2 | type B = unsafe fn(); | ||
3 | type C = unsafe extern "C" fn(); | ||
diff --git a/tests/data/parser/inline/0028_fn_pointer_type.txt b/tests/data/parser/inline/0028_fn_pointer_type.txt new file mode 100644 index 000000000..6c62b0051 --- /dev/null +++ b/tests/data/parser/inline/0028_fn_pointer_type.txt | |||
@@ -0,0 +1,52 @@ | |||
1 | FILE@[0; 70) | ||
2 | TYPE_ITEM@[0; 15) | ||
3 | TYPE_KW@[0; 4) | ||
4 | NAME@[4; 7) | ||
5 | WHITESPACE@[4; 5) | ||
6 | IDENT@[5; 6) "A" | ||
7 | WHITESPACE@[6; 7) | ||
8 | EQ@[7; 8) | ||
9 | FN_POINTER_TYPE@[8; 13) | ||
10 | WHITESPACE@[8; 9) | ||
11 | FN_KW@[9; 11) | ||
12 | L_PAREN@[11; 12) | ||
13 | R_PAREN@[12; 13) | ||
14 | SEMI@[13; 14) | ||
15 | WHITESPACE@[14; 15) | ||
16 | TYPE_ITEM@[15; 37) | ||
17 | TYPE_KW@[15; 19) | ||
18 | NAME@[19; 22) | ||
19 | WHITESPACE@[19; 20) | ||
20 | IDENT@[20; 21) "B" | ||
21 | WHITESPACE@[21; 22) | ||
22 | EQ@[22; 23) | ||
23 | FN_POINTER_TYPE@[23; 35) | ||
24 | WHITESPACE@[23; 24) | ||
25 | UNSAFE_KW@[24; 30) | ||
26 | WHITESPACE@[30; 31) | ||
27 | FN_KW@[31; 33) | ||
28 | L_PAREN@[33; 34) | ||
29 | R_PAREN@[34; 35) | ||
30 | SEMI@[35; 36) | ||
31 | WHITESPACE@[36; 37) | ||
32 | TYPE_ITEM@[37; 70) | ||
33 | TYPE_KW@[37; 41) | ||
34 | NAME@[41; 44) | ||
35 | WHITESPACE@[41; 42) | ||
36 | IDENT@[42; 43) "C" | ||
37 | WHITESPACE@[43; 44) | ||
38 | EQ@[44; 45) | ||
39 | FN_POINTER_TYPE@[45; 68) | ||
40 | WHITESPACE@[45; 46) | ||
41 | UNSAFE_KW@[46; 52) | ||
42 | ABI@[52; 64) | ||
43 | WHITESPACE@[52; 53) | ||
44 | EXTERN_KW@[53; 59) | ||
45 | WHITESPACE@[59; 60) | ||
46 | STRING@[60; 63) | ||
47 | WHITESPACE@[63; 64) | ||
48 | FN_KW@[64; 66) | ||
49 | L_PAREN@[66; 67) | ||
50 | R_PAREN@[67; 68) | ||
51 | SEMI@[68; 69) | ||
52 | WHITESPACE@[69; 70) | ||
diff --git a/tests/data/parser/inline/0029_fn_pointer_type_missing_fn.rs b/tests/data/parser/inline/0029_fn_pointer_type_missing_fn.rs new file mode 100644 index 000000000..f014914ff --- /dev/null +++ b/tests/data/parser/inline/0029_fn_pointer_type_missing_fn.rs | |||
@@ -0,0 +1 @@ | |||
type F = unsafe (); | |||
diff --git a/tests/data/parser/inline/0029_fn_pointer_type_missing_fn.txt b/tests/data/parser/inline/0029_fn_pointer_type_missing_fn.txt new file mode 100644 index 000000000..dd6e24096 --- /dev/null +++ b/tests/data/parser/inline/0029_fn_pointer_type_missing_fn.txt | |||
@@ -0,0 +1,24 @@ | |||
1 | FILE@[0; 20) | ||
2 | TYPE_ITEM@[0; 16) | ||
3 | TYPE_KW@[0; 4) | ||
4 | NAME@[4; 7) | ||
5 | WHITESPACE@[4; 5) | ||
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 | ERROR@[16; 17) | ||
15 | err: `expected item` | ||
16 | L_PAREN@[16; 17) | ||
17 | ERROR@[17; 18) | ||
18 | err: `expected item` | ||
19 | R_PAREN@[17; 18) | ||
20 | ERROR@[18; 20) | ||
21 | err: `expected item, found `;` | ||
22 | consider removing this semicolon` | ||
23 | SEMI@[18; 19) | ||
24 | WHITESPACE@[19; 20) | ||
diff --git a/tests/data/parser/inline/0030_fn_pointer_type_with_ret.rs b/tests/data/parser/inline/0030_fn_pointer_type_with_ret.rs new file mode 100644 index 000000000..e3ba5e87f --- /dev/null +++ b/tests/data/parser/inline/0030_fn_pointer_type_with_ret.rs | |||
@@ -0,0 +1 @@ | |||
type F = fn() -> (); | |||
diff --git a/tests/data/parser/inline/0030_fn_pointer_type_with_ret.txt b/tests/data/parser/inline/0030_fn_pointer_type_with_ret.txt new file mode 100644 index 000000000..b41efa368 --- /dev/null +++ b/tests/data/parser/inline/0030_fn_pointer_type_with_ret.txt | |||
@@ -0,0 +1,21 @@ | |||
1 | FILE@[0; 21) | ||
2 | TYPE_ITEM@[0; 21) | ||
3 | TYPE_KW@[0; 4) | ||
4 | NAME@[4; 7) | ||
5 | WHITESPACE@[4; 5) | ||
6 | IDENT@[5; 6) "F" | ||
7 | WHITESPACE@[6; 7) | ||
8 | EQ@[7; 8) | ||
9 | FN_POINTER_TYPE@[8; 19) | ||
10 | WHITESPACE@[8; 9) | ||
11 | FN_KW@[9; 11) | ||
12 | L_PAREN@[11; 12) | ||
13 | R_PAREN@[12; 13) | ||
14 | WHITESPACE@[13; 14) | ||
15 | THIN_ARROW@[14; 16) | ||
16 | TUPLE_TYPE@[16; 19) | ||
17 | WHITESPACE@[16; 17) | ||
18 | L_PAREN@[17; 18) | ||
19 | R_PAREN@[18; 19) | ||
20 | SEMI@[19; 20) | ||
21 | WHITESPACE@[20; 21) | ||