From 16156d766dd8a5624d9455ffded6358fe879c416 Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Mon, 23 Dec 2019 13:18:28 +0800 Subject: Add macro call support for type_of --- crates/ra_assists/src/assists/add_explicit_type.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'crates/ra_assists/src') diff --git a/crates/ra_assists/src/assists/add_explicit_type.rs b/crates/ra_assists/src/assists/add_explicit_type.rs index eeb4ff39f..2c602a79e 100644 --- a/crates/ra_assists/src/assists/add_explicit_type.rs +++ b/crates/ra_assists/src/assists/add_explicit_type.rs @@ -73,6 +73,24 @@ mod tests { ); } + #[test] + fn add_explicit_type_works_for_macro_call() { + check_assist( + add_explicit_type, + "macro_rules! v { () => {0u64} } fn f() { let a<|> = v!(); }", + "macro_rules! v { () => {0u64} } fn f() { let a<|>: u64 = v!(); }", + ); + } + + #[test] + fn add_explicit_type_works_for_macro_call_recursive() { + check_assist( + add_explicit_type, + "macro_rules! u { () => {0u64} } macro_rules! v { () => {u!()} } fn f() { let a<|> = v!(); }", + "macro_rules! u { () => {0u64} } macro_rules! v { () => {u!()} } fn f() { let a<|>: u64 = v!(); }", + ); + } + #[test] fn add_explicit_type_not_applicable_if_ty_not_inferred() { check_assist_not_applicable(add_explicit_type, "fn f() { let a<|> = None; }"); -- cgit v1.2.3