From 13f30e9ef5f3d78fdaef450e935782a2edd9f88e Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Thu, 18 Mar 2021 19:39:40 +0800 Subject: Handle inner recursive macro rules cases --- crates/hir_ty/src/tests/macros.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'crates/hir_ty/src') diff --git a/crates/hir_ty/src/tests/macros.rs b/crates/hir_ty/src/tests/macros.rs index af4f8bb11..c1e605740 100644 --- a/crates/hir_ty/src/tests/macros.rs +++ b/crates/hir_ty/src/tests/macros.rs @@ -231,6 +231,28 @@ fn expr_macro_expanded_in_stmts() { ); } +#[test] +fn recursive_inner_item_macro_rules() { + check_infer( + r#" + macro_rules! mac { + () => { mac!($)}; + ($x:tt) => { macro_rules! blub { () => { 1 }; } }; + } + fn foo() { + mac!(); + let a = blub!(); + } + "#, + expect![[r#" + !0..1 '1': i32 + !0..7 'mac!($)': {unknown} + 107..143 '{ ...!(); }': () + 129..130 'a': i32 + "#]], + ); +} + #[test] fn infer_type_value_macro_having_same_name() { check_infer( -- cgit v1.2.3