From a6181bfdb74ba828df83c6ed6a70e68398e5ad86 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 19 Sep 2021 16:35:10 +0300 Subject: [PATCH] internal: more focused tests for const arguments --- crates/parser/src/grammar/generic_args.rs | 30 ++++++--- crates/parser/src/grammar/generic_params.rs | 2 - .../parser/inline/ok/0039_type_arg.rast | 66 ------------------ .../parser/inline/ok/0039_type_arg.rs | 1 - .../0164_const_generic_negated_literal.rast | 30 --------- .../ok/0164_const_generic_negated_literal.rs | 1 - .../inline/ok/0165_const_param_defaults.rast | 67 +------------------ .../inline/ok/0165_const_param_defaults.rs | 2 - .../inline/ok/0183_const_arg_block.rast | 31 +++++++++ .../parser/inline/ok/0183_const_arg_block.rs | 1 + .../parser/inline/ok/0184_const_arg.rast | 22 ++++++ .../parser/inline/ok/0184_const_arg.rs | 1 + .../inline/ok/0185_assoc_type_bound.rast | 37 ++++++++++ .../parser/inline/ok/0185_assoc_type_bound.rs | 1 + .../parser/inline/ok/0186_lifetime_arg.rast | 22 ++++++ .../parser/inline/ok/0186_lifetime_arg.rs | 1 + .../parser/inline/ok/0187_assoc_type_eq.rast | 41 ++++++++++++ .../parser/inline/ok/0187_assoc_type_eq.rs | 1 + .../parser/inline/ok/0188_const_arg_path.rast | 37 ++++++++++ .../parser/inline/ok/0188_const_arg_path.rs | 1 + .../inline/ok/0189_const_arg_literal.rast | 27 ++++++++ .../inline/ok/0189_const_arg_literal.rs | 1 + .../parser/inline/ok/0190_generic_arg.rast | 25 +++++++ .../parser/inline/ok/0190_generic_arg.rs | 1 + .../ok/0191_const_arg_negative_number.rast | 24 +++++++ .../ok/0191_const_arg_negative_number.rs | 1 + .../ok/0192_const_arg_bool_literal.rast | 22 ++++++ .../inline/ok/0192_const_arg_bool_literal.rs | 1 + 28 files changed, 321 insertions(+), 176 deletions(-) delete mode 100644 crates/syntax/test_data/parser/inline/ok/0039_type_arg.rast delete mode 100644 crates/syntax/test_data/parser/inline/ok/0039_type_arg.rs delete mode 100644 crates/syntax/test_data/parser/inline/ok/0164_const_generic_negated_literal.rast delete mode 100644 crates/syntax/test_data/parser/inline/ok/0164_const_generic_negated_literal.rs create mode 100644 crates/syntax/test_data/parser/inline/ok/0183_const_arg_block.rast create mode 100644 crates/syntax/test_data/parser/inline/ok/0183_const_arg_block.rs create mode 100644 crates/syntax/test_data/parser/inline/ok/0184_const_arg.rast create mode 100644 crates/syntax/test_data/parser/inline/ok/0184_const_arg.rs create mode 100644 crates/syntax/test_data/parser/inline/ok/0185_assoc_type_bound.rast create mode 100644 crates/syntax/test_data/parser/inline/ok/0185_assoc_type_bound.rs create mode 100644 crates/syntax/test_data/parser/inline/ok/0186_lifetime_arg.rast create mode 100644 crates/syntax/test_data/parser/inline/ok/0186_lifetime_arg.rs create mode 100644 crates/syntax/test_data/parser/inline/ok/0187_assoc_type_eq.rast create mode 100644 crates/syntax/test_data/parser/inline/ok/0187_assoc_type_eq.rs create mode 100644 crates/syntax/test_data/parser/inline/ok/0188_const_arg_path.rast create mode 100644 crates/syntax/test_data/parser/inline/ok/0188_const_arg_path.rs create mode 100644 crates/syntax/test_data/parser/inline/ok/0189_const_arg_literal.rast create mode 100644 crates/syntax/test_data/parser/inline/ok/0189_const_arg_literal.rs create mode 100644 crates/syntax/test_data/parser/inline/ok/0190_generic_arg.rast create mode 100644 crates/syntax/test_data/parser/inline/ok/0190_generic_arg.rs create mode 100644 crates/syntax/test_data/parser/inline/ok/0191_const_arg_negative_number.rast create mode 100644 crates/syntax/test_data/parser/inline/ok/0191_const_arg_negative_number.rs create mode 100644 crates/syntax/test_data/parser/inline/ok/0192_const_arg_bool_literal.rast create mode 100644 crates/syntax/test_data/parser/inline/ok/0192_const_arg_bool_literal.rs diff --git a/crates/parser/src/grammar/generic_args.rs b/crates/parser/src/grammar/generic_args.rs index d8ddf95f599..b47912d07d4 100644 --- a/crates/parser/src/grammar/generic_args.rs +++ b/crates/parser/src/grammar/generic_args.rs @@ -23,11 +23,13 @@ pub(super) fn opt_generic_arg_list(p: &mut Parser, colon_colon_required: bool) { m.complete(p, GENERIC_ARG_LIST); } -// test type_arg -// type A = B<'static, i32, 1, { 2 }, Item=u64, true, false>; +// test generic_arg +// type T = S; fn generic_arg(p: &mut Parser) { match p.current() { LIFETIME_IDENT => lifetime_arg(p), + T!['{'] | T![true] | T![false] | T![-] => const_arg(p), + k if k.is_literal() => const_arg(p), // test associated_type_bounds // fn print_all, Item: Display, Item<'a> = Item>>(printables: T) {} IDENT if [T![<], T![=], T![:]].contains(&p.nth(1)) => { @@ -35,13 +37,15 @@ fn generic_arg(p: &mut Parser) { name_ref(p); opt_generic_arg_list(p, false); match p.current() { - // NameRef<...> = + // test assoc_type_eq + // type T = StreamingIterator = &'a T>; T![=] => { p.bump_any(); types::type_(p); m.complete(p, ASSOC_TYPE_ARG); } - // NameRef<...>: + // test assoc_type_bound + // type T = StreamingIterator: Clone>; T![:] if !p.at(T![::]) => { generic_params::bounds(p); m.complete(p, ASSOC_TYPE_ARG); @@ -53,35 +57,43 @@ fn generic_arg(p: &mut Parser) { } } } - // test const_generic_negated_literal - // fn f() { S::<-1> } - T!['{'] | T![true] | T![false] | T![-] => const_arg(p), - k if k.is_literal() => const_arg(p), _ => type_arg(p), } } +// test lifetime_arg +// type T = S<'static>; fn lifetime_arg(p: &mut Parser) { let m = p.start(); lifetime(p); m.complete(p, LIFETIME_ARG); } +// test const_arg +// type T = S<92>; pub(super) fn const_arg(p: &mut Parser) { let m = p.start(); match p.current() { + // test const_arg_block + // type T = S<{90 + 2}>; T!['{'] => { expressions::block_expr(p); m.complete(p, CONST_ARG); } + // test const_arg_literal + // type T = S<"hello", 0xdeadbeef>; k if k.is_literal() => { expressions::literal(p); m.complete(p, CONST_ARG); } + // test const_arg_bool_literal + // type T = S; T![true] | T![false] => { expressions::literal(p); m.complete(p, CONST_ARG); } + // test const_arg_negative_number + // type T = S<-92>; T![-] => { let lm = p.start(); p.bump(T![-]); @@ -89,6 +101,8 @@ pub(super) fn const_arg(p: &mut Parser) { lm.complete(p, PREFIX_EXPR); m.complete(p, CONST_ARG); } + // test const_arg_path + // struct S; _ => { let lm = p.start(); paths::use_path(p); diff --git a/crates/parser/src/grammar/generic_params.rs b/crates/parser/src/grammar/generic_params.rs index b8119f0a216..5414b3b20df 100644 --- a/crates/parser/src/grammar/generic_params.rs +++ b/crates/parser/src/grammar/generic_params.rs @@ -81,8 +81,6 @@ fn const_param(p: &mut Parser, m: Marker) { if p.at(T![=]) { // test const_param_defaults // struct A; - // struct B; - // struct C; p.bump(T![=]); generic_args::const_arg(p); } diff --git a/crates/syntax/test_data/parser/inline/ok/0039_type_arg.rast b/crates/syntax/test_data/parser/inline/ok/0039_type_arg.rast deleted file mode 100644 index 11efa23a421..00000000000 --- a/crates/syntax/test_data/parser/inline/ok/0039_type_arg.rast +++ /dev/null @@ -1,66 +0,0 @@ -SOURCE_FILE@0..59 - TYPE_ALIAS@0..58 - TYPE_KW@0..4 "type" - WHITESPACE@4..5 " " - NAME@5..6 - IDENT@5..6 "A" - WHITESPACE@6..7 " " - EQ@7..8 "=" - WHITESPACE@8..9 " " - PATH_TYPE@9..57 - PATH@9..57 - PATH_SEGMENT@9..57 - NAME_REF@9..10 - IDENT@9..10 "B" - GENERIC_ARG_LIST@10..57 - L_ANGLE@10..11 "<" - LIFETIME_ARG@11..18 - LIFETIME@11..18 - LIFETIME_IDENT@11..18 "'static" - COMMA@18..19 "," - WHITESPACE@19..20 " " - TYPE_ARG@20..23 - PATH_TYPE@20..23 - PATH@20..23 - PATH_SEGMENT@20..23 - NAME_REF@20..23 - IDENT@20..23 "i32" - COMMA@23..24 "," - WHITESPACE@24..25 " " - CONST_ARG@25..26 - LITERAL@25..26 - INT_NUMBER@25..26 "1" - COMMA@26..27 "," - WHITESPACE@27..28 " " - CONST_ARG@28..33 - BLOCK_EXPR@28..33 - L_CURLY@28..29 "{" - WHITESPACE@29..30 " " - LITERAL@30..31 - INT_NUMBER@30..31 "2" - WHITESPACE@31..32 " " - R_CURLY@32..33 "}" - COMMA@33..34 "," - WHITESPACE@34..35 " " - ASSOC_TYPE_ARG@35..43 - NAME_REF@35..39 - IDENT@35..39 "Item" - EQ@39..40 "=" - PATH_TYPE@40..43 - PATH@40..43 - PATH_SEGMENT@40..43 - NAME_REF@40..43 - IDENT@40..43 "u64" - COMMA@43..44 "," - WHITESPACE@44..45 " " - CONST_ARG@45..49 - LITERAL@45..49 - TRUE_KW@45..49 "true" - COMMA@49..50 "," - WHITESPACE@50..51 " " - CONST_ARG@51..56 - LITERAL@51..56 - FALSE_KW@51..56 "false" - R_ANGLE@56..57 ">" - SEMICOLON@57..58 ";" - WHITESPACE@58..59 "\n" diff --git a/crates/syntax/test_data/parser/inline/ok/0039_type_arg.rs b/crates/syntax/test_data/parser/inline/ok/0039_type_arg.rs deleted file mode 100644 index 6a8721a73e2..00000000000 --- a/crates/syntax/test_data/parser/inline/ok/0039_type_arg.rs +++ /dev/null @@ -1 +0,0 @@ -type A = B<'static, i32, 1, { 2 }, Item=u64, true, false>; diff --git a/crates/syntax/test_data/parser/inline/ok/0164_const_generic_negated_literal.rast b/crates/syntax/test_data/parser/inline/ok/0164_const_generic_negated_literal.rast deleted file mode 100644 index b20e523dc1b..00000000000 --- a/crates/syntax/test_data/parser/inline/ok/0164_const_generic_negated_literal.rast +++ /dev/null @@ -1,30 +0,0 @@ -SOURCE_FILE@0..19 - FN@0..18 - FN_KW@0..2 "fn" - WHITESPACE@2..3 " " - NAME@3..4 - IDENT@3..4 "f" - PARAM_LIST@4..6 - L_PAREN@4..5 "(" - R_PAREN@5..6 ")" - WHITESPACE@6..7 " " - BLOCK_EXPR@7..18 - L_CURLY@7..8 "{" - WHITESPACE@8..9 " " - PATH_EXPR@9..16 - PATH@9..16 - PATH_SEGMENT@9..16 - NAME_REF@9..10 - IDENT@9..10 "S" - GENERIC_ARG_LIST@10..16 - COLON2@10..12 "::" - L_ANGLE@12..13 "<" - CONST_ARG@13..15 - PREFIX_EXPR@13..15 - MINUS@13..14 "-" - LITERAL@14..15 - INT_NUMBER@14..15 "1" - R_ANGLE@15..16 ">" - WHITESPACE@16..17 " " - R_CURLY@17..18 "}" - WHITESPACE@18..19 "\n" diff --git a/crates/syntax/test_data/parser/inline/ok/0164_const_generic_negated_literal.rs b/crates/syntax/test_data/parser/inline/ok/0164_const_generic_negated_literal.rs deleted file mode 100644 index 8a81d05cd94..00000000000 --- a/crates/syntax/test_data/parser/inline/ok/0164_const_generic_negated_literal.rs +++ /dev/null @@ -1 +0,0 @@ -fn f() { S::<-1> } diff --git a/crates/syntax/test_data/parser/inline/ok/0165_const_param_defaults.rast b/crates/syntax/test_data/parser/inline/ok/0165_const_param_defaults.rast index e8f40a4cd70..8677f8ae2c8 100644 --- a/crates/syntax/test_data/parser/inline/ok/0165_const_param_defaults.rast +++ b/crates/syntax/test_data/parser/inline/ok/0165_const_param_defaults.rast @@ -1,4 +1,4 @@ -SOURCE_FILE@0..96 +SOURCE_FILE@0..29 STRUCT@0..28 STRUCT_KW@0..6 "struct" WHITESPACE@6..7 " " @@ -29,68 +29,3 @@ SOURCE_FILE@0..96 R_ANGLE@26..27 ">" SEMICOLON@27..28 ";" WHITESPACE@28..29 "\n" - STRUCT@29..57 - STRUCT_KW@29..35 "struct" - WHITESPACE@35..36 " " - NAME@36..37 - IDENT@36..37 "B" - GENERIC_PARAM_LIST@37..56 - L_ANGLE@37..38 "<" - CONST_PARAM@38..55 - CONST_KW@38..43 "const" - WHITESPACE@43..44 " " - NAME@44..45 - IDENT@44..45 "N" - COLON@45..46 ":" - WHITESPACE@46..47 " " - PATH_TYPE@47..50 - PATH@47..50 - PATH_SEGMENT@47..50 - NAME_REF@47..50 - IDENT@47..50 "i32" - WHITESPACE@50..51 " " - EQ@51..52 "=" - WHITESPACE@52..53 " " - CONST_ARG@53..55 - BLOCK_EXPR@53..55 - L_CURLY@53..54 "{" - R_CURLY@54..55 "}" - R_ANGLE@55..56 ">" - SEMICOLON@56..57 ";" - WHITESPACE@57..58 "\n" - STRUCT@58..95 - STRUCT_KW@58..64 "struct" - WHITESPACE@64..65 " " - NAME@65..66 - IDENT@65..66 "C" - GENERIC_PARAM_LIST@66..94 - L_ANGLE@66..67 "<" - CONST_PARAM@67..93 - CONST_KW@67..72 "const" - WHITESPACE@72..73 " " - NAME@73..74 - IDENT@73..74 "N" - COLON@74..75 ":" - WHITESPACE@75..76 " " - PATH_TYPE@76..79 - PATH@76..79 - PATH_SEGMENT@76..79 - NAME_REF@76..79 - IDENT@76..79 "i32" - WHITESPACE@79..80 " " - EQ@80..81 "=" - WHITESPACE@81..82 " " - CONST_ARG@82..93 - PATH_EXPR@82..93 - PATH@82..93 - PATH@82..86 - PATH_SEGMENT@82..86 - NAME_REF@82..86 - IDENT@82..86 "some" - COLON2@86..88 "::" - PATH_SEGMENT@88..93 - NAME_REF@88..93 - IDENT@88..93 "CONST" - R_ANGLE@93..94 ">" - SEMICOLON@94..95 ";" - WHITESPACE@95..96 "\n" diff --git a/crates/syntax/test_data/parser/inline/ok/0165_const_param_defaults.rs b/crates/syntax/test_data/parser/inline/ok/0165_const_param_defaults.rs index 68388c8fbdf..879ecffa75d 100644 --- a/crates/syntax/test_data/parser/inline/ok/0165_const_param_defaults.rs +++ b/crates/syntax/test_data/parser/inline/ok/0165_const_param_defaults.rs @@ -1,3 +1 @@ struct A; -struct B; -struct C; diff --git a/crates/syntax/test_data/parser/inline/ok/0183_const_arg_block.rast b/crates/syntax/test_data/parser/inline/ok/0183_const_arg_block.rast new file mode 100644 index 00000000000..9020d1b8617 --- /dev/null +++ b/crates/syntax/test_data/parser/inline/ok/0183_const_arg_block.rast @@ -0,0 +1,31 @@ +SOURCE_FILE@0..22 + TYPE_ALIAS@0..21 + TYPE_KW@0..4 "type" + WHITESPACE@4..5 " " + NAME@5..6 + IDENT@5..6 "T" + WHITESPACE@6..7 " " + EQ@7..8 "=" + WHITESPACE@8..9 " " + PATH_TYPE@9..20 + PATH@9..20 + PATH_SEGMENT@9..20 + NAME_REF@9..10 + IDENT@9..10 "S" + GENERIC_ARG_LIST@10..20 + L_ANGLE@10..11 "<" + CONST_ARG@11..19 + BLOCK_EXPR@11..19 + L_CURLY@11..12 "{" + BIN_EXPR@12..18 + LITERAL@12..14 + INT_NUMBER@12..14 "90" + WHITESPACE@14..15 " " + PLUS@15..16 "+" + WHITESPACE@16..17 " " + LITERAL@17..18 + INT_NUMBER@17..18 "2" + R_CURLY@18..19 "}" + R_ANGLE@19..20 ">" + SEMICOLON@20..21 ";" + WHITESPACE@21..22 "\n" diff --git a/crates/syntax/test_data/parser/inline/ok/0183_const_arg_block.rs b/crates/syntax/test_data/parser/inline/ok/0183_const_arg_block.rs new file mode 100644 index 00000000000..1c279db289c --- /dev/null +++ b/crates/syntax/test_data/parser/inline/ok/0183_const_arg_block.rs @@ -0,0 +1 @@ +type T = S<{90 + 2}>; diff --git a/crates/syntax/test_data/parser/inline/ok/0184_const_arg.rast b/crates/syntax/test_data/parser/inline/ok/0184_const_arg.rast new file mode 100644 index 00000000000..15bfcb26efb --- /dev/null +++ b/crates/syntax/test_data/parser/inline/ok/0184_const_arg.rast @@ -0,0 +1,22 @@ +SOURCE_FILE@0..16 + TYPE_ALIAS@0..15 + TYPE_KW@0..4 "type" + WHITESPACE@4..5 " " + NAME@5..6 + IDENT@5..6 "T" + WHITESPACE@6..7 " " + EQ@7..8 "=" + WHITESPACE@8..9 " " + PATH_TYPE@9..14 + PATH@9..14 + PATH_SEGMENT@9..14 + NAME_REF@9..10 + IDENT@9..10 "S" + GENERIC_ARG_LIST@10..14 + L_ANGLE@10..11 "<" + CONST_ARG@11..13 + LITERAL@11..13 + INT_NUMBER@11..13 "92" + R_ANGLE@13..14 ">" + SEMICOLON@14..15 ";" + WHITESPACE@15..16 "\n" diff --git a/crates/syntax/test_data/parser/inline/ok/0184_const_arg.rs b/crates/syntax/test_data/parser/inline/ok/0184_const_arg.rs new file mode 100644 index 00000000000..8b5e5dbe13c --- /dev/null +++ b/crates/syntax/test_data/parser/inline/ok/0184_const_arg.rs @@ -0,0 +1 @@ +type T = S<92>; diff --git a/crates/syntax/test_data/parser/inline/ok/0185_assoc_type_bound.rast b/crates/syntax/test_data/parser/inline/ok/0185_assoc_type_bound.rast new file mode 100644 index 00000000000..24519dc8419 --- /dev/null +++ b/crates/syntax/test_data/parser/inline/ok/0185_assoc_type_bound.rast @@ -0,0 +1,37 @@ +SOURCE_FILE@0..45 + TYPE_ALIAS@0..44 + TYPE_KW@0..4 "type" + WHITESPACE@4..5 " " + NAME@5..6 + IDENT@5..6 "T" + WHITESPACE@6..7 " " + EQ@7..8 "=" + WHITESPACE@8..9 " " + PATH_TYPE@9..43 + PATH@9..43 + PATH_SEGMENT@9..43 + NAME_REF@9..26 + IDENT@9..26 "StreamingIterator" + GENERIC_ARG_LIST@26..43 + L_ANGLE@26..27 "<" + ASSOC_TYPE_ARG@27..42 + NAME_REF@27..31 + IDENT@27..31 "Item" + GENERIC_ARG_LIST@31..35 + L_ANGLE@31..32 "<" + LIFETIME_ARG@32..34 + LIFETIME@32..34 + LIFETIME_IDENT@32..34 "'a" + R_ANGLE@34..35 ">" + COLON@35..36 ":" + WHITESPACE@36..37 " " + TYPE_BOUND_LIST@37..42 + TYPE_BOUND@37..42 + PATH_TYPE@37..42 + PATH@37..42 + PATH_SEGMENT@37..42 + NAME_REF@37..42 + IDENT@37..42 "Clone" + R_ANGLE@42..43 ">" + SEMICOLON@43..44 ";" + WHITESPACE@44..45 "\n" diff --git a/crates/syntax/test_data/parser/inline/ok/0185_assoc_type_bound.rs b/crates/syntax/test_data/parser/inline/ok/0185_assoc_type_bound.rs new file mode 100644 index 00000000000..daae97e4fd5 --- /dev/null +++ b/crates/syntax/test_data/parser/inline/ok/0185_assoc_type_bound.rs @@ -0,0 +1 @@ +type T = StreamingIterator: Clone>; diff --git a/crates/syntax/test_data/parser/inline/ok/0186_lifetime_arg.rast b/crates/syntax/test_data/parser/inline/ok/0186_lifetime_arg.rast new file mode 100644 index 00000000000..812d222211c --- /dev/null +++ b/crates/syntax/test_data/parser/inline/ok/0186_lifetime_arg.rast @@ -0,0 +1,22 @@ +SOURCE_FILE@0..21 + TYPE_ALIAS@0..20 + TYPE_KW@0..4 "type" + WHITESPACE@4..5 " " + NAME@5..6 + IDENT@5..6 "T" + WHITESPACE@6..7 " " + EQ@7..8 "=" + WHITESPACE@8..9 " " + PATH_TYPE@9..19 + PATH@9..19 + PATH_SEGMENT@9..19 + NAME_REF@9..10 + IDENT@9..10 "S" + GENERIC_ARG_LIST@10..19 + L_ANGLE@10..11 "<" + LIFETIME_ARG@11..18 + LIFETIME@11..18 + LIFETIME_IDENT@11..18 "'static" + R_ANGLE@18..19 ">" + SEMICOLON@19..20 ";" + WHITESPACE@20..21 "\n" diff --git a/crates/syntax/test_data/parser/inline/ok/0186_lifetime_arg.rs b/crates/syntax/test_data/parser/inline/ok/0186_lifetime_arg.rs new file mode 100644 index 00000000000..41715aa273f --- /dev/null +++ b/crates/syntax/test_data/parser/inline/ok/0186_lifetime_arg.rs @@ -0,0 +1 @@ +type T = S<'static>; diff --git a/crates/syntax/test_data/parser/inline/ok/0187_assoc_type_eq.rast b/crates/syntax/test_data/parser/inline/ok/0187_assoc_type_eq.rast new file mode 100644 index 00000000000..308cea77f55 --- /dev/null +++ b/crates/syntax/test_data/parser/inline/ok/0187_assoc_type_eq.rast @@ -0,0 +1,41 @@ +SOURCE_FILE@0..46 + TYPE_ALIAS@0..45 + TYPE_KW@0..4 "type" + WHITESPACE@4..5 " " + NAME@5..6 + IDENT@5..6 "T" + WHITESPACE@6..7 " " + EQ@7..8 "=" + WHITESPACE@8..9 " " + PATH_TYPE@9..44 + PATH@9..44 + PATH_SEGMENT@9..44 + NAME_REF@9..26 + IDENT@9..26 "StreamingIterator" + GENERIC_ARG_LIST@26..44 + L_ANGLE@26..27 "<" + ASSOC_TYPE_ARG@27..43 + NAME_REF@27..31 + IDENT@27..31 "Item" + GENERIC_ARG_LIST@31..35 + L_ANGLE@31..32 "<" + LIFETIME_ARG@32..34 + LIFETIME@32..34 + LIFETIME_IDENT@32..34 "'a" + R_ANGLE@34..35 ">" + WHITESPACE@35..36 " " + EQ@36..37 "=" + WHITESPACE@37..38 " " + REF_TYPE@38..43 + AMP@38..39 "&" + LIFETIME@39..41 + LIFETIME_IDENT@39..41 "'a" + WHITESPACE@41..42 " " + PATH_TYPE@42..43 + PATH@42..43 + PATH_SEGMENT@42..43 + NAME_REF@42..43 + IDENT@42..43 "T" + R_ANGLE@43..44 ">" + SEMICOLON@44..45 ";" + WHITESPACE@45..46 "\n" diff --git a/crates/syntax/test_data/parser/inline/ok/0187_assoc_type_eq.rs b/crates/syntax/test_data/parser/inline/ok/0187_assoc_type_eq.rs new file mode 100644 index 00000000000..3591417473e --- /dev/null +++ b/crates/syntax/test_data/parser/inline/ok/0187_assoc_type_eq.rs @@ -0,0 +1 @@ +type T = StreamingIterator = &'a T>; diff --git a/crates/syntax/test_data/parser/inline/ok/0188_const_arg_path.rast b/crates/syntax/test_data/parser/inline/ok/0188_const_arg_path.rast new file mode 100644 index 00000000000..8da0121001e --- /dev/null +++ b/crates/syntax/test_data/parser/inline/ok/0188_const_arg_path.rast @@ -0,0 +1,37 @@ +SOURCE_FILE@0..35 + STRUCT@0..34 + STRUCT_KW@0..6 "struct" + WHITESPACE@6..7 " " + NAME@7..8 + IDENT@7..8 "S" + GENERIC_PARAM_LIST@8..33 + L_ANGLE@8..9 "<" + CONST_PARAM@9..32 + CONST_KW@9..14 "const" + WHITESPACE@14..15 " " + NAME@15..16 + IDENT@15..16 "N" + COLON@16..17 ":" + WHITESPACE@17..18 " " + PATH_TYPE@18..21 + PATH@18..21 + PATH_SEGMENT@18..21 + NAME_REF@18..21 + IDENT@18..21 "u32" + WHITESPACE@21..22 " " + EQ@22..23 "=" + WHITESPACE@23..24 " " + CONST_ARG@24..32 + PATH_EXPR@24..32 + PATH@24..32 + PATH@24..27 + PATH_SEGMENT@24..27 + NAME_REF@24..27 + IDENT@24..27 "u32" + COLON2@27..29 "::" + PATH_SEGMENT@29..32 + NAME_REF@29..32 + IDENT@29..32 "MAX" + R_ANGLE@32..33 ">" + SEMICOLON@33..34 ";" + WHITESPACE@34..35 "\n" diff --git a/crates/syntax/test_data/parser/inline/ok/0188_const_arg_path.rs b/crates/syntax/test_data/parser/inline/ok/0188_const_arg_path.rs new file mode 100644 index 00000000000..ee075f3e50f --- /dev/null +++ b/crates/syntax/test_data/parser/inline/ok/0188_const_arg_path.rs @@ -0,0 +1 @@ +struct S; diff --git a/crates/syntax/test_data/parser/inline/ok/0189_const_arg_literal.rast b/crates/syntax/test_data/parser/inline/ok/0189_const_arg_literal.rast new file mode 100644 index 00000000000..a94cd256aaa --- /dev/null +++ b/crates/syntax/test_data/parser/inline/ok/0189_const_arg_literal.rast @@ -0,0 +1,27 @@ +SOURCE_FILE@0..33 + TYPE_ALIAS@0..32 + TYPE_KW@0..4 "type" + WHITESPACE@4..5 " " + NAME@5..6 + IDENT@5..6 "T" + WHITESPACE@6..7 " " + EQ@7..8 "=" + WHITESPACE@8..9 " " + PATH_TYPE@9..31 + PATH@9..31 + PATH_SEGMENT@9..31 + NAME_REF@9..10 + IDENT@9..10 "S" + GENERIC_ARG_LIST@10..31 + L_ANGLE@10..11 "<" + CONST_ARG@11..18 + LITERAL@11..18 + STRING@11..18 "\"hello\"" + COMMA@18..19 "," + WHITESPACE@19..20 " " + CONST_ARG@20..30 + LITERAL@20..30 + INT_NUMBER@20..30 "0xdeadbeef" + R_ANGLE@30..31 ">" + SEMICOLON@31..32 ";" + WHITESPACE@32..33 "\n" diff --git a/crates/syntax/test_data/parser/inline/ok/0189_const_arg_literal.rs b/crates/syntax/test_data/parser/inline/ok/0189_const_arg_literal.rs new file mode 100644 index 00000000000..7eacada73ad --- /dev/null +++ b/crates/syntax/test_data/parser/inline/ok/0189_const_arg_literal.rs @@ -0,0 +1 @@ +type T = S<"hello", 0xdeadbeef>; diff --git a/crates/syntax/test_data/parser/inline/ok/0190_generic_arg.rast b/crates/syntax/test_data/parser/inline/ok/0190_generic_arg.rast new file mode 100644 index 00000000000..c41d29071bd --- /dev/null +++ b/crates/syntax/test_data/parser/inline/ok/0190_generic_arg.rast @@ -0,0 +1,25 @@ +SOURCE_FILE@0..17 + TYPE_ALIAS@0..16 + TYPE_KW@0..4 "type" + WHITESPACE@4..5 " " + NAME@5..6 + IDENT@5..6 "T" + WHITESPACE@6..7 " " + EQ@7..8 "=" + WHITESPACE@8..9 " " + PATH_TYPE@9..15 + PATH@9..15 + PATH_SEGMENT@9..15 + NAME_REF@9..10 + IDENT@9..10 "S" + GENERIC_ARG_LIST@10..15 + L_ANGLE@10..11 "<" + TYPE_ARG@11..14 + PATH_TYPE@11..14 + PATH@11..14 + PATH_SEGMENT@11..14 + NAME_REF@11..14 + IDENT@11..14 "i32" + R_ANGLE@14..15 ">" + SEMICOLON@15..16 ";" + WHITESPACE@16..17 "\n" diff --git a/crates/syntax/test_data/parser/inline/ok/0190_generic_arg.rs b/crates/syntax/test_data/parser/inline/ok/0190_generic_arg.rs new file mode 100644 index 00000000000..f2ccc558bb5 --- /dev/null +++ b/crates/syntax/test_data/parser/inline/ok/0190_generic_arg.rs @@ -0,0 +1 @@ +type T = S; diff --git a/crates/syntax/test_data/parser/inline/ok/0191_const_arg_negative_number.rast b/crates/syntax/test_data/parser/inline/ok/0191_const_arg_negative_number.rast new file mode 100644 index 00000000000..87ff6cb7bf2 --- /dev/null +++ b/crates/syntax/test_data/parser/inline/ok/0191_const_arg_negative_number.rast @@ -0,0 +1,24 @@ +SOURCE_FILE@0..17 + TYPE_ALIAS@0..16 + TYPE_KW@0..4 "type" + WHITESPACE@4..5 " " + NAME@5..6 + IDENT@5..6 "T" + WHITESPACE@6..7 " " + EQ@7..8 "=" + WHITESPACE@8..9 " " + PATH_TYPE@9..15 + PATH@9..15 + PATH_SEGMENT@9..15 + NAME_REF@9..10 + IDENT@9..10 "S" + GENERIC_ARG_LIST@10..15 + L_ANGLE@10..11 "<" + CONST_ARG@11..14 + PREFIX_EXPR@11..14 + MINUS@11..12 "-" + LITERAL@12..14 + INT_NUMBER@12..14 "92" + R_ANGLE@14..15 ">" + SEMICOLON@15..16 ";" + WHITESPACE@16..17 "\n" diff --git a/crates/syntax/test_data/parser/inline/ok/0191_const_arg_negative_number.rs b/crates/syntax/test_data/parser/inline/ok/0191_const_arg_negative_number.rs new file mode 100644 index 00000000000..d0a87bdc039 --- /dev/null +++ b/crates/syntax/test_data/parser/inline/ok/0191_const_arg_negative_number.rs @@ -0,0 +1 @@ +type T = S<-92>; diff --git a/crates/syntax/test_data/parser/inline/ok/0192_const_arg_bool_literal.rast b/crates/syntax/test_data/parser/inline/ok/0192_const_arg_bool_literal.rast new file mode 100644 index 00000000000..7c44c6b82d4 --- /dev/null +++ b/crates/syntax/test_data/parser/inline/ok/0192_const_arg_bool_literal.rast @@ -0,0 +1,22 @@ +SOURCE_FILE@0..18 + TYPE_ALIAS@0..17 + TYPE_KW@0..4 "type" + WHITESPACE@4..5 " " + NAME@5..6 + IDENT@5..6 "T" + WHITESPACE@6..7 " " + EQ@7..8 "=" + WHITESPACE@8..9 " " + PATH_TYPE@9..16 + PATH@9..16 + PATH_SEGMENT@9..16 + NAME_REF@9..10 + IDENT@9..10 "S" + GENERIC_ARG_LIST@10..16 + L_ANGLE@10..11 "<" + CONST_ARG@11..15 + LITERAL@11..15 + TRUE_KW@11..15 "true" + R_ANGLE@15..16 ">" + SEMICOLON@16..17 ";" + WHITESPACE@17..18 "\n" diff --git a/crates/syntax/test_data/parser/inline/ok/0192_const_arg_bool_literal.rs b/crates/syntax/test_data/parser/inline/ok/0192_const_arg_bool_literal.rs new file mode 100644 index 00000000000..4b92e2d487a --- /dev/null +++ b/crates/syntax/test_data/parser/inline/ok/0192_const_arg_bool_literal.rs @@ -0,0 +1 @@ +type T = S;