From fe78a14bbb9769c8ccd5cc41415702f5176a8e88 Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Sat, 14 Mar 2020 14:25:30 +0800 Subject: Support local macro_rules --- crates/ra_hir_ty/src/tests/macros.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'crates/ra_hir_ty') diff --git a/crates/ra_hir_ty/src/tests/macros.rs b/crates/ra_hir_ty/src/tests/macros.rs index 32457bbf7..3b7022ad5 100644 --- a/crates/ra_hir_ty/src/tests/macros.rs +++ b/crates/ra_hir_ty/src/tests/macros.rs @@ -362,6 +362,26 @@ fn main() { ); } +#[test] +fn infer_local_macro() { + assert_snapshot!( + infer(r#" +fn main() { + macro_rules! foo { + () => { 1usize } + } + let _a = foo!(); +} +"#), + @r###" + ![0; 6) '1usize': usize + [11; 90) '{ ...!(); }': () + [17; 66) 'macro_... }': {unknown} + [75; 77) '_a': usize + "### + ); +} + #[test] fn infer_builtin_macros_line() { assert_snapshot!( -- cgit v1.2.3