diff options
author | Edwin Cheng <[email protected]> | 2019-12-20 19:37:03 +0000 |
---|---|---|
committer | Edwin Cheng <[email protected]> | 2019-12-20 19:37:03 +0000 |
commit | ad81d1dbc19803b5ccf1b230237642944edbff13 (patch) | |
tree | 5af29382643b659b69523e65354e862d7e71087d /crates/ra_hir_ty/src/tests | |
parent | cfc50ff160d0af2ce5cd931c6d41161abfdb2fbd (diff) |
Add support macros in impl blocks
Diffstat (limited to 'crates/ra_hir_ty/src/tests')
-rw-r--r-- | crates/ra_hir_ty/src/tests/macros.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/crates/ra_hir_ty/src/tests/macros.rs b/crates/ra_hir_ty/src/tests/macros.rs index 812f171db..7fdbf996f 100644 --- a/crates/ra_hir_ty/src/tests/macros.rs +++ b/crates/ra_hir_ty/src/tests/macros.rs | |||
@@ -183,6 +183,25 @@ fn test() { S.foo()<|>; } | |||
183 | } | 183 | } |
184 | 184 | ||
185 | #[test] | 185 | #[test] |
186 | fn infer_impl_items_generated_by_macros() { | ||
187 | let t = type_at( | ||
188 | r#" | ||
189 | //- /main.rs | ||
190 | macro_rules! m { | ||
191 | () => (fn foo(&self) -> u128 {0}) | ||
192 | } | ||
193 | struct S; | ||
194 | impl S { | ||
195 | m!(); | ||
196 | } | ||
197 | |||
198 | fn test() { S.foo()<|>; } | ||
199 | "#, | ||
200 | ); | ||
201 | assert_eq!(t, "u128"); | ||
202 | } | ||
203 | |||
204 | #[test] | ||
186 | fn infer_macro_with_dollar_crate_is_correct_in_expr() { | 205 | fn infer_macro_with_dollar_crate_is_correct_in_expr() { |
187 | let (db, pos) = TestDB::with_position( | 206 | let (db, pos) = TestDB::with_position( |
188 | r#" | 207 | r#" |