aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaio <[email protected]>2019-03-10 17:35:25 +0000
committerCaio <[email protected]>2019-03-10 17:35:25 +0000
commitcc9721996c4680e257db76aafea12a9565196d92 (patch)
treeabc90b6e4be002cc4595f5338804bf4753e3edb7
parentad72699553c39f159f25a6dc7ecd5df953817407 (diff)
Add test for async block
-rw-r--r--crates/ra_parser/src/grammar/items.rs3
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/err/0007_async_without_semicolon.rs1
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/err/0007_async_without_semicolon.txt31
3 files changed, 34 insertions, 1 deletions
diff --git a/crates/ra_parser/src/grammar/items.rs b/crates/ra_parser/src/grammar/items.rs
index 91f9bfe8a..a057c8167 100644
--- a/crates/ra_parser/src/grammar/items.rs
+++ b/crates/ra_parser/src/grammar/items.rs
@@ -88,7 +88,8 @@ pub(super) fn maybe_item(p: &mut Parser, flavor: ItemFlavor) -> MaybeItem {
88 let mut has_mods = false; 88 let mut has_mods = false;
89 89
90 // modifiers 90 // modifiers
91 91 // test_err async_without_semicolon
92 // fn foo() { let _ = async {} }
92 has_mods |= p.eat(CONST_KW); 93 has_mods |= p.eat(CONST_KW);
93 if p.at(ASYNC_KW) && p.nth(1) != L_CURLY { 94 if p.at(ASYNC_KW) && p.nth(1) != L_CURLY {
94 p.eat(ASYNC_KW); 95 p.eat(ASYNC_KW);
diff --git a/crates/ra_syntax/tests/data/parser/inline/err/0007_async_without_semicolon.rs b/crates/ra_syntax/tests/data/parser/inline/err/0007_async_without_semicolon.rs
new file mode 100644
index 000000000..9a423248c
--- /dev/null
+++ b/crates/ra_syntax/tests/data/parser/inline/err/0007_async_without_semicolon.rs
@@ -0,0 +1 @@
fn foo() { let _ = async {} }
diff --git a/crates/ra_syntax/tests/data/parser/inline/err/0007_async_without_semicolon.txt b/crates/ra_syntax/tests/data/parser/inline/err/0007_async_without_semicolon.txt
new file mode 100644
index 000000000..bb9a2d029
--- /dev/null
+++ b/crates/ra_syntax/tests/data/parser/inline/err/0007_async_without_semicolon.txt
@@ -0,0 +1,31 @@
1SOURCE_FILE@[0; 30)
2 FN_DEF@[0; 29)
3 FN_KW@[0; 2)
4 WHITESPACE@[2; 3)
5 NAME@[3; 6)
6 IDENT@[3; 6) "foo"
7 PARAM_LIST@[6; 8)
8 L_PAREN@[6; 7)
9 R_PAREN@[7; 8)
10 WHITESPACE@[8; 9)
11 BLOCK@[9; 29)
12 L_CURLY@[9; 10)
13 WHITESPACE@[10; 11)
14 LET_STMT@[11; 27)
15 LET_KW@[11; 14)
16 WHITESPACE@[14; 15)
17 PLACEHOLDER_PAT@[15; 16)
18 UNDERSCORE@[15; 16)
19 WHITESPACE@[16; 17)
20 EQ@[17; 18)
21 WHITESPACE@[18; 19)
22 BLOCK_EXPR@[19; 27)
23 ASYNC_KW@[19; 24)
24 WHITESPACE@[24; 25)
25 BLOCK@[25; 27)
26 L_CURLY@[25; 26)
27 R_CURLY@[26; 27)
28 err: `expected SEMI`
29 WHITESPACE@[27; 28)
30 R_CURLY@[28; 29)
31 WHITESPACE@[29; 30)