diff options
author | Aleksey Kladov <[email protected]> | 2018-08-08 16:34:26 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-08-08 16:34:26 +0100 |
commit | 8f21afacfc981e93f2ad78cd340e9b6c0e821d92 (patch) | |
tree | de7edde0b99d913c9f6ec049f794e71a26f1cecc /tests | |
parent | de7b1887ae46c78c3c0abf6d264b2649b1b5cf0b (diff) |
Optional patterns in fn types
Diffstat (limited to 'tests')
4 files changed, 126 insertions, 0 deletions
diff --git a/tests/data/parser/inline/0096_value_parameters_no_patterns.rs b/tests/data/parser/inline/0096_value_parameters_no_patterns.rs new file mode 100644 index 000000000..d8c23c76a --- /dev/null +++ b/tests/data/parser/inline/0096_value_parameters_no_patterns.rs | |||
@@ -0,0 +1 @@ | |||
type F = Box<Fn(a: i32, &b: &i32, &mut c: &i32, ())>; | |||
diff --git a/tests/data/parser/inline/0096_value_parameters_no_patterns.txt b/tests/data/parser/inline/0096_value_parameters_no_patterns.txt new file mode 100644 index 000000000..c3f9bf685 --- /dev/null +++ b/tests/data/parser/inline/0096_value_parameters_no_patterns.txt | |||
@@ -0,0 +1,81 @@ | |||
1 | FILE@[0; 54) | ||
2 | TYPE_ITEM@[0; 53) | ||
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 | PATH_TYPE@[9; 52) | ||
11 | PATH@[9; 52) | ||
12 | PATH_SEGMENT@[9; 52) | ||
13 | NAME_REF@[9; 12) | ||
14 | IDENT@[9; 12) "Box" | ||
15 | TYPE_ARG_LIST@[12; 52) | ||
16 | L_ANGLE@[12; 13) | ||
17 | TYPE_ARG@[13; 51) | ||
18 | PATH_TYPE@[13; 51) | ||
19 | PATH@[13; 51) | ||
20 | PATH_SEGMENT@[13; 51) | ||
21 | NAME_REF@[13; 15) | ||
22 | IDENT@[13; 15) "Fn" | ||
23 | PARAM_LIST@[15; 51) | ||
24 | L_PAREN@[15; 16) | ||
25 | PARAM@[16; 22) | ||
26 | BIND_PAT@[16; 17) | ||
27 | NAME@[16; 17) | ||
28 | IDENT@[16; 17) "a" | ||
29 | COLON@[17; 18) | ||
30 | WHITESPACE@[18; 19) | ||
31 | PATH_TYPE@[19; 22) | ||
32 | PATH@[19; 22) | ||
33 | PATH_SEGMENT@[19; 22) | ||
34 | NAME_REF@[19; 22) | ||
35 | IDENT@[19; 22) "i32" | ||
36 | COMMA@[22; 23) | ||
37 | WHITESPACE@[23; 24) | ||
38 | PARAM@[24; 32) | ||
39 | REF_PAT@[24; 26) | ||
40 | AMP@[24; 25) | ||
41 | BIND_PAT@[25; 26) | ||
42 | NAME@[25; 26) | ||
43 | IDENT@[25; 26) "b" | ||
44 | COLON@[26; 27) | ||
45 | WHITESPACE@[27; 28) | ||
46 | REFERENCE_TYPE@[28; 32) | ||
47 | AMP@[28; 29) | ||
48 | PATH_TYPE@[29; 32) | ||
49 | PATH@[29; 32) | ||
50 | PATH_SEGMENT@[29; 32) | ||
51 | NAME_REF@[29; 32) | ||
52 | IDENT@[29; 32) "i32" | ||
53 | COMMA@[32; 33) | ||
54 | WHITESPACE@[33; 34) | ||
55 | PARAM@[34; 46) | ||
56 | REF_PAT@[34; 40) | ||
57 | AMP@[34; 35) | ||
58 | MUT_KW@[35; 38) | ||
59 | WHITESPACE@[38; 39) | ||
60 | BIND_PAT@[39; 40) | ||
61 | NAME@[39; 40) | ||
62 | IDENT@[39; 40) "c" | ||
63 | COLON@[40; 41) | ||
64 | WHITESPACE@[41; 42) | ||
65 | REFERENCE_TYPE@[42; 46) | ||
66 | AMP@[42; 43) | ||
67 | PATH_TYPE@[43; 46) | ||
68 | PATH@[43; 46) | ||
69 | PATH_SEGMENT@[43; 46) | ||
70 | NAME_REF@[43; 46) | ||
71 | IDENT@[43; 46) "i32" | ||
72 | COMMA@[46; 47) | ||
73 | WHITESPACE@[47; 48) | ||
74 | PARAM@[48; 50) | ||
75 | TUPLE_TYPE@[48; 50) | ||
76 | L_PAREN@[48; 49) | ||
77 | R_PAREN@[49; 50) | ||
78 | R_PAREN@[50; 51) | ||
79 | R_ANGLE@[51; 52) | ||
80 | SEMI@[52; 53) | ||
81 | WHITESPACE@[53; 54) | ||
diff --git a/tests/data/parser/inline/0097_param_list_opt_patterns.rs b/tests/data/parser/inline/0097_param_list_opt_patterns.rs new file mode 100644 index 000000000..9b93442c0 --- /dev/null +++ b/tests/data/parser/inline/0097_param_list_opt_patterns.rs | |||
@@ -0,0 +1 @@ | |||
fn foo<F: FnMut(&mut Foo<'a>)>(){} | |||
diff --git a/tests/data/parser/inline/0097_param_list_opt_patterns.txt b/tests/data/parser/inline/0097_param_list_opt_patterns.txt new file mode 100644 index 000000000..f8a37aebb --- /dev/null +++ b/tests/data/parser/inline/0097_param_list_opt_patterns.txt | |||
@@ -0,0 +1,43 @@ | |||
1 | FILE@[0; 35) | ||
2 | FN_ITEM@[0; 34) | ||
3 | FN_KW@[0; 2) | ||
4 | WHITESPACE@[2; 3) | ||
5 | NAME@[3; 6) | ||
6 | IDENT@[3; 6) "foo" | ||
7 | TYPE_PARAM_LIST@[6; 30) | ||
8 | L_ANGLE@[6; 7) | ||
9 | TYPE_PARAM@[7; 29) | ||
10 | NAME@[7; 8) | ||
11 | IDENT@[7; 8) "F" | ||
12 | COLON@[8; 9) | ||
13 | WHITESPACE@[9; 10) | ||
14 | PATH@[10; 29) | ||
15 | PATH_SEGMENT@[10; 29) | ||
16 | NAME_REF@[10; 15) | ||
17 | IDENT@[10; 15) "FnMut" | ||
18 | PARAM_LIST@[15; 29) | ||
19 | L_PAREN@[15; 16) | ||
20 | PARAM@[16; 28) | ||
21 | REFERENCE_TYPE@[16; 28) | ||
22 | AMP@[16; 17) | ||
23 | MUT_KW@[17; 20) | ||
24 | WHITESPACE@[20; 21) | ||
25 | PATH_TYPE@[21; 28) | ||
26 | PATH@[21; 28) | ||
27 | PATH_SEGMENT@[21; 28) | ||
28 | NAME_REF@[21; 24) | ||
29 | IDENT@[21; 24) "Foo" | ||
30 | TYPE_ARG_LIST@[24; 28) | ||
31 | L_ANGLE@[24; 25) | ||
32 | LIFETIME_ARG@[25; 27) | ||
33 | LIFETIME@[25; 27) "'a" | ||
34 | R_ANGLE@[27; 28) | ||
35 | R_PAREN@[28; 29) | ||
36 | R_ANGLE@[29; 30) | ||
37 | PARAM_LIST@[30; 32) | ||
38 | L_PAREN@[30; 31) | ||
39 | R_PAREN@[31; 32) | ||
40 | BLOCK_EXPR@[32; 34) | ||
41 | L_CURLY@[32; 33) | ||
42 | R_CURLY@[33; 34) | ||
43 | WHITESPACE@[34; 35) | ||