aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-08-07 20:00:38 +0100
committerbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-08-07 20:00:38 +0100
commitde4523fae07a2bf0c058d021bd4cfdb53946c4bf (patch)
treeb1ff48fefaeee1ad4109da8dfce1746d4ecf5056
parentfc40e4200347992af5a0242d561bd4a66262503c (diff)
parentd6ab1af0868f176caadeec4e184c282af56d1094 (diff)
Merge #1664
1664: assoc types bounds r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
-rw-r--r--crates/ra_parser/src/grammar/type_args.rs7
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0138_associated_type_bounds.rs1
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0138_associated_type_bounds.txt55
3 files changed, 63 insertions, 0 deletions
diff --git a/crates/ra_parser/src/grammar/type_args.rs b/crates/ra_parser/src/grammar/type_args.rs
index f391b63db..3db08b280 100644
--- a/crates/ra_parser/src/grammar/type_args.rs
+++ b/crates/ra_parser/src/grammar/type_args.rs
@@ -35,6 +35,13 @@ fn type_arg(p: &mut Parser) {
35 p.bump(); 35 p.bump();
36 m.complete(p, LIFETIME_ARG); 36 m.complete(p, LIFETIME_ARG);
37 } 37 }
38 // test associated_type_bounds
39 // fn print_all<T: Iterator<Item: Display>>(printables: T) {}
40 IDENT if p.nth(1) == T![:] => {
41 name_ref(p);
42 type_params::bounds(p);
43 m.complete(p, ASSOC_TYPE_ARG);
44 }
38 IDENT if p.nth(1) == T![=] => { 45 IDENT if p.nth(1) == T![=] => {
39 name_ref(p); 46 name_ref(p);
40 p.bump(); 47 p.bump();
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0138_associated_type_bounds.rs b/crates/ra_syntax/test_data/parser/inline/ok/0138_associated_type_bounds.rs
new file mode 100644
index 000000000..eb21a657b
--- /dev/null
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0138_associated_type_bounds.rs
@@ -0,0 +1 @@
fn print_all<T: Iterator<Item: Display>>(printables: T) {}
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0138_associated_type_bounds.txt b/crates/ra_syntax/test_data/parser/inline/ok/0138_associated_type_bounds.txt
new file mode 100644
index 000000000..33e75510d
--- /dev/null
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0138_associated_type_bounds.txt
@@ -0,0 +1,55 @@
1SOURCE_FILE@[0; 59)
2 FN_DEF@[0; 58)
3 FN_KW@[0; 2) "fn"
4 WHITESPACE@[2; 3) " "
5 NAME@[3; 12)
6 IDENT@[3; 12) "print_all"
7 TYPE_PARAM_LIST@[12; 40)
8 L_ANGLE@[12; 13) "<"
9 TYPE_PARAM@[13; 39)
10 NAME@[13; 14)
11 IDENT@[13; 14) "T"
12 COLON@[14; 15) ":"
13 WHITESPACE@[15; 16) " "
14 TYPE_BOUND_LIST@[16; 39)
15 TYPE_BOUND@[16; 39)
16 PATH_TYPE@[16; 39)
17 PATH@[16; 39)
18 PATH_SEGMENT@[16; 39)
19 NAME_REF@[16; 24)
20 IDENT@[16; 24) "Iterator"
21 TYPE_ARG_LIST@[24; 39)
22 L_ANGLE@[24; 25) "<"
23 ASSOC_TYPE_ARG@[25; 38)
24 NAME_REF@[25; 29)
25 IDENT@[25; 29) "Item"
26 COLON@[29; 30) ":"
27 WHITESPACE@[30; 31) " "
28 TYPE_BOUND_LIST@[31; 38)
29 TYPE_BOUND@[31; 38)
30 PATH_TYPE@[31; 38)
31 PATH@[31; 38)
32 PATH_SEGMENT@[31; 38)
33 NAME_REF@[31; 38)
34 IDENT@[31; 38) "Display"
35 R_ANGLE@[38; 39) ">"
36 R_ANGLE@[39; 40) ">"
37 PARAM_LIST@[40; 55)
38 L_PAREN@[40; 41) "("
39 PARAM@[41; 54)
40 BIND_PAT@[41; 51)
41 NAME@[41; 51)
42 IDENT@[41; 51) "printables"
43 COLON@[51; 52) ":"
44 WHITESPACE@[52; 53) " "
45 PATH_TYPE@[53; 54)
46 PATH@[53; 54)
47 PATH_SEGMENT@[53; 54)
48 NAME_REF@[53; 54)
49 IDENT@[53; 54) "T"
50 R_PAREN@[54; 55) ")"
51 WHITESPACE@[55; 56) " "
52 BLOCK@[56; 58)
53 L_CURLY@[56; 57) "{"
54 R_CURLY@[57; 58) "}"
55 WHITESPACE@[58; 59) "\n"