diff options
author | Edwin Cheng <[email protected]> | 2019-12-23 05:18:28 +0000 |
---|---|---|
committer | Edwin Cheng <[email protected]> | 2019-12-23 05:19:01 +0000 |
commit | 16156d766dd8a5624d9455ffded6358fe879c416 (patch) | |
tree | 5e76885085a5a566cb1f946afd20bc5d2547334e /crates/ra_assists/src/assists | |
parent | 60aa4d12f95477565d5b01f122d2c9dd845015b4 (diff) |
Add macro call support for type_of
Diffstat (limited to 'crates/ra_assists/src/assists')
-rw-r--r-- | crates/ra_assists/src/assists/add_explicit_type.rs | 18 |
1 files changed, 18 insertions, 0 deletions
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 | |||
@@ -74,6 +74,24 @@ mod tests { | |||
74 | } | 74 | } |
75 | 75 | ||
76 | #[test] | 76 | #[test] |
77 | fn add_explicit_type_works_for_macro_call() { | ||
78 | check_assist( | ||
79 | add_explicit_type, | ||
80 | "macro_rules! v { () => {0u64} } fn f() { let a<|> = v!(); }", | ||
81 | "macro_rules! v { () => {0u64} } fn f() { let a<|>: u64 = v!(); }", | ||
82 | ); | ||
83 | } | ||
84 | |||
85 | #[test] | ||
86 | fn add_explicit_type_works_for_macro_call_recursive() { | ||
87 | check_assist( | ||
88 | add_explicit_type, | ||
89 | "macro_rules! u { () => {0u64} } macro_rules! v { () => {u!()} } fn f() { let a<|> = v!(); }", | ||
90 | "macro_rules! u { () => {0u64} } macro_rules! v { () => {u!()} } fn f() { let a<|>: u64 = v!(); }", | ||
91 | ); | ||
92 | } | ||
93 | |||
94 | #[test] | ||
77 | fn add_explicit_type_not_applicable_if_ty_not_inferred() { | 95 | fn add_explicit_type_not_applicable_if_ty_not_inferred() { |
78 | check_assist_not_applicable(add_explicit_type, "fn f() { let a<|> = None; }"); | 96 | check_assist_not_applicable(add_explicit_type, "fn f() { let a<|> = None; }"); |
79 | } | 97 | } |