2785: Expand PAREN_EXPR as expression r=matklad a=edwin0cheng



Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
This commit is contained in:
bors[bot] 2020-01-10 16:31:02 +00:00 committed by GitHub
commit 9a44f627be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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,
TRY_EXPR => FragmentKind::Expr,
TUPLE_EXPR => FragmentKind::Expr,
PAREN_EXPR => FragmentKind::Expr,
ITEM_LIST => FragmentKind::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]
fn bug_1030() {
assert_snapshot!(infer(r#"