Expand PAREN_EXPR as expression

This commit is contained in:
Edwin Cheng 2020-01-11 00:29:00 +08:00
parent 928ecd069a
commit ca62d98781
2 changed files with 18 additions and 0 deletions

View file

@ -187,6 +187,7 @@ fn to_fragment_kind(db: &dyn AstDatabase, macro_call_id: MacroCallId) -> Fragmen
ARG_LIST => FragmentKind::Expr, ARG_LIST => FragmentKind::Expr,
TRY_EXPR => FragmentKind::Expr, TRY_EXPR => FragmentKind::Expr,
TUPLE_EXPR => FragmentKind::Expr, TUPLE_EXPR => FragmentKind::Expr,
PAREN_EXPR => FragmentKind::Expr,
ITEM_LIST => FragmentKind::Items, ITEM_LIST => FragmentKind::Items,
_ => { _ => {
// Unknown , Just guess it is `Items` // Unknown , Just guess it is `Items`

View file

@ -309,6 +309,23 @@ fn test<R>(query_response: Canonical<QueryResponse<R>>) {
); );
} }
#[test]
fn infer_paren_macro_call() {
assert_snapshot!(
infer(r#"
macro_rules! bar { () => {0u32} }
fn test() {
let a = (bar!());
}
"#),
@r###"
![0; 4) '0u32': u32
[45; 70) '{ ...()); }': ()
[55; 56) 'a': u32
"###
);
}
#[test] #[test]
fn bug_1030() { fn bug_1030() {
assert_snapshot!(infer(r#" assert_snapshot!(infer(r#"