From fb632c747d953d615575850477d4662802be320f Mon Sep 17 00:00:00 2001 From: Avi Dessauer Date: Wed, 3 Jun 2020 15:21:47 -0400 Subject: Parse default unsafe & default const --- .../parser/inline/err/0010_wrong_order_fns.rast | 34 +++++++++++++--------- 1 file changed, 20 insertions(+), 14 deletions(-) (limited to 'crates/ra_syntax/test_data/parser/inline') diff --git a/crates/ra_syntax/test_data/parser/inline/err/0010_wrong_order_fns.rast b/crates/ra_syntax/test_data/parser/inline/err/0010_wrong_order_fns.rast index 9be441110..53f7ebaf9 100644 --- a/crates/ra_syntax/test_data/parser/inline/err/0010_wrong_order_fns.rast +++ b/crates/ra_syntax/test_data/parser/inline/err/0010_wrong_order_fns.rast @@ -17,23 +17,29 @@ SOURCE_FILE@0..50 L_CURLY@22..23 "{" R_CURLY@23..24 "}" WHITESPACE@24..25 "\n" - ERROR@25..31 + CONST_DEF@25..46 UNSAFE_KW@25..31 "unsafe" - WHITESPACE@31..32 " " - FN_DEF@32..49 + WHITESPACE@31..32 " " CONST_KW@32..37 "const" WHITESPACE@37..38 " " - FN_KW@38..40 "fn" + ERROR@38..40 + FN_KW@38..40 "fn" WHITESPACE@40..41 " " - NAME@41..44 - IDENT@41..44 "bar" - PARAM_LIST@44..46 - L_PAREN@44..45 "(" - R_PAREN@45..46 ")" - WHITESPACE@46..47 " " - BLOCK_EXPR@47..49 - L_CURLY@47..48 "{" - R_CURLY@48..49 "}" + PATH_TYPE@41..46 + PATH@41..46 + PATH_SEGMENT@41..46 + NAME_REF@41..44 + IDENT@41..44 "bar" + PARAM_LIST@44..46 + L_PAREN@44..45 "(" + R_PAREN@45..46 ")" + WHITESPACE@46..47 " " + ERROR@47..49 + L_CURLY@47..48 "{" + R_CURLY@48..49 "}" WHITESPACE@49..50 "\n" error 6..6: expected existential, fn, trait or impl -error 31..31: expected existential, fn, trait or impl +error 38..38: expected a name +error 40..40: expected COLON +error 46..46: expected SEMICOLON +error 47..47: expected an item -- cgit v1.2.3 From a5588b9e19cbbc18b1afd9afcc9bab2bce2b711c Mon Sep 17 00:00:00 2001 From: Avi Dessauer Date: Wed, 3 Jun 2020 20:39:57 -0400 Subject: Update tests --- .../parser/inline/err/0015_default_const.rast | 40 ++++++++++++++++++++ .../parser/inline/err/0015_default_const.rs | 3 ++ .../parser/inline/ok/0162_default_const.rast | 44 ++++++++++++++++++++++ .../parser/inline/ok/0162_default_const.rs | 3 ++ .../parser/inline/ok/0163_default_unsafe_impl.rast | 18 +++++++++ .../parser/inline/ok/0163_default_unsafe_impl.rs | 1 + 6 files changed, 109 insertions(+) create mode 100644 crates/ra_syntax/test_data/parser/inline/err/0015_default_const.rast create mode 100644 crates/ra_syntax/test_data/parser/inline/err/0015_default_const.rs create mode 100644 crates/ra_syntax/test_data/parser/inline/ok/0162_default_const.rast create mode 100644 crates/ra_syntax/test_data/parser/inline/ok/0162_default_const.rs create mode 100644 crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_impl.rast create mode 100644 crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_impl.rs (limited to 'crates/ra_syntax/test_data/parser/inline') diff --git a/crates/ra_syntax/test_data/parser/inline/err/0015_default_const.rast b/crates/ra_syntax/test_data/parser/inline/err/0015_default_const.rast new file mode 100644 index 000000000..8eb583ef8 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/err/0015_default_const.rast @@ -0,0 +1,40 @@ +SOURCE_FILE@0..39 + TRAIT_DEF@0..38 + TRAIT_KW@0..5 "trait" + WHITESPACE@5..6 " " + NAME@6..7 + IDENT@6..7 "T" + WHITESPACE@7..8 " " + ITEM_LIST@8..38 + L_CURLY@8..9 "{" + WHITESPACE@9..12 "\n " + MACRO_CALL@12..19 + PATH@12..19 + PATH_SEGMENT@12..19 + NAME_REF@12..19 + IDENT@12..19 "default" + WHITESPACE@19..20 " " + CONST_DEF@20..36 + CONST_KW@20..25 "const" + WHITESPACE@25..26 " " + NAME@26..27 + IDENT@26..27 "f" + COLON@27..28 ":" + WHITESPACE@28..29 " " + PATH_TYPE@29..31 + PATH@29..31 + PATH_SEGMENT@29..31 + NAME_REF@29..31 + IDENT@29..31 "u8" + WHITESPACE@31..32 " " + EQ@32..33 "=" + WHITESPACE@33..34 " " + LITERAL@34..35 + INT_NUMBER@34..35 "0" + SEMICOLON@35..36 ";" + WHITESPACE@36..37 "\n" + R_CURLY@37..38 "}" + WHITESPACE@38..39 "\n" +error 19..19: expected BANG +error 19..19: expected `{`, `[`, `(` +error 19..19: expected SEMICOLON diff --git a/crates/ra_syntax/test_data/parser/inline/err/0015_default_const.rs b/crates/ra_syntax/test_data/parser/inline/err/0015_default_const.rs new file mode 100644 index 000000000..80f15474a --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/err/0015_default_const.rs @@ -0,0 +1,3 @@ +trait T { + default const f: u8 = 0; +} diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0162_default_const.rast b/crates/ra_syntax/test_data/parser/inline/ok/0162_default_const.rast new file mode 100644 index 000000000..dab0247ee --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/ok/0162_default_const.rast @@ -0,0 +1,44 @@ +SOURCE_FILE@0..46 + IMPL_DEF@0..45 + IMPL_KW@0..4 "impl" + WHITESPACE@4..5 " " + PATH_TYPE@5..6 + PATH@5..6 + PATH_SEGMENT@5..6 + NAME_REF@5..6 + IDENT@5..6 "T" + WHITESPACE@6..7 " " + FOR_KW@7..10 "for" + WHITESPACE@10..11 " " + PATH_TYPE@11..14 + PATH@11..14 + PATH_SEGMENT@11..14 + NAME_REF@11..14 + IDENT@11..14 "Foo" + WHITESPACE@14..15 " " + ITEM_LIST@15..45 + L_CURLY@15..16 "{" + WHITESPACE@16..19 "\n " + CONST_DEF@19..43 + DEFAULT_KW@19..26 "default" + WHITESPACE@26..27 " " + CONST_KW@27..32 "const" + WHITESPACE@32..33 " " + NAME@33..34 + IDENT@33..34 "f" + COLON@34..35 ":" + WHITESPACE@35..36 " " + PATH_TYPE@36..38 + PATH@36..38 + PATH_SEGMENT@36..38 + NAME_REF@36..38 + IDENT@36..38 "u8" + WHITESPACE@38..39 " " + EQ@39..40 "=" + WHITESPACE@40..41 " " + LITERAL@41..42 + INT_NUMBER@41..42 "0" + SEMICOLON@42..43 ";" + WHITESPACE@43..44 "\n" + R_CURLY@44..45 "}" + WHITESPACE@45..46 "\n" diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0162_default_const.rs b/crates/ra_syntax/test_data/parser/inline/ok/0162_default_const.rs new file mode 100644 index 000000000..dfb3b92dc --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/ok/0162_default_const.rs @@ -0,0 +1,3 @@ +impl T for Foo { + default const f: u8 = 0; +} diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_impl.rast b/crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_impl.rast new file mode 100644 index 000000000..a9eda5668 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_impl.rast @@ -0,0 +1,18 @@ +SOURCE_FILE@0..27 + IMPL_DEF@0..26 + DEFAULT_KW@0..7 "default" + WHITESPACE@7..8 " " + UNSAFE_KW@8..14 "unsafe" + WHITESPACE@14..15 " " + IMPL_KW@15..19 "impl" + WHITESPACE@19..20 " " + PATH_TYPE@20..23 + PATH@20..23 + PATH_SEGMENT@20..23 + NAME_REF@20..23 + IDENT@20..23 "Foo" + WHITESPACE@23..24 " " + ITEM_LIST@24..26 + L_CURLY@24..25 "{" + R_CURLY@25..26 "}" + WHITESPACE@26..27 "\n" diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_impl.rs b/crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_impl.rs new file mode 100644 index 000000000..ba0998ff4 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_impl.rs @@ -0,0 +1 @@ +default unsafe impl Foo {} -- cgit v1.2.3 From c4fd46398132a409d7947141094d7301c0f0af73 Mon Sep 17 00:00:00 2001 From: Avi Dessauer Date: Thu, 4 Jun 2020 13:06:26 -0400 Subject: Move default const test out of line --- .../parser/inline/err/0015_default_const.rast | 40 -------------------- .../parser/inline/err/0015_default_const.rs | 3 -- .../parser/inline/ok/0162_default_const.rast | 44 ---------------------- .../parser/inline/ok/0162_default_const.rs | 3 -- 4 files changed, 90 deletions(-) delete mode 100644 crates/ra_syntax/test_data/parser/inline/err/0015_default_const.rast delete mode 100644 crates/ra_syntax/test_data/parser/inline/err/0015_default_const.rs delete mode 100644 crates/ra_syntax/test_data/parser/inline/ok/0162_default_const.rast delete mode 100644 crates/ra_syntax/test_data/parser/inline/ok/0162_default_const.rs (limited to 'crates/ra_syntax/test_data/parser/inline') diff --git a/crates/ra_syntax/test_data/parser/inline/err/0015_default_const.rast b/crates/ra_syntax/test_data/parser/inline/err/0015_default_const.rast deleted file mode 100644 index 8eb583ef8..000000000 --- a/crates/ra_syntax/test_data/parser/inline/err/0015_default_const.rast +++ /dev/null @@ -1,40 +0,0 @@ -SOURCE_FILE@0..39 - TRAIT_DEF@0..38 - TRAIT_KW@0..5 "trait" - WHITESPACE@5..6 " " - NAME@6..7 - IDENT@6..7 "T" - WHITESPACE@7..8 " " - ITEM_LIST@8..38 - L_CURLY@8..9 "{" - WHITESPACE@9..12 "\n " - MACRO_CALL@12..19 - PATH@12..19 - PATH_SEGMENT@12..19 - NAME_REF@12..19 - IDENT@12..19 "default" - WHITESPACE@19..20 " " - CONST_DEF@20..36 - CONST_KW@20..25 "const" - WHITESPACE@25..26 " " - NAME@26..27 - IDENT@26..27 "f" - COLON@27..28 ":" - WHITESPACE@28..29 " " - PATH_TYPE@29..31 - PATH@29..31 - PATH_SEGMENT@29..31 - NAME_REF@29..31 - IDENT@29..31 "u8" - WHITESPACE@31..32 " " - EQ@32..33 "=" - WHITESPACE@33..34 " " - LITERAL@34..35 - INT_NUMBER@34..35 "0" - SEMICOLON@35..36 ";" - WHITESPACE@36..37 "\n" - R_CURLY@37..38 "}" - WHITESPACE@38..39 "\n" -error 19..19: expected BANG -error 19..19: expected `{`, `[`, `(` -error 19..19: expected SEMICOLON diff --git a/crates/ra_syntax/test_data/parser/inline/err/0015_default_const.rs b/crates/ra_syntax/test_data/parser/inline/err/0015_default_const.rs deleted file mode 100644 index 80f15474a..000000000 --- a/crates/ra_syntax/test_data/parser/inline/err/0015_default_const.rs +++ /dev/null @@ -1,3 +0,0 @@ -trait T { - default const f: u8 = 0; -} diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0162_default_const.rast b/crates/ra_syntax/test_data/parser/inline/ok/0162_default_const.rast deleted file mode 100644 index dab0247ee..000000000 --- a/crates/ra_syntax/test_data/parser/inline/ok/0162_default_const.rast +++ /dev/null @@ -1,44 +0,0 @@ -SOURCE_FILE@0..46 - IMPL_DEF@0..45 - IMPL_KW@0..4 "impl" - WHITESPACE@4..5 " " - PATH_TYPE@5..6 - PATH@5..6 - PATH_SEGMENT@5..6 - NAME_REF@5..6 - IDENT@5..6 "T" - WHITESPACE@6..7 " " - FOR_KW@7..10 "for" - WHITESPACE@10..11 " " - PATH_TYPE@11..14 - PATH@11..14 - PATH_SEGMENT@11..14 - NAME_REF@11..14 - IDENT@11..14 "Foo" - WHITESPACE@14..15 " " - ITEM_LIST@15..45 - L_CURLY@15..16 "{" - WHITESPACE@16..19 "\n " - CONST_DEF@19..43 - DEFAULT_KW@19..26 "default" - WHITESPACE@26..27 " " - CONST_KW@27..32 "const" - WHITESPACE@32..33 " " - NAME@33..34 - IDENT@33..34 "f" - COLON@34..35 ":" - WHITESPACE@35..36 " " - PATH_TYPE@36..38 - PATH@36..38 - PATH_SEGMENT@36..38 - NAME_REF@36..38 - IDENT@36..38 "u8" - WHITESPACE@38..39 " " - EQ@39..40 "=" - WHITESPACE@40..41 " " - LITERAL@41..42 - INT_NUMBER@41..42 "0" - SEMICOLON@42..43 ";" - WHITESPACE@43..44 "\n" - R_CURLY@44..45 "}" - WHITESPACE@45..46 "\n" diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0162_default_const.rs b/crates/ra_syntax/test_data/parser/inline/ok/0162_default_const.rs deleted file mode 100644 index dfb3b92dc..000000000 --- a/crates/ra_syntax/test_data/parser/inline/ok/0162_default_const.rs +++ /dev/null @@ -1,3 +0,0 @@ -impl T for Foo { - default const f: u8 = 0; -} -- cgit v1.2.3 From e38685cb48a44c3321922f5f7228072b503d2973 Mon Sep 17 00:00:00 2001 From: Avi Dessauer Date: Mon, 8 Jun 2020 17:49:06 -0400 Subject: Parse default unsafe fn --- .../parser/inline/ok/0163_default_unsafe_fn.rast | 40 ++++++++++++++++++++++ .../parser/inline/ok/0163_default_unsafe_fn.rs | 3 ++ 2 files changed, 43 insertions(+) create mode 100644 crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_fn.rast create mode 100644 crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_fn.rs (limited to 'crates/ra_syntax/test_data/parser/inline') diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_fn.rast b/crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_fn.rast new file mode 100644 index 000000000..adb6159f4 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_fn.rast @@ -0,0 +1,40 @@ +SOURCE_FILE@0..50 + IMPL_DEF@0..49 + IMPL_KW@0..4 "impl" + WHITESPACE@4..5 " " + PATH_TYPE@5..6 + PATH@5..6 + PATH_SEGMENT@5..6 + NAME_REF@5..6 + IDENT@5..6 "T" + WHITESPACE@6..7 " " + FOR_KW@7..10 "for" + WHITESPACE@10..11 " " + PATH_TYPE@11..14 + PATH@11..14 + PATH_SEGMENT@11..14 + NAME_REF@11..14 + IDENT@11..14 "Foo" + WHITESPACE@14..15 " " + ITEM_LIST@15..49 + L_CURLY@15..16 "{" + WHITESPACE@16..21 "\n " + FN_DEF@21..47 + DEFAULT_KW@21..28 "default" + WHITESPACE@28..29 " " + UNSAFE_KW@29..35 "unsafe" + WHITESPACE@35..36 " " + FN_KW@36..38 "fn" + WHITESPACE@38..39 " " + NAME@39..42 + IDENT@39..42 "foo" + PARAM_LIST@42..44 + L_PAREN@42..43 "(" + R_PAREN@43..44 ")" + WHITESPACE@44..45 " " + BLOCK_EXPR@45..47 + L_CURLY@45..46 "{" + R_CURLY@46..47 "}" + WHITESPACE@47..48 "\n" + R_CURLY@48..49 "}" + WHITESPACE@49..50 "\n" diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_fn.rs b/crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_fn.rs new file mode 100644 index 000000000..12926cd8a --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_fn.rs @@ -0,0 +1,3 @@ +impl T for Foo { + default unsafe fn foo() {} +} -- cgit v1.2.3 From e8d50578ab2702ff5f0955285c979c6923f14f80 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 9 Jun 2020 13:45:18 +0200 Subject: Correctly parse <_> paths in patterns closes #3659 --- .../inline/ok/0164_type_path_in_pattern.rast | 38 ++++++++++++++++++++++ .../parser/inline/ok/0164_type_path_in_pattern.rs | 1 + 2 files changed, 39 insertions(+) create mode 100644 crates/ra_syntax/test_data/parser/inline/ok/0164_type_path_in_pattern.rast create mode 100644 crates/ra_syntax/test_data/parser/inline/ok/0164_type_path_in_pattern.rs (limited to 'crates/ra_syntax/test_data/parser/inline') diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0164_type_path_in_pattern.rast b/crates/ra_syntax/test_data/parser/inline/ok/0164_type_path_in_pattern.rast new file mode 100644 index 000000000..868899275 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/ok/0164_type_path_in_pattern.rast @@ -0,0 +1,38 @@ +SOURCE_FILE@0..33 + FN_DEF@0..32 + FN_KW@0..2 "fn" + WHITESPACE@2..3 " " + NAME@3..7 + IDENT@3..7 "main" + PARAM_LIST@7..9 + L_PAREN@7..8 "(" + R_PAREN@8..9 ")" + WHITESPACE@9..10 " " + BLOCK_EXPR@10..32 + L_CURLY@10..11 "{" + WHITESPACE@11..12 " " + LET_STMT@12..30 + LET_KW@12..15 "let" + WHITESPACE@15..16 " " + PATH_PAT@16..24 + PATH@16..24 + PATH@16..19 + PATH_SEGMENT@16..19 + L_ANGLE@16..17 "<" + PLACEHOLDER_TYPE@17..18 + UNDERSCORE@17..18 "_" + R_ANGLE@18..19 ">" + COLON2@19..21 "::" + PATH_SEGMENT@21..24 + NAME_REF@21..24 + IDENT@21..24 "Foo" + WHITESPACE@24..25 " " + EQ@25..26 "=" + WHITESPACE@26..27 " " + TUPLE_EXPR@27..29 + L_PAREN@27..28 "(" + R_PAREN@28..29 ")" + SEMICOLON@29..30 ";" + WHITESPACE@30..31 " " + R_CURLY@31..32 "}" + WHITESPACE@32..33 "\n" diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0164_type_path_in_pattern.rs b/crates/ra_syntax/test_data/parser/inline/ok/0164_type_path_in_pattern.rs new file mode 100644 index 000000000..ebe26834d --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/ok/0164_type_path_in_pattern.rs @@ -0,0 +1 @@ +fn main() { let <_>::Foo = (); } -- cgit v1.2.3 From 506e1ddbfa5213f254923da9bbf0efddc6f1fc34 Mon Sep 17 00:00:00 2001 From: Matthew Jasper Date: Wed, 10 Jun 2020 11:30:48 +0100 Subject: Separating parsing of `for` in predicates and types --- .../parser/inline/ok/0003_where_pred_for.rast | 367 +++++++++++++++++---- .../parser/inline/ok/0003_where_pred_for.rs | 18 +- .../test_data/parser/inline/ok/0081_for_type.rast | 256 +++----------- .../test_data/parser/inline/ok/0081_for_type.rs | 4 +- 4 files changed, 372 insertions(+), 273 deletions(-) (limited to 'crates/ra_syntax/test_data/parser/inline') diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0003_where_pred_for.rast b/crates/ra_syntax/test_data/parser/inline/ok/0003_where_pred_for.rast index 9dc473e43..4f88bfe43 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0003_where_pred_for.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0003_where_pred_for.rast @@ -1,61 +1,310 @@ -SOURCE_FILE@0..49 - FN_DEF@0..48 +SOURCE_FILE@0..292 + FN_DEF@0..53 FN_KW@0..2 "fn" WHITESPACE@2..3 " " - NAME@3..7 - IDENT@3..7 "test" - TYPE_PARAM_LIST@7..10 - L_ANGLE@7..8 "<" - TYPE_PARAM@8..9 - NAME@8..9 - IDENT@8..9 "F" - R_ANGLE@9..10 ">" - PARAM_LIST@10..12 - L_PAREN@10..11 "(" - R_PAREN@11..12 ")" - WHITESPACE@12..13 "\n" - WHERE_CLAUSE@13..44 - WHERE_KW@13..18 "where" - WHITESPACE@18..22 "\n " - WHERE_PRED@22..44 - FOR_TYPE@22..31 - FOR_KW@22..25 "for" - TYPE_PARAM_LIST@25..29 - L_ANGLE@25..26 "<" - LIFETIME_PARAM@26..28 - LIFETIME@26..28 "\'a" - R_ANGLE@28..29 ">" - WHITESPACE@29..30 " " - PATH_TYPE@30..31 - PATH@30..31 - PATH_SEGMENT@30..31 - NAME_REF@30..31 - IDENT@30..31 "F" - COLON@31..32 ":" - WHITESPACE@32..33 " " - TYPE_BOUND_LIST@33..44 - TYPE_BOUND@33..44 - PATH_TYPE@33..44 - PATH@33..44 - PATH_SEGMENT@33..44 - NAME_REF@33..35 - IDENT@33..35 "Fn" - PARAM_LIST@35..44 - L_PAREN@35..36 "(" - PARAM@36..43 - REFERENCE_TYPE@36..43 - AMP@36..37 "&" - LIFETIME@37..39 "\'a" - WHITESPACE@39..40 " " - PATH_TYPE@40..43 - PATH@40..43 - PATH_SEGMENT@40..43 - NAME_REF@40..43 - IDENT@40..43 "str" - R_PAREN@43..44 ")" - WHITESPACE@44..45 "\n" - BLOCK_EXPR@45..48 - L_CURLY@45..46 "{" - WHITESPACE@46..47 " " - R_CURLY@47..48 "}" - WHITESPACE@48..49 "\n" + NAME@3..12 + IDENT@3..12 "for_trait" + TYPE_PARAM_LIST@12..15 + L_ANGLE@12..13 "<" + TYPE_PARAM@13..14 + NAME@13..14 + IDENT@13..14 "F" + R_ANGLE@14..15 ">" + PARAM_LIST@15..17 + L_PAREN@15..16 "(" + R_PAREN@16..17 ")" + WHITESPACE@17..18 "\n" + WHERE_CLAUSE@18..49 + WHERE_KW@18..23 "where" + WHITESPACE@23..27 "\n " + WHERE_PRED@27..49 + FOR_KW@27..30 "for" + TYPE_PARAM_LIST@30..34 + L_ANGLE@30..31 "<" + LIFETIME_PARAM@31..33 + LIFETIME@31..33 "\'a" + R_ANGLE@33..34 ">" + WHITESPACE@34..35 " " + PATH_TYPE@35..36 + PATH@35..36 + PATH_SEGMENT@35..36 + NAME_REF@35..36 + IDENT@35..36 "F" + COLON@36..37 ":" + WHITESPACE@37..38 " " + TYPE_BOUND_LIST@38..49 + TYPE_BOUND@38..49 + PATH_TYPE@38..49 + PATH@38..49 + PATH_SEGMENT@38..49 + NAME_REF@38..40 + IDENT@38..40 "Fn" + PARAM_LIST@40..49 + L_PAREN@40..41 "(" + PARAM@41..48 + REFERENCE_TYPE@41..48 + AMP@41..42 "&" + LIFETIME@42..44 "\'a" + WHITESPACE@44..45 " " + PATH_TYPE@45..48 + PATH@45..48 + PATH_SEGMENT@45..48 + NAME_REF@45..48 + IDENT@45..48 "str" + R_PAREN@48..49 ")" + WHITESPACE@49..50 "\n" + BLOCK_EXPR@50..53 + L_CURLY@50..51 "{" + WHITESPACE@51..52 " " + R_CURLY@52..53 "}" + WHITESPACE@53..54 "\n" + FN_DEF@54..103 + FN_KW@54..56 "fn" + WHITESPACE@56..57 " " + NAME@57..64 + IDENT@57..64 "for_ref" + TYPE_PARAM_LIST@64..67 + L_ANGLE@64..65 "<" + TYPE_PARAM@65..66 + NAME@65..66 + IDENT@65..66 "F" + R_ANGLE@66..67 ">" + PARAM_LIST@67..69 + L_PAREN@67..68 "(" + R_PAREN@68..69 ")" + WHITESPACE@69..70 "\n" + WHERE_CLAUSE@70..99 + WHERE_KW@70..75 "where" + WHITESPACE@75..79 "\n " + WHERE_PRED@79..99 + FOR_KW@79..82 "for" + TYPE_PARAM_LIST@82..86 + L_ANGLE@82..83 "<" + LIFETIME_PARAM@83..85 + LIFETIME@83..85 "\'a" + R_ANGLE@85..86 ">" + WHITESPACE@86..87 " " + REFERENCE_TYPE@87..92 + AMP@87..88 "&" + LIFETIME@88..90 "\'a" + WHITESPACE@90..91 " " + PATH_TYPE@91..92 + PATH@91..92 + PATH_SEGMENT@91..92 + NAME_REF@91..92 + IDENT@91..92 "F" + COLON@92..93 ":" + WHITESPACE@93..94 " " + TYPE_BOUND_LIST@94..99 + TYPE_BOUND@94..99 + PATH_TYPE@94..99 + PATH@94..99 + PATH_SEGMENT@94..99 + NAME_REF@94..99 + IDENT@94..99 "Debug" + WHITESPACE@99..100 "\n" + BLOCK_EXPR@100..103 + L_CURLY@100..101 "{" + WHITESPACE@101..102 " " + R_CURLY@102..103 "}" + WHITESPACE@103..104 "\n" + FN_DEF@104..164 + FN_KW@104..106 "fn" + WHITESPACE@106..107 " " + NAME@107..117 + IDENT@107..117 "for_parens" + TYPE_PARAM_LIST@117..120 + L_ANGLE@117..118 "<" + TYPE_PARAM@118..119 + NAME@118..119 + IDENT@118..119 "F" + R_ANGLE@119..120 ">" + PARAM_LIST@120..122 + L_PAREN@120..121 "(" + R_PAREN@121..122 ")" + WHITESPACE@122..123 "\n" + WHERE_CLAUSE@123..160 + WHERE_KW@123..128 "where" + WHITESPACE@128..132 "\n " + WHERE_PRED@132..160 + FOR_KW@132..135 "for" + TYPE_PARAM_LIST@135..139 + L_ANGLE@135..136 "<" + LIFETIME_PARAM@136..138 + LIFETIME@136..138 "\'a" + R_ANGLE@138..139 ">" + WHITESPACE@139..140 " " + PAREN_TYPE@140..147 + L_PAREN@140..141 "(" + REFERENCE_TYPE@141..146 + AMP@141..142 "&" + LIFETIME@142..144 "\'a" + WHITESPACE@144..145 " " + PATH_TYPE@145..146 + PATH@145..146 + PATH_SEGMENT@145..146 + NAME_REF@145..146 + IDENT@145..146 "F" + R_PAREN@146..147 ")" + COLON@147..148 ":" + WHITESPACE@148..149 " " + TYPE_BOUND_LIST@149..160 + TYPE_BOUND@149..160 + PATH_TYPE@149..160 + PATH@149..160 + PATH_SEGMENT@149..160 + NAME_REF@149..151 + IDENT@149..151 "Fn" + PARAM_LIST@151..160 + L_PAREN@151..152 "(" + PARAM@152..159 + REFERENCE_TYPE@152..159 + AMP@152..153 "&" + LIFETIME@153..155 "\'a" + WHITESPACE@155..156 " " + PATH_TYPE@156..159 + PATH@156..159 + PATH_SEGMENT@156..159 + NAME_REF@156..159 + IDENT@156..159 "str" + R_PAREN@159..160 ")" + WHITESPACE@160..161 "\n" + BLOCK_EXPR@161..164 + L_CURLY@161..162 "{" + WHITESPACE@162..163 " " + R_CURLY@163..164 "}" + WHITESPACE@164..165 "\n" + FN_DEF@165..215 + FN_KW@165..167 "fn" + WHITESPACE@167..168 " " + NAME@168..177 + IDENT@168..177 "for_slice" + TYPE_PARAM_LIST@177..180 + L_ANGLE@177..178 "<" + TYPE_PARAM@178..179 + NAME@178..179 + IDENT@178..179 "F" + R_ANGLE@179..180 ">" + PARAM_LIST@180..182 + L_PAREN@180..181 "(" + R_PAREN@181..182 ")" + WHITESPACE@182..183 "\n" + WHERE_CLAUSE@183..211 + WHERE_KW@183..188 "where" + WHITESPACE@188..192 "\n " + WHERE_PRED@192..211 + FOR_KW@192..195 "for" + TYPE_PARAM_LIST@195..199 + L_ANGLE@195..196 "<" + LIFETIME_PARAM@196..198 + LIFETIME@196..198 "\'a" + R_ANGLE@198..199 ">" + WHITESPACE@199..200 " " + SLICE_TYPE@200..207 + L_BRACK@200..201 "[" + REFERENCE_TYPE@201..206 + AMP@201..202 "&" + LIFETIME@202..204 "\'a" + WHITESPACE@204..205 " " + PATH_TYPE@205..206 + PATH@205..206 + PATH_SEGMENT@205..206 + NAME_REF@205..206 + IDENT@205..206 "F" + R_BRACK@206..207 "]" + COLON@207..208 ":" + WHITESPACE@208..209 " " + TYPE_BOUND_LIST@209..211 + TYPE_BOUND@209..211 + PATH_TYPE@209..211 + PATH@209..211 + PATH_SEGMENT@209..211 + NAME_REF@209..211 + IDENT@209..211 "Eq" + WHITESPACE@211..212 "\n" + BLOCK_EXPR@212..215 + L_CURLY@212..213 "{" + WHITESPACE@213..214 " " + R_CURLY@214..215 "}" + WHITESPACE@215..216 "\n" + FN_DEF@216..291 + FN_KW@216..218 "fn" + WHITESPACE@218..219 " " + NAME@219..228 + IDENT@219..228 "for_qpath" + TYPE_PARAM_LIST@228..231 + L_ANGLE@228..229 "<" + TYPE_PARAM@229..230 + NAME@229..230 + IDENT@229..230 "T" + R_ANGLE@230..231 ">" + PARAM_LIST@231..239 + L_PAREN@231..232 "(" + PARAM@232..238 + BIND_PAT@232..234 + NAME@232..234 + IDENT@232..234 "_t" + COLON@234..235 ":" + WHITESPACE@235..236 " " + REFERENCE_TYPE@236..238 + AMP@236..237 "&" + PATH_TYPE@237..238 + PATH@237..238 + PATH_SEGMENT@237..238 + NAME_REF@237..238 + IDENT@237..238 "T" + R_PAREN@238..239 ")" + WHITESPACE@239..240 "\n" + WHERE_CLAUSE@240..287 + WHERE_KW@240..245 "where" + WHITESPACE@245..250 "\n " + WHERE_PRED@250..287 + FOR_KW@250..253 "for" + TYPE_PARAM_LIST@253..257 + L_ANGLE@253..254 "<" + LIFETIME_PARAM@254..256 + LIFETIME@254..256 "\'a" + R_ANGLE@256..257 ">" + WHITESPACE@257..258 " " + PATH_TYPE@258..277 + PATH@258..277 + PATH@258..272 + PATH_SEGMENT@258..272 + L_ANGLE@258..259 "<" + REFERENCE_TYPE@259..264 + AMP@259..260 "&" + LIFETIME@260..262 "\'a" + WHITESPACE@262..263 " " + PATH_TYPE@263..264 + PATH@263..264 + PATH_SEGMENT@263..264 + NAME_REF@263..264 + IDENT@263..264 "T" + WHITESPACE@264..265 " " + AS_KW@265..267 "as" + WHITESPACE@267..268 " " + PATH_TYPE@268..271 + PATH@268..271 + PATH_SEGMENT@268..271 + NAME_REF@268..271 + IDENT@268..271 "Baz" + R_ANGLE@271..272 ">" + COLON2@272..274 "::" + PATH_SEGMENT@274..277 + NAME_REF@274..277 + IDENT@274..277 "Foo" + COLON@277..278 ":" + WHITESPACE@278..279 " " + TYPE_BOUND_LIST@279..287 + TYPE_BOUND@279..287 + PATH_TYPE@279..287 + PATH@279..287 + PATH_SEGMENT@279..287 + NAME_REF@279..287 + IDENT@279..287 "Iterator" + WHITESPACE@287..288 "\n" + BLOCK_EXPR@288..291 + L_CURLY@288..289 "{" + WHITESPACE@289..290 " " + R_CURLY@290..291 "}" + WHITESPACE@291..292 "\n" diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0003_where_pred_for.rs b/crates/ra_syntax/test_data/parser/inline/ok/0003_where_pred_for.rs index b448c6178..2d47596be 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0003_where_pred_for.rs +++ b/crates/ra_syntax/test_data/parser/inline/ok/0003_where_pred_for.rs @@ -1,4 +1,20 @@ -fn test() +fn for_trait() where for<'a> F: Fn(&'a str) { } +fn for_ref() +where + for<'a> &'a F: Debug +{ } +fn for_parens() +where + for<'a> (&'a F): Fn(&'a str) +{ } +fn for_slice() +where + for<'a> [&'a F]: Eq +{ } +fn for_qpath(_t: &T) +where + for<'a> <&'a T as Baz>::Foo: Iterator +{ } diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rast index dfb8d57ad..26a80017a 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rast @@ -1,4 +1,4 @@ -SOURCE_FILE@0..200 +SOURCE_FILE@0..82 TYPE_ALIAS_DEF@0..28 TYPE_KW@0..4 "type" WHITESPACE@4..5 " " @@ -29,212 +29,48 @@ SOURCE_FILE@0..200 R_PAREN@26..27 ")" SEMICOLON@27..28 ";" WHITESPACE@28..29 "\n" - FN_DEF@29..79 - FN_KW@29..31 "fn" - WHITESPACE@31..32 " " - NAME@32..35 - IDENT@32..35 "foo" - TYPE_PARAM_LIST@35..38 - L_ANGLE@35..36 "<" - TYPE_PARAM@36..37 - NAME@36..37 - IDENT@36..37 "T" - R_ANGLE@37..38 ">" - PARAM_LIST@38..46 - L_PAREN@38..39 "(" - PARAM@39..45 - BIND_PAT@39..41 - NAME@39..41 - IDENT@39..41 "_t" - COLON@41..42 ":" - WHITESPACE@42..43 " " - REFERENCE_TYPE@43..45 - AMP@43..44 "&" - PATH_TYPE@44..45 - PATH@44..45 - PATH_SEGMENT@44..45 - NAME_REF@44..45 - IDENT@44..45 "T" - R_PAREN@45..46 ")" - WHITESPACE@46..47 " " - WHERE_CLAUSE@47..76 - WHERE_KW@47..52 "where" - WHITESPACE@52..53 " " - WHERE_PRED@53..76 - FOR_TYPE@53..66 - FOR_KW@53..56 "for" - TYPE_PARAM_LIST@56..60 - L_ANGLE@56..57 "<" - LIFETIME_PARAM@57..59 - LIFETIME@57..59 "\'a" - R_ANGLE@59..60 ">" - WHITESPACE@60..61 " " - REFERENCE_TYPE@61..66 - AMP@61..62 "&" - LIFETIME@62..64 "\'a" - WHITESPACE@64..65 " " - PATH_TYPE@65..66 - PATH@65..66 - PATH_SEGMENT@65..66 - NAME_REF@65..66 - IDENT@65..66 "T" - COLON@66..67 ":" - WHITESPACE@67..68 " " - TYPE_BOUND_LIST@68..76 - TYPE_BOUND@68..76 - PATH_TYPE@68..76 - PATH@68..76 - PATH_SEGMENT@68..76 - NAME_REF@68..76 - IDENT@68..76 "Iterator" - WHITESPACE@76..77 " " - BLOCK_EXPR@77..79 - L_CURLY@77..78 "{" - R_CURLY@78..79 "}" - WHITESPACE@79..80 "\n" - FN_DEF@80..134 - FN_KW@80..82 "fn" - WHITESPACE@82..83 " " - NAME@83..86 - IDENT@83..86 "bar" - TYPE_PARAM_LIST@86..89 - L_ANGLE@86..87 "<" - TYPE_PARAM@87..88 - NAME@87..88 - IDENT@87..88 "T" - R_ANGLE@88..89 ">" - PARAM_LIST@89..97 - L_PAREN@89..90 "(" - PARAM@90..96 - BIND_PAT@90..92 - NAME@90..92 - IDENT@90..92 "_t" - COLON@92..93 ":" - WHITESPACE@93..94 " " - REFERENCE_TYPE@94..96 - AMP@94..95 "&" - PATH_TYPE@95..96 - PATH@95..96 - PATH_SEGMENT@95..96 - NAME_REF@95..96 - IDENT@95..96 "T" - R_PAREN@96..97 ")" - WHITESPACE@97..98 " " - WHERE_CLAUSE@98..131 - WHERE_KW@98..103 "where" - WHITESPACE@103..104 " " - WHERE_PRED@104..131 - FOR_TYPE@104..121 - FOR_KW@104..107 "for" - TYPE_PARAM_LIST@107..111 - L_ANGLE@107..108 "<" - LIFETIME_PARAM@108..110 - LIFETIME@108..110 "\'a" - R_ANGLE@110..111 ">" - WHITESPACE@111..112 " " - REFERENCE_TYPE@112..121 - AMP@112..113 "&" - LIFETIME@113..115 "\'a" - WHITESPACE@115..116 " " - MUT_KW@116..119 "mut" - WHITESPACE@119..120 " " - PATH_TYPE@120..121 - PATH@120..121 - PATH_SEGMENT@120..121 - NAME_REF@120..121 - IDENT@120..121 "T" - COLON@121..122 ":" - WHITESPACE@122..123 " " - TYPE_BOUND_LIST@123..131 - TYPE_BOUND@123..131 - PATH_TYPE@123..131 - PATH@123..131 - PATH_SEGMENT@123..131 - NAME_REF@123..131 - IDENT@123..131 "Iterator" - WHITESPACE@131..132 " " - BLOCK_EXPR@132..134 - L_CURLY@132..133 "{" - R_CURLY@133..134 "}" - WHITESPACE@134..135 "\n" - FN_DEF@135..199 - FN_KW@135..137 "fn" - WHITESPACE@137..138 " " - NAME@138..141 - IDENT@138..141 "baz" - TYPE_PARAM_LIST@141..144 - L_ANGLE@141..142 "<" - TYPE_PARAM@142..143 - NAME@142..143 - IDENT@142..143 "T" - R_ANGLE@143..144 ">" - PARAM_LIST@144..152 - L_PAREN@144..145 "(" - PARAM@145..151 - BIND_PAT@145..147 - NAME@145..147 - IDENT@145..147 "_t" - COLON@147..148 ":" - WHITESPACE@148..149 " " - REFERENCE_TYPE@149..151 - AMP@149..150 "&" - PATH_TYPE@150..151 - PATH@150..151 - PATH_SEGMENT@150..151 - NAME_REF@150..151 - IDENT@150..151 "T" - R_PAREN@151..152 ")" - WHITESPACE@152..153 " " - WHERE_CLAUSE@153..196 - WHERE_KW@153..158 "where" - WHITESPACE@158..159 " " - WHERE_PRED@159..196 - FOR_TYPE@159..186 - FOR_KW@159..162 "for" - TYPE_PARAM_LIST@162..166 - L_ANGLE@162..163 "<" - LIFETIME_PARAM@163..165 - LIFETIME@163..165 "\'a" - R_ANGLE@165..166 ">" - WHITESPACE@166..167 " " - PATH_TYPE@167..186 - PATH@167..186 - PATH@167..181 - PATH_SEGMENT@167..181 - L_ANGLE@167..168 "<" - REFERENCE_TYPE@168..173 - AMP@168..169 "&" - LIFETIME@169..171 "\'a" - WHITESPACE@171..172 " " - PATH_TYPE@172..173 - PATH@172..173 - PATH_SEGMENT@172..173 - NAME_REF@172..173 - IDENT@172..173 "T" - WHITESPACE@173..174 " " - AS_KW@174..176 "as" - WHITESPACE@176..177 " " - PATH_TYPE@177..180 - PATH@177..180 - PATH_SEGMENT@177..180 - NAME_REF@177..180 - IDENT@177..180 "Baz" - R_ANGLE@180..181 ">" - COLON2@181..183 "::" - PATH_SEGMENT@183..186 - NAME_REF@183..186 - IDENT@183..186 "Foo" - COLON@186..187 ":" - WHITESPACE@187..188 " " - TYPE_BOUND_LIST@188..196 - TYPE_BOUND@188..196 - PATH_TYPE@188..196 - PATH@188..196 - PATH_SEGMENT@188..196 - NAME_REF@188..196 - IDENT@188..196 "Iterator" - WHITESPACE@196..197 " " - BLOCK_EXPR@197..199 - L_CURLY@197..198 "{" - R_CURLY@198..199 "}" - WHITESPACE@199..200 "\n" + TYPE_ALIAS_DEF@29..81 + TYPE_KW@29..33 "type" + WHITESPACE@33..34 " " + NAME@34..35 + IDENT@34..35 "B" + WHITESPACE@35..36 " " + EQ@36..37 "=" + WHITESPACE@37..38 " " + FOR_TYPE@38..80 + FOR_KW@38..41 "for" + TYPE_PARAM_LIST@41..45 + L_ANGLE@41..42 "<" + LIFETIME_PARAM@42..44 + LIFETIME@42..44 "\'a" + R_ANGLE@44..45 ">" + WHITESPACE@45..46 " " + FN_POINTER_TYPE@46..80 + UNSAFE_KW@46..52 "unsafe" + WHITESPACE@52..53 " " + ABI@53..63 + EXTERN_KW@53..59 "extern" + WHITESPACE@59..60 " " + STRING@60..63 "\"C\"" + WHITESPACE@63..64 " " + FN_KW@64..66 "fn" + PARAM_LIST@66..74 + L_PAREN@66..67 "(" + PARAM@67..73 + REFERENCE_TYPE@67..73 + AMP@67..68 "&" + LIFETIME@68..70 "\'a" + WHITESPACE@70..71 " " + TUPLE_TYPE@71..73 + L_PAREN@71..72 "(" + R_PAREN@72..73 ")" + R_PAREN@73..74 ")" + WHITESPACE@74..75 " " + RET_TYPE@75..80 + THIN_ARROW@75..77 "->" + WHITESPACE@77..78 " " + TUPLE_TYPE@78..80 + L_PAREN@78..79 "(" + R_PAREN@79..80 ")" + SEMICOLON@80..81 ";" + WHITESPACE@81..82 "\n" diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rs b/crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rs index d6774d438..457e8744f 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rs +++ b/crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rs @@ -1,4 +1,2 @@ type A = for<'a> fn() -> (); -fn foo(_t: &T) where for<'a> &'a T: Iterator {} -fn bar(_t: &T) where for<'a> &'a mut T: Iterator {} -fn baz(_t: &T) where for<'a> <&'a T as Baz>::Foo: Iterator {} +type B = for<'a> unsafe extern "C" fn(&'a ()) -> (); -- cgit v1.2.3 From 879693e63c19b474153473e11f96ab9c321739db Mon Sep 17 00:00:00 2001 From: Matthew Jasper Date: Thu, 11 Jun 2020 18:14:57 +0100 Subject: Move complex inline test to own file --- .../parser/inline/ok/0003_where_pred_for.rast | 252 +-------------------- .../parser/inline/ok/0003_where_pred_for.rs | 16 -- 2 files changed, 1 insertion(+), 267 deletions(-) (limited to 'crates/ra_syntax/test_data/parser/inline') diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0003_where_pred_for.rast b/crates/ra_syntax/test_data/parser/inline/ok/0003_where_pred_for.rast index 4f88bfe43..cd0892451 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0003_where_pred_for.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0003_where_pred_for.rast @@ -1,4 +1,4 @@ -SOURCE_FILE@0..292 +SOURCE_FILE@0..54 FN_DEF@0..53 FN_KW@0..2 "fn" WHITESPACE@2..3 " " @@ -58,253 +58,3 @@ SOURCE_FILE@0..292 WHITESPACE@51..52 " " R_CURLY@52..53 "}" WHITESPACE@53..54 "\n" - FN_DEF@54..103 - FN_KW@54..56 "fn" - WHITESPACE@56..57 " " - NAME@57..64 - IDENT@57..64 "for_ref" - TYPE_PARAM_LIST@64..67 - L_ANGLE@64..65 "<" - TYPE_PARAM@65..66 - NAME@65..66 - IDENT@65..66 "F" - R_ANGLE@66..67 ">" - PARAM_LIST@67..69 - L_PAREN@67..68 "(" - R_PAREN@68..69 ")" - WHITESPACE@69..70 "\n" - WHERE_CLAUSE@70..99 - WHERE_KW@70..75 "where" - WHITESPACE@75..79 "\n " - WHERE_PRED@79..99 - FOR_KW@79..82 "for" - TYPE_PARAM_LIST@82..86 - L_ANGLE@82..83 "<" - LIFETIME_PARAM@83..85 - LIFETIME@83..85 "\'a" - R_ANGLE@85..86 ">" - WHITESPACE@86..87 " " - REFERENCE_TYPE@87..92 - AMP@87..88 "&" - LIFETIME@88..90 "\'a" - WHITESPACE@90..91 " " - PATH_TYPE@91..92 - PATH@91..92 - PATH_SEGMENT@91..92 - NAME_REF@91..92 - IDENT@91..92 "F" - COLON@92..93 ":" - WHITESPACE@93..94 " " - TYPE_BOUND_LIST@94..99 - TYPE_BOUND@94..99 - PATH_TYPE@94..99 - PATH@94..99 - PATH_SEGMENT@94..99 - NAME_REF@94..99 - IDENT@94..99 "Debug" - WHITESPACE@99..100 "\n" - BLOCK_EXPR@100..103 - L_CURLY@100..101 "{" - WHITESPACE@101..102 " " - R_CURLY@102..103 "}" - WHITESPACE@103..104 "\n" - FN_DEF@104..164 - FN_KW@104..106 "fn" - WHITESPACE@106..107 " " - NAME@107..117 - IDENT@107..117 "for_parens" - TYPE_PARAM_LIST@117..120 - L_ANGLE@117..118 "<" - TYPE_PARAM@118..119 - NAME@118..119 - IDENT@118..119 "F" - R_ANGLE@119..120 ">" - PARAM_LIST@120..122 - L_PAREN@120..121 "(" - R_PAREN@121..122 ")" - WHITESPACE@122..123 "\n" - WHERE_CLAUSE@123..160 - WHERE_KW@123..128 "where" - WHITESPACE@128..132 "\n " - WHERE_PRED@132..160 - FOR_KW@132..135 "for" - TYPE_PARAM_LIST@135..139 - L_ANGLE@135..136 "<" - LIFETIME_PARAM@136..138 - LIFETIME@136..138 "\'a" - R_ANGLE@138..139 ">" - WHITESPACE@139..140 " " - PAREN_TYPE@140..147 - L_PAREN@140..141 "(" - REFERENCE_TYPE@141..146 - AMP@141..142 "&" - LIFETIME@142..144 "\'a" - WHITESPACE@144..145 " " - PATH_TYPE@145..146 - PATH@145..146 - PATH_SEGMENT@145..146 - NAME_REF@145..146 - IDENT@145..146 "F" - R_PAREN@146..147 ")" - COLON@147..148 ":" - WHITESPACE@148..149 " " - TYPE_BOUND_LIST@149..160 - TYPE_BOUND@149..160 - PATH_TYPE@149..160 - PATH@149..160 - PATH_SEGMENT@149..160 - NAME_REF@149..151 - IDENT@149..151 "Fn" - PARAM_LIST@151..160 - L_PAREN@151..152 "(" - PARAM@152..159 - REFERENCE_TYPE@152..159 - AMP@152..153 "&" - LIFETIME@153..155 "\'a" - WHITESPACE@155..156 " " - PATH_TYPE@156..159 - PATH@156..159 - PATH_SEGMENT@156..159 - NAME_REF@156..159 - IDENT@156..159 "str" - R_PAREN@159..160 ")" - WHITESPACE@160..161 "\n" - BLOCK_EXPR@161..164 - L_CURLY@161..162 "{" - WHITESPACE@162..163 " " - R_CURLY@163..164 "}" - WHITESPACE@164..165 "\n" - FN_DEF@165..215 - FN_KW@165..167 "fn" - WHITESPACE@167..168 " " - NAME@168..177 - IDENT@168..177 "for_slice" - TYPE_PARAM_LIST@177..180 - L_ANGLE@177..178 "<" - TYPE_PARAM@178..179 - NAME@178..179 - IDENT@178..179 "F" - R_ANGLE@179..180 ">" - PARAM_LIST@180..182 - L_PAREN@180..181 "(" - R_PAREN@181..182 ")" - WHITESPACE@182..183 "\n" - WHERE_CLAUSE@183..211 - WHERE_KW@183..188 "where" - WHITESPACE@188..192 "\n " - WHERE_PRED@192..211 - FOR_KW@192..195 "for" - TYPE_PARAM_LIST@195..199 - L_ANGLE@195..196 "<" - LIFETIME_PARAM@196..198 - LIFETIME@196..198 "\'a" - R_ANGLE@198..199 ">" - WHITESPACE@199..200 " " - SLICE_TYPE@200..207 - L_BRACK@200..201 "[" - REFERENCE_TYPE@201..206 - AMP@201..202 "&" - LIFETIME@202..204 "\'a" - WHITESPACE@204..205 " " - PATH_TYPE@205..206 - PATH@205..206 - PATH_SEGMENT@205..206 - NAME_REF@205..206 - IDENT@205..206 "F" - R_BRACK@206..207 "]" - COLON@207..208 ":" - WHITESPACE@208..209 " " - TYPE_BOUND_LIST@209..211 - TYPE_BOUND@209..211 - PATH_TYPE@209..211 - PATH@209..211 - PATH_SEGMENT@209..211 - NAME_REF@209..211 - IDENT@209..211 "Eq" - WHITESPACE@211..212 "\n" - BLOCK_EXPR@212..215 - L_CURLY@212..213 "{" - WHITESPACE@213..214 " " - R_CURLY@214..215 "}" - WHITESPACE@215..216 "\n" - FN_DEF@216..291 - FN_KW@216..218 "fn" - WHITESPACE@218..219 " " - NAME@219..228 - IDENT@219..228 "for_qpath" - TYPE_PARAM_LIST@228..231 - L_ANGLE@228..229 "<" - TYPE_PARAM@229..230 - NAME@229..230 - IDENT@229..230 "T" - R_ANGLE@230..231 ">" - PARAM_LIST@231..239 - L_PAREN@231..232 "(" - PARAM@232..238 - BIND_PAT@232..234 - NAME@232..234 - IDENT@232..234 "_t" - COLON@234..235 ":" - WHITESPACE@235..236 " " - REFERENCE_TYPE@236..238 - AMP@236..237 "&" - PATH_TYPE@237..238 - PATH@237..238 - PATH_SEGMENT@237..238 - NAME_REF@237..238 - IDENT@237..238 "T" - R_PAREN@238..239 ")" - WHITESPACE@239..240 "\n" - WHERE_CLAUSE@240..287 - WHERE_KW@240..245 "where" - WHITESPACE@245..250 "\n " - WHERE_PRED@250..287 - FOR_KW@250..253 "for" - TYPE_PARAM_LIST@253..257 - L_ANGLE@253..254 "<" - LIFETIME_PARAM@254..256 - LIFETIME@254..256 "\'a" - R_ANGLE@256..257 ">" - WHITESPACE@257..258 " " - PATH_TYPE@258..277 - PATH@258..277 - PATH@258..272 - PATH_SEGMENT@258..272 - L_ANGLE@258..259 "<" - REFERENCE_TYPE@259..264 - AMP@259..260 "&" - LIFETIME@260..262 "\'a" - WHITESPACE@262..263 " " - PATH_TYPE@263..264 - PATH@263..264 - PATH_SEGMENT@263..264 - NAME_REF@263..264 - IDENT@263..264 "T" - WHITESPACE@264..265 " " - AS_KW@265..267 "as" - WHITESPACE@267..268 " " - PATH_TYPE@268..271 - PATH@268..271 - PATH_SEGMENT@268..271 - NAME_REF@268..271 - IDENT@268..271 "Baz" - R_ANGLE@271..272 ">" - COLON2@272..274 "::" - PATH_SEGMENT@274..277 - NAME_REF@274..277 - IDENT@274..277 "Foo" - COLON@277..278 ":" - WHITESPACE@278..279 " " - TYPE_BOUND_LIST@279..287 - TYPE_BOUND@279..287 - PATH_TYPE@279..287 - PATH@279..287 - PATH_SEGMENT@279..287 - NAME_REF@279..287 - IDENT@279..287 "Iterator" - WHITESPACE@287..288 "\n" - BLOCK_EXPR@288..291 - L_CURLY@288..289 "{" - WHITESPACE@289..290 " " - R_CURLY@290..291 "}" - WHITESPACE@291..292 "\n" diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0003_where_pred_for.rs b/crates/ra_syntax/test_data/parser/inline/ok/0003_where_pred_for.rs index 2d47596be..423bc105b 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0003_where_pred_for.rs +++ b/crates/ra_syntax/test_data/parser/inline/ok/0003_where_pred_for.rs @@ -2,19 +2,3 @@ fn for_trait() where for<'a> F: Fn(&'a str) { } -fn for_ref() -where - for<'a> &'a F: Debug -{ } -fn for_parens() -where - for<'a> (&'a F): Fn(&'a str) -{ } -fn for_slice() -where - for<'a> [&'a F]: Eq -{ } -fn for_qpath(_t: &T) -where - for<'a> <&'a T as Baz>::Foo: Iterator -{ } -- cgit v1.2.3 From 8622e4cc1b79f5d23b8a2c6610d749f5b987ea7e Mon Sep 17 00:00:00 2001 From: Matthew Jasper Date: Thu, 11 Jun 2020 18:15:03 +0100 Subject: Add example of old trait object syntax --- .../test_data/parser/inline/ok/0081_for_type.rast | 38 +++++++++++++++++++++- .../test_data/parser/inline/ok/0081_for_type.rs | 1 + 2 files changed, 38 insertions(+), 1 deletion(-) (limited to 'crates/ra_syntax/test_data/parser/inline') diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rast index 26a80017a..b26ac2d36 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rast @@ -1,4 +1,4 @@ -SOURCE_FILE@0..82 +SOURCE_FILE@0..121 TYPE_ALIAS_DEF@0..28 TYPE_KW@0..4 "type" WHITESPACE@4..5 " " @@ -74,3 +74,39 @@ SOURCE_FILE@0..82 R_PAREN@79..80 ")" SEMICOLON@80..81 ";" WHITESPACE@81..82 "\n" + TYPE_ALIAS_DEF@82..120 + TYPE_KW@82..86 "type" + WHITESPACE@86..87 " " + NAME@87..90 + IDENT@87..90 "Obj" + WHITESPACE@90..91 " " + EQ@91..92 "=" + WHITESPACE@92..93 " " + FOR_TYPE@93..119 + FOR_KW@93..96 "for" + TYPE_PARAM_LIST@96..100 + L_ANGLE@96..97 "<" + LIFETIME_PARAM@97..99 + LIFETIME@97..99 "\'a" + R_ANGLE@99..100 ">" + WHITESPACE@100..101 " " + PATH_TYPE@101..119 + PATH@101..119 + PATH_SEGMENT@101..119 + NAME_REF@101..110 + IDENT@101..110 "PartialEq" + TYPE_ARG_LIST@110..119 + L_ANGLE@110..111 "<" + TYPE_ARG@111..118 + REFERENCE_TYPE@111..118 + AMP@111..112 "&" + LIFETIME@112..114 "\'a" + WHITESPACE@114..115 " " + PATH_TYPE@115..118 + PATH@115..118 + PATH_SEGMENT@115..118 + NAME_REF@115..118 + IDENT@115..118 "i32" + R_ANGLE@118..119 ">" + SEMICOLON@119..120 ";" + WHITESPACE@120..121 "\n" diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rs b/crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rs index 457e8744f..8ac7b9e10 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rs +++ b/crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rs @@ -1,2 +1,3 @@ type A = for<'a> fn() -> (); type B = for<'a> unsafe extern "C" fn(&'a ()) -> (); +type Obj = for<'a> PartialEq<&'a i32>; -- cgit v1.2.3