mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-16 17:58:16 +00:00
Merge #2785
2785: Expand PAREN_EXPR as expression r=matklad a=edwin0cheng Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
This commit is contained in:
commit
9a44f627be
2 changed files with 18 additions and 0 deletions
|
@ -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`
|
||||
|
|
|
@ -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#"
|
||||
|
|
Loading…
Reference in a new issue