diff options
Diffstat (limited to 'crates/hir_ty')
-rw-r--r-- | crates/hir_ty/src/lower.rs | 2 | ||||
-rw-r--r-- | crates/hir_ty/src/tests/macros.rs | 26 |
2 files changed, 27 insertions, 1 deletions
diff --git a/crates/hir_ty/src/lower.rs b/crates/hir_ty/src/lower.rs index afbfa12d5..14f34d73c 100644 --- a/crates/hir_ty/src/lower.rs +++ b/crates/hir_ty/src/lower.rs | |||
@@ -146,7 +146,7 @@ impl<'a> TyLoweringContext<'a> { | |||
146 | self.lower_ty_ext(type_ref).0 | 146 | self.lower_ty_ext(type_ref).0 |
147 | } | 147 | } |
148 | 148 | ||
149 | fn lower_ty_ext(&self, type_ref: &TypeRef) -> (Ty, Option<TypeNs>) { | 149 | pub fn lower_ty_ext(&self, type_ref: &TypeRef) -> (Ty, Option<TypeNs>) { |
150 | let mut res = None; | 150 | let mut res = None; |
151 | let ty = match type_ref { | 151 | let ty = match type_ref { |
152 | TypeRef::Never => TyKind::Never.intern(&Interner), | 152 | TypeRef::Never => TyKind::Never.intern(&Interner), |
diff --git a/crates/hir_ty/src/tests/macros.rs b/crates/hir_ty/src/tests/macros.rs index 3eb01dbd0..86e3d8b86 100644 --- a/crates/hir_ty/src/tests/macros.rs +++ b/crates/hir_ty/src/tests/macros.rs | |||
@@ -373,6 +373,32 @@ fn recursive_inner_item_macro_rules() { | |||
373 | } | 373 | } |
374 | 374 | ||
375 | #[test] | 375 | #[test] |
376 | fn infer_macro_defining_block_with_items() { | ||
377 | check_infer( | ||
378 | r#" | ||
379 | macro_rules! foo { | ||
380 | () => {{ | ||
381 | fn bar() -> usize { 0 } | ||
382 | bar() | ||
383 | }}; | ||
384 | } | ||
385 | fn main() { | ||
386 | let _a = foo!(); | ||
387 | } | ||
388 | "#, | ||
389 | expect![[r#" | ||
390 | !15..18 '{0}': usize | ||
391 | !16..17 '0': usize | ||
392 | !0..24 '{fnbar...bar()}': usize | ||
393 | !18..21 'bar': fn bar() -> usize | ||
394 | !18..23 'bar()': usize | ||
395 | 98..122 '{ ...!(); }': () | ||
396 | 108..110 '_a': usize | ||
397 | "#]], | ||
398 | ); | ||
399 | } | ||
400 | |||
401 | #[test] | ||
376 | fn infer_type_value_macro_having_same_name() { | 402 | fn infer_type_value_macro_having_same_name() { |
377 | check_infer( | 403 | check_infer( |
378 | r#" | 404 | r#" |