Skip to content

Commit 9a44f62

Browse files
Merge #2785
2785: Expand PAREN_EXPR as expression r=matklad a=edwin0cheng Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2 parents 2068e48 + ca62d98 commit 9a44f62

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

crates/ra_hir_expand/src/db.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ fn to_fragment_kind(db: &dyn AstDatabase, macro_call_id: MacroCallId) -> Fragmen
187187
ARG_LIST => FragmentKind::Expr,
188188
TRY_EXPR => FragmentKind::Expr,
189189
TUPLE_EXPR => FragmentKind::Expr,
190+
PAREN_EXPR => FragmentKind::Expr,
190191
ITEM_LIST => FragmentKind::Items,
191192
_ => {
192193
// Unknown , Just guess it is `Items`

crates/ra_hir_ty/src/tests/regression.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,23 @@ fn test<R>(query_response: Canonical<QueryResponse<R>>) {
309309
);
310310
}
311311

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+
312329
#[test]
313330
fn bug_1030() {
314331
assert_snapshot!(infer(r#"

0 commit comments

Comments
 (0)