From 63e330f402136a3a447f497f800752314bdb5a50 Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Sat, 2 Jan 2021 22:06:59 +0800 Subject: Fix infer error of macro invocation in array expr --- crates/hir_ty/src/tests/regression.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'crates/hir_ty/src/tests') diff --git a/crates/hir_ty/src/tests/regression.rs b/crates/hir_ty/src/tests/regression.rs index 307a257b1..cffe8630b 100644 --- a/crates/hir_ty/src/tests/regression.rs +++ b/crates/hir_ty/src/tests/regression.rs @@ -325,6 +325,24 @@ fn infer_paren_macro_call() { ); } +#[test] +fn infer_array_macro_call() { + check_infer( + r#" + macro_rules! bar { () => {0u32} } + fn test() { + let a = [bar!()]; + } + "#, + expect![[r#" + !0..4 '0u32': u32 + 44..69 '{ ...()]; }': () + 54..55 'a': [u32; _] + 58..66 '[bar!()]': [u32; _] + "#]], + ); +} + #[test] fn bug_1030() { check_infer( -- cgit v1.2.3