aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/tests/data/parser/ok/0038_where_pred_type.txt
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-03-31 10:11:48 +0100
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-03-31 10:11:48 +0100
commitc5ca49678f129045e59438df279829902034ec71 (patch)
tree3fd54185e0c064fbd6f718ac345064ce9c559efb /crates/ra_syntax/tests/data/parser/ok/0038_where_pred_type.txt
parent23dd53eb35ff50508d0c0fc5878a55754b12d381 (diff)
parent55dcdb7d094f473c73f87ecf997b24f8e35f2a5e (diff)
Merge #1077
1077: Improve parsing of type bounds r=matklad a=vipentti This adds new TYPE_BOUND_LIST and TYPE_BOUND syntax kinds. These are now used when parsing type bounds. In addition parsing paths inside a bound now does not recursively parse paths, rather they are treated as separate bounds, separated by +. Basically now the generic params `struct S<T: 'a + ?Sized + (Copy)>;` in will be parsed as ``` TYPE_PARAM_LIST@[8; 33) L_ANGLE@[8; 9) TYPE_PARAM@[9; 32) NAME@[9; 10) IDENT@[9; 10) "T" COLON@[10; 11) WHITESPACE@[11; 12) TYPE_BOUND_LIST@[12; 32) TYPE_BOUND@[12; 14) LIFETIME@[12; 14) "'a" WHITESPACE@[14; 15) PLUS@[15; 16) WHITESPACE@[16; 17) TYPE_BOUND@[17; 23) QUESTION@[17; 18) PATH_TYPE@[18; 23) PATH@[18; 23) PATH_SEGMENT@[18; 23) NAME_REF@[18; 23) IDENT@[18; 23) "Sized" WHITESPACE@[23; 24) PLUS@[24; 25) WHITESPACE@[25; 26) TYPE_BOUND@[26; 32) L_PAREN@[26; 27) PATH_TYPE@[27; 31) PATH@[27; 31) PATH_SEGMENT@[27; 31) NAME_REF@[27; 31) IDENT@[27; 31) "Copy" R_PAREN@[31; 32) R_ANGLE@[32; 33) ``` Previously it was parsed, with the paths nested: ``` TYPE_PARAM_LIST@[8; 33) L_ANGLE@[8; 9) TYPE_PARAM@[9; 32) NAME@[9; 10) IDENT@[9; 10) "T" COLON@[10; 11) WHITESPACE@[11; 12) LIFETIME@[12; 14) "'a" WHITESPACE@[14; 15) PLUS@[15; 16) WHITESPACE@[16; 17) QUESTION@[17; 18) PATH_TYPE@[18; 32) PATH@[18; 23) PATH_SEGMENT@[18; 23) NAME_REF@[18; 23) IDENT@[18; 23) "Sized" WHITESPACE@[23; 24) PLUS@[24; 25) WHITESPACE@[25; 26) L_PAREN@[26; 27) PATH_TYPE@[27; 31) PATH@[27; 31) PATH_SEGMENT@[27; 31) NAME_REF@[27; 31) IDENT@[27; 31) "Copy" R_PAREN@[31; 32) R_ANGLE@[32; 33) ``` Looking for feedback. Co-authored-by: Ville Penttinen <[email protected]>
Diffstat (limited to 'crates/ra_syntax/tests/data/parser/ok/0038_where_pred_type.txt')
-rw-r--r--crates/ra_syntax/tests/data/parser/ok/0038_where_pred_type.txt12
1 files changed, 7 insertions, 5 deletions
diff --git a/crates/ra_syntax/tests/data/parser/ok/0038_where_pred_type.txt b/crates/ra_syntax/tests/data/parser/ok/0038_where_pred_type.txt
index 4842e9b90..fe3fca5cd 100644
--- a/crates/ra_syntax/tests/data/parser/ok/0038_where_pred_type.txt
+++ b/crates/ra_syntax/tests/data/parser/ok/0038_where_pred_type.txt
@@ -29,11 +29,13 @@ SOURCE_FILE@[0; 34)
29 R_PAREN@[25; 26) 29 R_PAREN@[25; 26)
30 COLON@[26; 27) 30 COLON@[26; 27)
31 WHITESPACE@[27; 28) 31 WHITESPACE@[27; 28)
32 PATH_TYPE@[28; 31) 32 TYPE_BOUND_LIST@[28; 31)
33 PATH@[28; 31) 33 TYPE_BOUND@[28; 31)
34 PATH_SEGMENT@[28; 31) 34 PATH_TYPE@[28; 31)
35 NAME_REF@[28; 31) 35 PATH@[28; 31)
36 IDENT@[28; 31) "Foo" 36 PATH_SEGMENT@[28; 31)
37 NAME_REF@[28; 31)
38 IDENT@[28; 31) "Foo"
37 WHITESPACE@[31; 32) 39 WHITESPACE@[31; 32)
38 BLOCK@[32; 34) 40 BLOCK@[32; 34)
39 L_CURLY@[32; 33) 41 L_CURLY@[32; 33)