aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_ty/src')
-rw-r--r--crates/hir_ty/src/diagnostics/decl_check.rs15
-rw-r--r--crates/hir_ty/src/tests/macros.rs22
2 files changed, 36 insertions, 1 deletions
diff --git a/crates/hir_ty/src/diagnostics/decl_check.rs b/crates/hir_ty/src/diagnostics/decl_check.rs
index bfe239793..33a0f4d7d 100644
--- a/crates/hir_ty/src/diagnostics/decl_check.rs
+++ b/crates/hir_ty/src/diagnostics/decl_check.rs
@@ -102,7 +102,7 @@ impl<'a, 'b> DeclValidator<'a, 'b> {
102 let db = self.db; 102 let db = self.db;
103 for block_def_map in body.block_scopes.iter().filter_map(|block| db.block_def_map(*block)) { 103 for block_def_map in body.block_scopes.iter().filter_map(|block| db.block_def_map(*block)) {
104 for (_, module) in block_def_map.modules() { 104 for (_, module) in block_def_map.modules() {
105 for (def_id, _) in module.scope.values() { 105 for def_id in module.scope.declarations() {
106 let mut validator = DeclValidator::new(self.db, self.krate, self.sink); 106 let mut validator = DeclValidator::new(self.db, self.krate, self.sink);
107 validator.validate_item(def_id); 107 validator.validate_item(def_id);
108 } 108 }
@@ -902,4 +902,17 @@ extern {
902 "#, 902 "#,
903 ); 903 );
904 } 904 }
905
906 #[test]
907 fn infinite_loop_inner_items() {
908 check_diagnostics(
909 r#"
910fn qualify() {
911 mod foo {
912 use super::*;
913 }
914}
915 "#,
916 )
917 }
905} 918}
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
@@ -232,6 +232,28 @@ fn expr_macro_expanded_in_stmts() {
232} 232}
233 233
234#[test] 234#[test]
235fn recursive_inner_item_macro_rules() {
236 check_infer(
237 r#"
238 macro_rules! mac {
239 () => { mac!($)};
240 ($x:tt) => { macro_rules! blub { () => { 1 }; } };
241 }
242 fn foo() {
243 mac!();
244 let a = blub!();
245 }
246 "#,
247 expect![[r#"
248 !0..1 '1': i32
249 !0..7 'mac!($)': {unknown}
250 107..143 '{ ...!(); }': ()
251 129..130 'a': i32
252 "#]],
253 );
254}
255
256#[test]
235fn infer_type_value_macro_having_same_name() { 257fn infer_type_value_macro_having_same_name() {
236 check_infer( 258 check_infer(
237 r#" 259 r#"