From 4e603b79474ee37c7f8191c5e0defc8240c11bf4 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Thu, 21 Jan 2021 16:42:56 +0100 Subject: Add test for nameres in nested blocks --- crates/hir_def/src/nameres/tests/block.rs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'crates/hir_def/src') diff --git a/crates/hir_def/src/nameres/tests/block.rs b/crates/hir_def/src/nameres/tests/block.rs index ab7ec9d62..b6c007920 100644 --- a/crates/hir_def/src/nameres/tests/block.rs +++ b/crates/hir_def/src/nameres/tests/block.rs @@ -70,3 +70,32 @@ fn outer() { "#]], ); } + +#[test] +fn nested_blocks() { + check_at( + r#" +//- /lib.rs +fn outer() { + struct inner1 {} + fn inner() { + use inner1; + use outer; + fn inner2() {} + $0 + } +} +"#, + expect![[r#" + block scope + inner1: t + inner2: v + outer: v + block scope + inner: v + inner1: t + crate + outer: v + "#]], + ); +} -- cgit v1.2.3