diff options
author | Edwin Cheng <[email protected]> | 2020-01-10 16:29:00 +0000 |
---|---|---|
committer | Edwin Cheng <[email protected]> | 2020-01-10 16:29:00 +0000 |
commit | ca62d98781f13b6fb82c4d19269ee255208fb3d4 (patch) | |
tree | d53420524b9f0ba46170f45cdca7bafbe953add4 | |
parent | 928ecd069a508845ef4dbfd1bc1b9bf975d76e5b (diff) |
Expand PAREN_EXPR as expression
-rw-r--r-- | crates/ra_hir_expand/src/db.rs | 1 | ||||
-rw-r--r-- | crates/ra_hir_ty/src/tests/regression.rs | 17 |
2 files changed, 18 insertions, 0 deletions
diff --git a/crates/ra_hir_expand/src/db.rs b/crates/ra_hir_expand/src/db.rs index 2e12e126f..d41b34161 100644 --- a/crates/ra_hir_expand/src/db.rs +++ b/crates/ra_hir_expand/src/db.rs | |||
@@ -187,6 +187,7 @@ fn to_fragment_kind(db: &dyn AstDatabase, macro_call_id: MacroCallId) -> Fragmen | |||
187 | ARG_LIST => FragmentKind::Expr, | 187 | ARG_LIST => FragmentKind::Expr, |
188 | TRY_EXPR => FragmentKind::Expr, | 188 | TRY_EXPR => FragmentKind::Expr, |
189 | TUPLE_EXPR => FragmentKind::Expr, | 189 | TUPLE_EXPR => FragmentKind::Expr, |
190 | PAREN_EXPR => FragmentKind::Expr, | ||
190 | ITEM_LIST => FragmentKind::Items, | 191 | ITEM_LIST => FragmentKind::Items, |
191 | _ => { | 192 | _ => { |
192 | // Unknown , Just guess it is `Items` | 193 | // Unknown , Just guess it is `Items` |
diff --git a/crates/ra_hir_ty/src/tests/regression.rs b/crates/ra_hir_ty/src/tests/regression.rs index 13c5f62e4..6c5d39549 100644 --- a/crates/ra_hir_ty/src/tests/regression.rs +++ b/crates/ra_hir_ty/src/tests/regression.rs | |||
@@ -310,6 +310,23 @@ fn test<R>(query_response: Canonical<QueryResponse<R>>) { | |||
310 | } | 310 | } |
311 | 311 | ||
312 | #[test] | 312 | #[test] |
313 | fn infer_paren_macro_call() { | ||
314 | assert_snapshot!( | ||
315 | infer(r#" | ||
316 | macro_rules! bar { () => {0u32} } | ||
317 | fn test() { | ||
318 | let a = (bar!()); | ||
319 | } | ||
320 | "#), | ||
321 | @r###" | ||
322 | ![0; 4) '0u32': u32 | ||
323 | [45; 70) '{ ...()); }': () | ||
324 | [55; 56) 'a': u32 | ||
325 | "### | ||
326 | ); | ||
327 | } | ||
328 | |||
329 | #[test] | ||
313 | fn bug_1030() { | 330 | fn bug_1030() { |
314 | assert_snapshot!(infer(r#" | 331 | assert_snapshot!(infer(r#" |
315 | struct HashSet<T, H>; | 332 | struct HashSet<T, H>; |