From 459241f272748ff2e57b2c7e84f5a04f78d67edb Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 24 Jul 2019 12:38:21 +0300 Subject: move syntax tests to unit tests --- .../inline/err/0001_array_type_missing_semi.rs | 1 + .../inline/err/0001_array_type_missing_semi.txt | 27 ++++++++ .../parser/inline/err/0002_misplaced_label_err.rs | 3 + .../parser/inline/err/0002_misplaced_label_err.txt | 28 ++++++++ .../inline/err/0003_pointer_type_no_mutability.rs | 1 + .../inline/err/0003_pointer_type_no_mutability.txt | 17 +++++ .../test_data/parser/inline/err/0004_impl_type.rs | 4 ++ .../test_data/parser/inline/err/0004_impl_type.txt | 79 ++++++++++++++++++++++ .../inline/err/0005_fn_pointer_type_missing_fn.rs | 1 + .../inline/err/0005_fn_pointer_type_missing_fn.txt | 23 +++++++ .../parser/inline/err/0006_unsafe_block_in_mod.rs | 1 + .../parser/inline/err/0006_unsafe_block_in_mod.txt | 35 ++++++++++ .../inline/err/0007_async_without_semicolon.rs | 1 + .../inline/err/0007_async_without_semicolon.txt | 31 +++++++++ .../test_data/parser/inline/err/0008_pub_expr.rs | 1 + .../test_data/parser/inline/err/0008_pub_expr.txt | 25 +++++++ .../inline/err/0009_attr_on_expr_not_allowed.rs | 4 ++ .../inline/err/0009_attr_on_expr_not_allowed.txt | 55 +++++++++++++++ .../parser/inline/err/0010_bad_tuple_index_expr.rs | 5 ++ .../inline/err/0010_bad_tuple_index_expr.txt | 51 ++++++++++++++ .../parser/inline/err/0010_wrong_order_fns.rs | 2 + .../parser/inline/err/0010_wrong_order_fns.txt | 39 +++++++++++ .../parser/inline/err/0014_default_fn_type.rs | 4 ++ .../parser/inline/err/0014_default_fn_type.txt | 58 ++++++++++++++++ 24 files changed, 496 insertions(+) create mode 100644 crates/ra_syntax/test_data/parser/inline/err/0001_array_type_missing_semi.rs create mode 100644 crates/ra_syntax/test_data/parser/inline/err/0001_array_type_missing_semi.txt create mode 100644 crates/ra_syntax/test_data/parser/inline/err/0002_misplaced_label_err.rs create mode 100644 crates/ra_syntax/test_data/parser/inline/err/0002_misplaced_label_err.txt create mode 100644 crates/ra_syntax/test_data/parser/inline/err/0003_pointer_type_no_mutability.rs create mode 100644 crates/ra_syntax/test_data/parser/inline/err/0003_pointer_type_no_mutability.txt create mode 100644 crates/ra_syntax/test_data/parser/inline/err/0004_impl_type.rs create mode 100644 crates/ra_syntax/test_data/parser/inline/err/0004_impl_type.txt create mode 100644 crates/ra_syntax/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.rs create mode 100644 crates/ra_syntax/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.txt create mode 100644 crates/ra_syntax/test_data/parser/inline/err/0006_unsafe_block_in_mod.rs create mode 100644 crates/ra_syntax/test_data/parser/inline/err/0006_unsafe_block_in_mod.txt create mode 100644 crates/ra_syntax/test_data/parser/inline/err/0007_async_without_semicolon.rs create mode 100644 crates/ra_syntax/test_data/parser/inline/err/0007_async_without_semicolon.txt create mode 100644 crates/ra_syntax/test_data/parser/inline/err/0008_pub_expr.rs create mode 100644 crates/ra_syntax/test_data/parser/inline/err/0008_pub_expr.txt create mode 100644 crates/ra_syntax/test_data/parser/inline/err/0009_attr_on_expr_not_allowed.rs create mode 100644 crates/ra_syntax/test_data/parser/inline/err/0009_attr_on_expr_not_allowed.txt create mode 100644 crates/ra_syntax/test_data/parser/inline/err/0010_bad_tuple_index_expr.rs create mode 100644 crates/ra_syntax/test_data/parser/inline/err/0010_bad_tuple_index_expr.txt create mode 100644 crates/ra_syntax/test_data/parser/inline/err/0010_wrong_order_fns.rs create mode 100644 crates/ra_syntax/test_data/parser/inline/err/0010_wrong_order_fns.txt create mode 100644 crates/ra_syntax/test_data/parser/inline/err/0014_default_fn_type.rs create mode 100644 crates/ra_syntax/test_data/parser/inline/err/0014_default_fn_type.txt (limited to 'crates/ra_syntax/test_data/parser/inline/err') diff --git a/crates/ra_syntax/test_data/parser/inline/err/0001_array_type_missing_semi.rs b/crates/ra_syntax/test_data/parser/inline/err/0001_array_type_missing_semi.rs new file mode 100644 index 000000000..a94851443 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/err/0001_array_type_missing_semi.rs @@ -0,0 +1 @@ +type T = [() 92]; diff --git a/crates/ra_syntax/test_data/parser/inline/err/0001_array_type_missing_semi.txt b/crates/ra_syntax/test_data/parser/inline/err/0001_array_type_missing_semi.txt new file mode 100644 index 000000000..3f0f1b480 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/err/0001_array_type_missing_semi.txt @@ -0,0 +1,27 @@ +SOURCE_FILE@[0; 18) + TYPE_ALIAS_DEF@[0; 12) + TYPE_KW@[0; 4) "type" + WHITESPACE@[4; 5) " " + NAME@[5; 6) + IDENT@[5; 6) "T" + WHITESPACE@[6; 7) " " + EQ@[7; 8) "=" + WHITESPACE@[8; 9) " " + SLICE_TYPE@[9; 12) + L_BRACK@[9; 10) "[" + TUPLE_TYPE@[10; 12) + L_PAREN@[10; 11) "(" + R_PAREN@[11; 12) ")" + WHITESPACE@[12; 13) " " + ERROR@[13; 15) + INT_NUMBER@[13; 15) "92" + ERROR@[15; 16) + R_BRACK@[15; 16) "]" + ERROR@[16; 17) + SEMI@[16; 17) ";" + WHITESPACE@[17; 18) "\n" +error 12: expected `;` or `]` +error 12: expected SEMI +error 13: expected an item +error 15: expected an item +error 16: expected an item diff --git a/crates/ra_syntax/test_data/parser/inline/err/0002_misplaced_label_err.rs b/crates/ra_syntax/test_data/parser/inline/err/0002_misplaced_label_err.rs new file mode 100644 index 000000000..a2164c510 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/err/0002_misplaced_label_err.rs @@ -0,0 +1,3 @@ +fn main() { + 'loop: impl +} diff --git a/crates/ra_syntax/test_data/parser/inline/err/0002_misplaced_label_err.txt b/crates/ra_syntax/test_data/parser/inline/err/0002_misplaced_label_err.txt new file mode 100644 index 000000000..7abc49d5e --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/err/0002_misplaced_label_err.txt @@ -0,0 +1,28 @@ +SOURCE_FILE@[0; 30) + FN_DEF@[0; 29) + 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@[10; 29) + L_CURLY@[10; 11) "{" + WHITESPACE@[11; 16) "\n " + EXPR_STMT@[16; 22) + ERROR@[16; 22) + LABEL@[16; 22) + LIFETIME@[16; 21) "\'loop" + COLON@[21; 22) ":" + WHITESPACE@[22; 23) " " + IMPL_BLOCK@[23; 27) + IMPL_KW@[23; 27) "impl" + WHITESPACE@[27; 28) "\n" + R_CURLY@[28; 29) "}" + WHITESPACE@[29; 30) "\n" +error 22: expected a loop +error 22: expected SEMI +error 27: expected type +error 27: expected `{` diff --git a/crates/ra_syntax/test_data/parser/inline/err/0003_pointer_type_no_mutability.rs b/crates/ra_syntax/test_data/parser/inline/err/0003_pointer_type_no_mutability.rs new file mode 100644 index 000000000..fae705131 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/err/0003_pointer_type_no_mutability.rs @@ -0,0 +1 @@ +type T = *(); diff --git a/crates/ra_syntax/test_data/parser/inline/err/0003_pointer_type_no_mutability.txt b/crates/ra_syntax/test_data/parser/inline/err/0003_pointer_type_no_mutability.txt new file mode 100644 index 000000000..b97e339bb --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/err/0003_pointer_type_no_mutability.txt @@ -0,0 +1,17 @@ +SOURCE_FILE@[0; 14) + TYPE_ALIAS_DEF@[0; 13) + TYPE_KW@[0; 4) "type" + WHITESPACE@[4; 5) " " + NAME@[5; 6) + IDENT@[5; 6) "T" + WHITESPACE@[6; 7) " " + EQ@[7; 8) "=" + WHITESPACE@[8; 9) " " + POINTER_TYPE@[9; 12) + STAR@[9; 10) "*" + TUPLE_TYPE@[10; 12) + L_PAREN@[10; 11) "(" + R_PAREN@[11; 12) ")" + SEMI@[12; 13) ";" + WHITESPACE@[13; 14) "\n" +error 10: expected mut or const in raw pointer type (use `*mut T` or `*const T` as appropriate) diff --git a/crates/ra_syntax/test_data/parser/inline/err/0004_impl_type.rs b/crates/ra_syntax/test_data/parser/inline/err/0004_impl_type.rs new file mode 100644 index 000000000..b8c7b65e3 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/err/0004_impl_type.rs @@ -0,0 +1,4 @@ +impl Type {} +impl Trait1 for T {} +impl impl NotType {} +impl Trait2 for impl NotType {} diff --git a/crates/ra_syntax/test_data/parser/inline/err/0004_impl_type.txt b/crates/ra_syntax/test_data/parser/inline/err/0004_impl_type.txt new file mode 100644 index 000000000..43321b1ed --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/err/0004_impl_type.txt @@ -0,0 +1,79 @@ +SOURCE_FILE@[0; 87) + IMPL_BLOCK@[0; 12) + IMPL_KW@[0; 4) "impl" + WHITESPACE@[4; 5) " " + PATH_TYPE@[5; 9) + PATH@[5; 9) + PATH_SEGMENT@[5; 9) + NAME_REF@[5; 9) + IDENT@[5; 9) "Type" + WHITESPACE@[9; 10) " " + ITEM_LIST@[10; 12) + L_CURLY@[10; 11) "{" + R_CURLY@[11; 12) "}" + WHITESPACE@[12; 13) "\n" + IMPL_BLOCK@[13; 33) + IMPL_KW@[13; 17) "impl" + WHITESPACE@[17; 18) " " + PATH_TYPE@[18; 24) + PATH@[18; 24) + PATH_SEGMENT@[18; 24) + NAME_REF@[18; 24) + IDENT@[18; 24) "Trait1" + WHITESPACE@[24; 25) " " + FOR_KW@[25; 28) "for" + WHITESPACE@[28; 29) " " + PATH_TYPE@[29; 30) + PATH@[29; 30) + PATH_SEGMENT@[29; 30) + NAME_REF@[29; 30) + IDENT@[29; 30) "T" + WHITESPACE@[30; 31) " " + ITEM_LIST@[31; 33) + L_CURLY@[31; 32) "{" + R_CURLY@[32; 33) "}" + WHITESPACE@[33; 34) "\n" + IMPL_BLOCK@[34; 38) + IMPL_KW@[34; 38) "impl" + WHITESPACE@[38; 39) " " + IMPL_BLOCK@[39; 54) + IMPL_KW@[39; 43) "impl" + WHITESPACE@[43; 44) " " + PATH_TYPE@[44; 51) + PATH@[44; 51) + PATH_SEGMENT@[44; 51) + NAME_REF@[44; 51) + IDENT@[44; 51) "NotType" + WHITESPACE@[51; 52) " " + ITEM_LIST@[52; 54) + L_CURLY@[52; 53) "{" + R_CURLY@[53; 54) "}" + WHITESPACE@[54; 55) "\n" + IMPL_BLOCK@[55; 70) + IMPL_KW@[55; 59) "impl" + WHITESPACE@[59; 60) " " + PATH_TYPE@[60; 66) + PATH@[60; 66) + PATH_SEGMENT@[60; 66) + NAME_REF@[60; 66) + IDENT@[60; 66) "Trait2" + WHITESPACE@[66; 67) " " + FOR_KW@[67; 70) "for" + WHITESPACE@[70; 71) " " + IMPL_BLOCK@[71; 86) + IMPL_KW@[71; 75) "impl" + WHITESPACE@[75; 76) " " + PATH_TYPE@[76; 83) + PATH@[76; 83) + PATH_SEGMENT@[76; 83) + NAME_REF@[76; 83) + IDENT@[76; 83) "NotType" + WHITESPACE@[83; 84) " " + ITEM_LIST@[84; 86) + L_CURLY@[84; 85) "{" + R_CURLY@[85; 86) "}" + WHITESPACE@[86; 87) "\n" +error 38: expected trait or type +error 38: expected `{` +error 70: expected trait or type +error 70: expected `{` diff --git a/crates/ra_syntax/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.rs b/crates/ra_syntax/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.rs new file mode 100644 index 000000000..f014914ff --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.rs @@ -0,0 +1 @@ +type F = unsafe (); diff --git a/crates/ra_syntax/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.txt b/crates/ra_syntax/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.txt new file mode 100644 index 000000000..451f29d39 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.txt @@ -0,0 +1,23 @@ +SOURCE_FILE@[0; 20) + TYPE_ALIAS_DEF@[0; 15) + TYPE_KW@[0; 4) "type" + WHITESPACE@[4; 5) " " + NAME@[5; 6) + IDENT@[5; 6) "F" + WHITESPACE@[6; 7) " " + EQ@[7; 8) "=" + WHITESPACE@[8; 9) " " + UNSAFE_KW@[9; 15) "unsafe" + WHITESPACE@[15; 16) " " + ERROR@[16; 17) + L_PAREN@[16; 17) "(" + ERROR@[17; 18) + R_PAREN@[17; 18) ")" + ERROR@[18; 19) + SEMI@[18; 19) ";" + WHITESPACE@[19; 20) "\n" +error 15: expected `fn` +error 15: expected SEMI +error 16: expected an item +error 17: expected an item +error 18: expected an item diff --git a/crates/ra_syntax/test_data/parser/inline/err/0006_unsafe_block_in_mod.rs b/crates/ra_syntax/test_data/parser/inline/err/0006_unsafe_block_in_mod.rs new file mode 100644 index 000000000..26141e904 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/err/0006_unsafe_block_in_mod.rs @@ -0,0 +1 @@ +fn foo(){} unsafe { } fn bar(){} diff --git a/crates/ra_syntax/test_data/parser/inline/err/0006_unsafe_block_in_mod.txt b/crates/ra_syntax/test_data/parser/inline/err/0006_unsafe_block_in_mod.txt new file mode 100644 index 000000000..a1871ec08 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/err/0006_unsafe_block_in_mod.txt @@ -0,0 +1,35 @@ +SOURCE_FILE@[0; 33) + FN_DEF@[0; 10) + FN_KW@[0; 2) "fn" + WHITESPACE@[2; 3) " " + NAME@[3; 6) + IDENT@[3; 6) "foo" + PARAM_LIST@[6; 8) + L_PAREN@[6; 7) "(" + R_PAREN@[7; 8) ")" + BLOCK@[8; 10) + L_CURLY@[8; 9) "{" + R_CURLY@[9; 10) "}" + WHITESPACE@[10; 11) " " + ERROR@[11; 17) + UNSAFE_KW@[11; 17) "unsafe" + WHITESPACE@[17; 18) " " + ERROR@[18; 21) + L_CURLY@[18; 19) "{" + WHITESPACE@[19; 20) " " + R_CURLY@[20; 21) "}" + WHITESPACE@[21; 22) " " + FN_DEF@[22; 32) + FN_KW@[22; 24) "fn" + WHITESPACE@[24; 25) " " + NAME@[25; 28) + IDENT@[25; 28) "bar" + PARAM_LIST@[28; 30) + L_PAREN@[28; 29) "(" + R_PAREN@[29; 30) ")" + BLOCK@[30; 32) + L_CURLY@[30; 31) "{" + R_CURLY@[31; 32) "}" + WHITESPACE@[32; 33) "\n" +error 11: expected an item +error 18: expected an item diff --git a/crates/ra_syntax/test_data/parser/inline/err/0007_async_without_semicolon.rs b/crates/ra_syntax/test_data/parser/inline/err/0007_async_without_semicolon.rs new file mode 100644 index 000000000..9a423248c --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/err/0007_async_without_semicolon.rs @@ -0,0 +1 @@ +fn foo() { let _ = async {} } diff --git a/crates/ra_syntax/test_data/parser/inline/err/0007_async_without_semicolon.txt b/crates/ra_syntax/test_data/parser/inline/err/0007_async_without_semicolon.txt new file mode 100644 index 000000000..f70adc25d --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/err/0007_async_without_semicolon.txt @@ -0,0 +1,31 @@ +SOURCE_FILE@[0; 30) + FN_DEF@[0; 29) + FN_KW@[0; 2) "fn" + WHITESPACE@[2; 3) " " + NAME@[3; 6) + IDENT@[3; 6) "foo" + PARAM_LIST@[6; 8) + L_PAREN@[6; 7) "(" + R_PAREN@[7; 8) ")" + WHITESPACE@[8; 9) " " + BLOCK@[9; 29) + L_CURLY@[9; 10) "{" + WHITESPACE@[10; 11) " " + LET_STMT@[11; 27) + LET_KW@[11; 14) "let" + WHITESPACE@[14; 15) " " + PLACEHOLDER_PAT@[15; 16) + UNDERSCORE@[15; 16) "_" + WHITESPACE@[16; 17) " " + EQ@[17; 18) "=" + WHITESPACE@[18; 19) " " + BLOCK_EXPR@[19; 27) + ASYNC_KW@[19; 24) "async" + WHITESPACE@[24; 25) " " + BLOCK@[25; 27) + L_CURLY@[25; 26) "{" + R_CURLY@[26; 27) "}" + WHITESPACE@[27; 28) " " + R_CURLY@[28; 29) "}" + WHITESPACE@[29; 30) "\n" +error 27: expected SEMI diff --git a/crates/ra_syntax/test_data/parser/inline/err/0008_pub_expr.rs b/crates/ra_syntax/test_data/parser/inline/err/0008_pub_expr.rs new file mode 100644 index 000000000..2976f6862 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/err/0008_pub_expr.rs @@ -0,0 +1 @@ +fn foo() { pub 92; } diff --git a/crates/ra_syntax/test_data/parser/inline/err/0008_pub_expr.txt b/crates/ra_syntax/test_data/parser/inline/err/0008_pub_expr.txt new file mode 100644 index 000000000..1dbfca698 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/err/0008_pub_expr.txt @@ -0,0 +1,25 @@ +SOURCE_FILE@[0; 21) + FN_DEF@[0; 20) + FN_KW@[0; 2) "fn" + WHITESPACE@[2; 3) " " + NAME@[3; 6) + IDENT@[3; 6) "foo" + PARAM_LIST@[6; 8) + L_PAREN@[6; 7) "(" + R_PAREN@[7; 8) ")" + WHITESPACE@[8; 9) " " + BLOCK@[9; 20) + L_CURLY@[9; 10) "{" + WHITESPACE@[10; 11) " " + ERROR@[11; 14) + VISIBILITY@[11; 14) + PUB_KW@[11; 14) "pub" + WHITESPACE@[14; 15) " " + EXPR_STMT@[15; 18) + LITERAL@[15; 17) + INT_NUMBER@[15; 17) "92" + SEMI@[17; 18) ";" + WHITESPACE@[18; 19) " " + R_CURLY@[19; 20) "}" + WHITESPACE@[20; 21) "\n" +error 14: expected an item diff --git a/crates/ra_syntax/test_data/parser/inline/err/0009_attr_on_expr_not_allowed.rs b/crates/ra_syntax/test_data/parser/inline/err/0009_attr_on_expr_not_allowed.rs new file mode 100644 index 000000000..d725a07ce --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/err/0009_attr_on_expr_not_allowed.rs @@ -0,0 +1,4 @@ +fn foo() { + #[A] 1 + 2; + #[B] if true {}; +} diff --git a/crates/ra_syntax/test_data/parser/inline/err/0009_attr_on_expr_not_allowed.txt b/crates/ra_syntax/test_data/parser/inline/err/0009_attr_on_expr_not_allowed.txt new file mode 100644 index 000000000..338776a72 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/err/0009_attr_on_expr_not_allowed.txt @@ -0,0 +1,55 @@ +SOURCE_FILE@[0; 48) + FN_DEF@[0; 47) + FN_KW@[0; 2) "fn" + WHITESPACE@[2; 3) " " + NAME@[3; 6) + IDENT@[3; 6) "foo" + PARAM_LIST@[6; 8) + L_PAREN@[6; 7) "(" + R_PAREN@[7; 8) ")" + WHITESPACE@[8; 9) " " + BLOCK@[9; 47) + L_CURLY@[9; 10) "{" + WHITESPACE@[10; 14) "\n " + EXPR_STMT@[14; 25) + ATTR@[14; 18) + POUND@[14; 15) "#" + TOKEN_TREE@[15; 18) + L_BRACK@[15; 16) "[" + IDENT@[16; 17) "A" + R_BRACK@[17; 18) "]" + WHITESPACE@[18; 19) " " + BIN_EXPR@[19; 24) + LITERAL@[19; 20) + INT_NUMBER@[19; 20) "1" + WHITESPACE@[20; 21) " " + PLUS@[21; 22) "+" + WHITESPACE@[22; 23) " " + LITERAL@[23; 24) + INT_NUMBER@[23; 24) "2" + SEMI@[24; 25) ";" + WHITESPACE@[25; 29) "\n " + EXPR_STMT@[29; 45) + ATTR@[29; 33) + POUND@[29; 30) "#" + TOKEN_TREE@[30; 33) + L_BRACK@[30; 31) "[" + IDENT@[31; 32) "B" + R_BRACK@[32; 33) "]" + WHITESPACE@[33; 34) " " + IF_EXPR@[34; 44) + IF_KW@[34; 36) "if" + WHITESPACE@[36; 37) " " + CONDITION@[37; 41) + LITERAL@[37; 41) + TRUE_KW@[37; 41) "true" + WHITESPACE@[41; 42) " " + BLOCK@[42; 44) + L_CURLY@[42; 43) "{" + R_CURLY@[43; 44) "}" + SEMI@[44; 45) ";" + WHITESPACE@[45; 46) "\n" + R_CURLY@[46; 47) "}" + WHITESPACE@[47; 48) "\n" +error 24: attributes are not allowed on BIN_EXPR +error 44: attributes are not allowed on IF_EXPR diff --git a/crates/ra_syntax/test_data/parser/inline/err/0010_bad_tuple_index_expr.rs b/crates/ra_syntax/test_data/parser/inline/err/0010_bad_tuple_index_expr.rs new file mode 100644 index 000000000..30cc49138 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/err/0010_bad_tuple_index_expr.rs @@ -0,0 +1,5 @@ +fn foo() { + x.0.; + x.1i32; + x.0x01; +} diff --git a/crates/ra_syntax/test_data/parser/inline/err/0010_bad_tuple_index_expr.txt b/crates/ra_syntax/test_data/parser/inline/err/0010_bad_tuple_index_expr.txt new file mode 100644 index 000000000..a21b29c80 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/err/0010_bad_tuple_index_expr.txt @@ -0,0 +1,51 @@ +SOURCE_FILE@[0; 47) + FN_DEF@[0; 46) + FN_KW@[0; 2) "fn" + WHITESPACE@[2; 3) " " + NAME@[3; 6) + IDENT@[3; 6) "foo" + PARAM_LIST@[6; 8) + L_PAREN@[6; 7) "(" + R_PAREN@[7; 8) ")" + WHITESPACE@[8; 9) " " + BLOCK@[9; 46) + L_CURLY@[9; 10) "{" + WHITESPACE@[10; 15) "\n " + EXPR_STMT@[15; 20) + FIELD_EXPR@[15; 19) + PATH_EXPR@[15; 16) + PATH@[15; 16) + PATH_SEGMENT@[15; 16) + NAME_REF@[15; 16) + IDENT@[15; 16) "x" + DOT@[16; 17) "." + FLOAT_NUMBER@[17; 19) "0." + SEMI@[19; 20) ";" + WHITESPACE@[20; 25) "\n " + EXPR_STMT@[25; 32) + FIELD_EXPR@[25; 31) + PATH_EXPR@[25; 26) + PATH@[25; 26) + PATH_SEGMENT@[25; 26) + NAME_REF@[25; 26) + IDENT@[25; 26) "x" + DOT@[26; 27) "." + INT_NUMBER@[27; 31) "1i32" + SEMI@[31; 32) ";" + WHITESPACE@[32; 37) "\n " + EXPR_STMT@[37; 44) + FIELD_EXPR@[37; 43) + PATH_EXPR@[37; 38) + PATH@[37; 38) + PATH_SEGMENT@[37; 38) + NAME_REF@[37; 38) + IDENT@[37; 38) "x" + DOT@[38; 39) "." + INT_NUMBER@[39; 43) "0x01" + SEMI@[43; 44) ";" + WHITESPACE@[44; 45) "\n" + R_CURLY@[45; 46) "}" + WHITESPACE@[46; 47) "\n" +error [17; 19): Tuple (struct) field access is only allowed through decimal integers with no underscores or suffix +error [27; 31): Tuple (struct) field access is only allowed through decimal integers with no underscores or suffix +error [39; 43): Tuple (struct) field access is only allowed through decimal integers with no underscores or suffix diff --git a/crates/ra_syntax/test_data/parser/inline/err/0010_wrong_order_fns.rs b/crates/ra_syntax/test_data/parser/inline/err/0010_wrong_order_fns.rs new file mode 100644 index 000000000..16edee95d --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/err/0010_wrong_order_fns.rs @@ -0,0 +1,2 @@ +async unsafe fn foo() {} +unsafe const fn bar() {} diff --git a/crates/ra_syntax/test_data/parser/inline/err/0010_wrong_order_fns.txt b/crates/ra_syntax/test_data/parser/inline/err/0010_wrong_order_fns.txt new file mode 100644 index 000000000..b1ef210d3 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/err/0010_wrong_order_fns.txt @@ -0,0 +1,39 @@ +SOURCE_FILE@[0; 50) + ERROR@[0; 5) + ASYNC_KW@[0; 5) "async" + WHITESPACE@[5; 6) " " + FN_DEF@[6; 24) + UNSAFE_KW@[6; 12) "unsafe" + WHITESPACE@[12; 13) " " + FN_KW@[13; 15) "fn" + WHITESPACE@[15; 16) " " + NAME@[16; 19) + IDENT@[16; 19) "foo" + PARAM_LIST@[19; 21) + L_PAREN@[19; 20) "(" + R_PAREN@[20; 21) ")" + WHITESPACE@[21; 22) " " + BLOCK@[22; 24) + L_CURLY@[22; 23) "{" + R_CURLY@[23; 24) "}" + WHITESPACE@[24; 25) "\n" + ERROR@[25; 31) + UNSAFE_KW@[25; 31) "unsafe" + WHITESPACE@[31; 32) " " + FN_DEF@[32; 49) + CONST_KW@[32; 37) "const" + WHITESPACE@[37; 38) " " + 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@[47; 49) + L_CURLY@[47; 48) "{" + R_CURLY@[48; 49) "}" + WHITESPACE@[49; 50) "\n" +error 5: expected existential, fn, trait or impl +error 31: expected existential, fn, trait or impl diff --git a/crates/ra_syntax/test_data/parser/inline/err/0014_default_fn_type.rs b/crates/ra_syntax/test_data/parser/inline/err/0014_default_fn_type.rs new file mode 100644 index 000000000..15ba8f4a8 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/err/0014_default_fn_type.rs @@ -0,0 +1,4 @@ +trait T { + default type T = Bar; + default fn foo() {} +} diff --git a/crates/ra_syntax/test_data/parser/inline/err/0014_default_fn_type.txt b/crates/ra_syntax/test_data/parser/inline/err/0014_default_fn_type.txt new file mode 100644 index 000000000..7da4e243f --- /dev/null +++ b/crates/ra_syntax/test_data/parser/inline/err/0014_default_fn_type.txt @@ -0,0 +1,58 @@ +SOURCE_FILE@[0; 62) + TRAIT_DEF@[0; 61) + TRAIT_KW@[0; 5) "trait" + WHITESPACE@[5; 6) " " + NAME@[6; 7) + IDENT@[6; 7) "T" + WHITESPACE@[7; 8) " " + ITEM_LIST@[8; 61) + L_CURLY@[8; 9) "{" + WHITESPACE@[9; 14) "\n " + MACRO_CALL@[14; 21) + PATH@[14; 21) + PATH_SEGMENT@[14; 21) + NAME_REF@[14; 21) + IDENT@[14; 21) "default" + WHITESPACE@[21; 22) " " + TYPE_ALIAS_DEF@[22; 35) + TYPE_KW@[22; 26) "type" + WHITESPACE@[26; 27) " " + NAME@[27; 28) + IDENT@[27; 28) "T" + WHITESPACE@[28; 29) " " + EQ@[29; 30) "=" + WHITESPACE@[30; 31) " " + PATH_TYPE@[31; 34) + PATH@[31; 34) + PATH_SEGMENT@[31; 34) + NAME_REF@[31; 34) + IDENT@[31; 34) "Bar" + SEMI@[34; 35) ";" + WHITESPACE@[35; 40) "\n " + MACRO_CALL@[40; 47) + PATH@[40; 47) + PATH_SEGMENT@[40; 47) + NAME_REF@[40; 47) + IDENT@[40; 47) "default" + WHITESPACE@[47; 48) " " + FN_DEF@[48; 59) + FN_KW@[48; 50) "fn" + WHITESPACE@[50; 51) " " + NAME@[51; 54) + IDENT@[51; 54) "foo" + PARAM_LIST@[54; 56) + L_PAREN@[54; 55) "(" + R_PAREN@[55; 56) ")" + WHITESPACE@[56; 57) " " + BLOCK@[57; 59) + L_CURLY@[57; 58) "{" + R_CURLY@[58; 59) "}" + WHITESPACE@[59; 60) "\n" + R_CURLY@[60; 61) "}" + WHITESPACE@[61; 62) "\n" +error 21: expected EXCL +error 21: expected `{`, `[`, `(` +error 21: expected SEMI +error 47: expected EXCL +error 47: expected `{`, `[`, `(` +error 47: expected SEMI -- cgit v1.2.3