aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-12-20 19:42:46 +0000
committerGitHub <[email protected]>2019-12-20 19:42:46 +0000
commitf578cd21823484cc1ee8e4273cd5c2f837934f34 (patch)
treef338b41371c1c6c43ad65ace01db4a996f770807 /crates/ra_hir_ty
parent825afb085452ea2ba365891504dc8339c756fb5e (diff)
parentad81d1dbc19803b5ccf1b230237642944edbff13 (diff)
Merge #2623
2623: Add support macros in impl blocks r=matklad a=edwin0cheng This PR add support for macros in impl blocks, which reuse `Expander` for macro expansion. see also: #2459 Co-authored-by: Edwin Cheng <[email protected]>
Diffstat (limited to 'crates/ra_hir_ty')
-rw-r--r--crates/ra_hir_ty/src/tests/macros.rs19
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]
186fn infer_impl_items_generated_by_macros() {
187 let t = type_at(
188 r#"
189//- /main.rs
190macro_rules! m {
191 () => (fn foo(&self) -> u128 {0})
192}
193struct S;
194impl S {
195 m!();
196}
197
198fn test() { S.foo()<|>; }
199"#,
200 );
201 assert_eq!(t, "u128");
202}
203
204#[test]
186fn infer_macro_with_dollar_crate_is_correct_in_expr() { 205fn 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#"