aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/test_data/parser/inline
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-02-18 12:57:26 +0000
committerGitHub <[email protected]>2020-02-18 12:57:26 +0000
commitc447fe9bc06006a7080da782cf67d739c91b534c (patch)
tree45cbc9578b24437da3eedc6a234784be22b1f38c /crates/ra_syntax/test_data/parser/inline
parent742459c8fe08e359ae380e3e1dc0d059c0b4f871 (diff)
parent053ccf4121797e4e559e3225d46d3f23cb1ad70b (diff)
Merge #3026
3026: ra_syntax: reshape SyntaxError for the sake of removing redundancy r=matklad a=Veetaha Followup of #2911, also puts some crosses to the todo list of #223. **AHTUNG!** A big part of the diff of this PR are test data files changes. Simplified `SyntaxError` that was `SyntaxError { kind: { /* big enum */ }, location: Location }` to `SyntaxError(String, TextRange)`. I am not sure whether the tuple struct here is best fit, I am inclined to add names to the fields, because I already provide getters `SyntaxError::message()`, `SyntaxError::range()`. I also removed `Location` altogether ... This is currently WIP, because the following is not done: - [ ] ~~Add tests to `test_data` dir for unescape errors *// I don't know where to put these errors in particular, because they are out of the scope of the lexer and parser. However, I have an idea in mind that we move all validators we have right now to parsing stage, but this is up to discussion...*~~ **[UPD]** I came to a conclusion that tree validation logic, which unescape errors are a part of, should be rethought of, we currently have no tests and no place to put tests for tree validations. So I'd like to extract potential redesign (maybe move of tree validation to ra_parser) and adding tests for this into a separate task. Co-authored-by: Veetaha <[email protected]> Co-authored-by: Veetaha <[email protected]>
Diffstat (limited to 'crates/ra_syntax/test_data/parser/inline')
-rw-r--r--crates/ra_syntax/test_data/parser/inline/err/0001_array_type_missing_semi.txt10
-rw-r--r--crates/ra_syntax/test_data/parser/inline/err/0002_misplaced_label_err.txt8
-rw-r--r--crates/ra_syntax/test_data/parser/inline/err/0003_pointer_type_no_mutability.txt2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/err/0004_impl_type.txt8
-rw-r--r--crates/ra_syntax/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.txt10
-rw-r--r--crates/ra_syntax/test_data/parser/inline/err/0006_unsafe_block_in_mod.txt4
-rw-r--r--crates/ra_syntax/test_data/parser/inline/err/0007_async_without_semicolon.txt2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/err/0008_pub_expr.txt2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/err/0009_attr_on_expr_not_allowed.txt4
-rw-r--r--crates/ra_syntax/test_data/parser/inline/err/0010_wrong_order_fns.txt4
-rw-r--r--crates/ra_syntax/test_data/parser/inline/err/0013_static_underscore.txt2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/err/0014_default_fn_type.txt12
12 files changed, 34 insertions, 34 deletions
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
index 3f0f1b480..530533b71 100644
--- 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
@@ -20,8 +20,8 @@ SOURCE_FILE@[0; 18)
20 ERROR@[16; 17) 20 ERROR@[16; 17)
21 SEMI@[16; 17) ";" 21 SEMI@[16; 17) ";"
22 WHITESPACE@[17; 18) "\n" 22 WHITESPACE@[17; 18) "\n"
23error 12: expected `;` or `]` 23error [12; 12): expected `;` or `]`
24error 12: expected SEMI 24error [12; 12): expected SEMI
25error 13: expected an item 25error [13; 13): expected an item
26error 15: expected an item 26error [15; 15): expected an item
27error 16: expected an item 27error [16; 16): expected an item
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
index 2950d77ef..0187d872d 100644
--- 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
@@ -23,7 +23,7 @@ SOURCE_FILE@[0; 30)
23 WHITESPACE@[27; 28) "\n" 23 WHITESPACE@[27; 28) "\n"
24 R_CURLY@[28; 29) "}" 24 R_CURLY@[28; 29) "}"
25 WHITESPACE@[29; 30) "\n" 25 WHITESPACE@[29; 30) "\n"
26error 22: expected a loop 26error [22; 22): expected a loop
27error 22: expected SEMI 27error [22; 22): expected SEMI
28error 27: expected type 28error [27; 27): expected type
29error 27: expected `{` 29error [27; 27): expected `{`
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
index b97e339bb..2ab29eecc 100644
--- 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
@@ -14,4 +14,4 @@ SOURCE_FILE@[0; 14)
14 R_PAREN@[11; 12) ")" 14 R_PAREN@[11; 12) ")"
15 SEMI@[12; 13) ";" 15 SEMI@[12; 13) ";"
16 WHITESPACE@[13; 14) "\n" 16 WHITESPACE@[13; 14) "\n"
17error 10: expected mut or const in raw pointer type (use `*mut T` or `*const T` as appropriate) 17error [10; 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.txt b/crates/ra_syntax/test_data/parser/inline/err/0004_impl_type.txt
index 43321b1ed..d5aea05c2 100644
--- 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
@@ -73,7 +73,7 @@ SOURCE_FILE@[0; 87)
73 L_CURLY@[84; 85) "{" 73 L_CURLY@[84; 85) "{"
74 R_CURLY@[85; 86) "}" 74 R_CURLY@[85; 86) "}"
75 WHITESPACE@[86; 87) "\n" 75 WHITESPACE@[86; 87) "\n"
76error 38: expected trait or type 76error [38; 38): expected trait or type
77error 38: expected `{` 77error [38; 38): expected `{`
78error 70: expected trait or type 78error [70; 70): expected trait or type
79error 70: expected `{` 79error [70; 70): expected `{`
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
index 451f29d39..9e9186ad4 100644
--- 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
@@ -16,8 +16,8 @@ SOURCE_FILE@[0; 20)
16 ERROR@[18; 19) 16 ERROR@[18; 19)
17 SEMI@[18; 19) ";" 17 SEMI@[18; 19) ";"
18 WHITESPACE@[19; 20) "\n" 18 WHITESPACE@[19; 20) "\n"
19error 15: expected `fn` 19error [15; 15): expected `fn`
20error 15: expected SEMI 20error [15; 15): expected SEMI
21error 16: expected an item 21error [16; 16): expected an item
22error 17: expected an item 22error [17; 17): expected an item
23error 18: expected an item 23error [18; 18): expected an item
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
index f3fbc4828..690acdca3 100644
--- 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
@@ -33,5 +33,5 @@ SOURCE_FILE@[0; 33)
33 L_CURLY@[30; 31) "{" 33 L_CURLY@[30; 31) "{"
34 R_CURLY@[31; 32) "}" 34 R_CURLY@[31; 32) "}"
35 WHITESPACE@[32; 33) "\n" 35 WHITESPACE@[32; 33) "\n"
36error 11: expected an item 36error [11; 11): expected an item
37error 18: expected an item 37error [18; 18): expected an item
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
index 5cfe766d7..a4002a998 100644
--- 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
@@ -29,4 +29,4 @@ SOURCE_FILE@[0; 30)
29 WHITESPACE@[27; 28) " " 29 WHITESPACE@[27; 28) " "
30 R_CURLY@[28; 29) "}" 30 R_CURLY@[28; 29) "}"
31 WHITESPACE@[29; 30) "\n" 31 WHITESPACE@[29; 30) "\n"
32error 27: expected SEMI 32error [27; 27): expected SEMI
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
index 0594f148f..6f45a4fa6 100644
--- 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
@@ -23,4 +23,4 @@ SOURCE_FILE@[0; 21)
23 WHITESPACE@[18; 19) " " 23 WHITESPACE@[18; 19) " "
24 R_CURLY@[19; 20) "}" 24 R_CURLY@[19; 20) "}"
25 WHITESPACE@[20; 21) "\n" 25 WHITESPACE@[20; 21) "\n"
26error 14: expected an item 26error [14; 14): expected an item
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
index 2ca5b8f32..e6d3a5c95 100644
--- 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
@@ -57,5 +57,5 @@ SOURCE_FILE@[0; 48)
57 WHITESPACE@[45; 46) "\n" 57 WHITESPACE@[45; 46) "\n"
58 R_CURLY@[46; 47) "}" 58 R_CURLY@[46; 47) "}"
59 WHITESPACE@[47; 48) "\n" 59 WHITESPACE@[47; 48) "\n"
60error 24: attributes are not allowed on BIN_EXPR 60error [24; 24): attributes are not allowed on BIN_EXPR
61error 44: attributes are not allowed on IF_EXPR 61error [44; 44): attributes are not allowed on IF_EXPR
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
index 289193b9e..f6ac0feaf 100644
--- 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
@@ -37,5 +37,5 @@ SOURCE_FILE@[0; 50)
37 L_CURLY@[47; 48) "{" 37 L_CURLY@[47; 48) "{"
38 R_CURLY@[48; 49) "}" 38 R_CURLY@[48; 49) "}"
39 WHITESPACE@[49; 50) "\n" 39 WHITESPACE@[49; 50) "\n"
40error 6: expected existential, fn, trait or impl 40error [6; 6): expected existential, fn, trait or impl
41error 31: expected existential, fn, trait or impl 41error [31; 31): expected existential, fn, trait or impl
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0013_static_underscore.txt b/crates/ra_syntax/test_data/parser/inline/err/0013_static_underscore.txt
index 28f75a341..5b3dc5af2 100644
--- a/crates/ra_syntax/test_data/parser/inline/err/0013_static_underscore.txt
+++ b/crates/ra_syntax/test_data/parser/inline/err/0013_static_underscore.txt
@@ -18,4 +18,4 @@ SOURCE_FILE@[0; 19)
18 INT_NUMBER@[16; 17) "5" 18 INT_NUMBER@[16; 17) "5"
19 SEMI@[17; 18) ";" 19 SEMI@[17; 18) ";"
20 WHITESPACE@[18; 19) "\n" 20 WHITESPACE@[18; 19) "\n"
21error 7: expected a name 21error [7; 7): expected a name
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
index a1a0bd7c4..25d80be1d 100644
--- 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
@@ -51,9 +51,9 @@ SOURCE_FILE@[0; 62)
51 WHITESPACE@[59; 60) "\n" 51 WHITESPACE@[59; 60) "\n"
52 R_CURLY@[60; 61) "}" 52 R_CURLY@[60; 61) "}"
53 WHITESPACE@[61; 62) "\n" 53 WHITESPACE@[61; 62) "\n"
54error 21: expected EXCL 54error [21; 21): expected EXCL
55error 21: expected `{`, `[`, `(` 55error [21; 21): expected `{`, `[`, `(`
56error 21: expected SEMI 56error [21; 21): expected SEMI
57error 47: expected EXCL 57error [47; 47): expected EXCL
58error 47: expected `{`, `[`, `(` 58error [47; 47): expected `{`, `[`, `(`
59error 47: expected SEMI 59error [47; 47): expected SEMI