From d8d60215dacc3eeddeda4d6af7007e2129fdb00e Mon Sep 17 00:00:00 2001 From: DJMcNab <36049421+DJMcNab@users.noreply.github.com> Date: Fri, 21 Dec 2018 22:29:59 +0000 Subject: Fix handling of nested self in paths --- crates/ra_hir/src/module/nameres/tests.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'crates/ra_hir/src/module') diff --git a/crates/ra_hir/src/module/nameres/tests.rs b/crates/ra_hir/src/module/nameres/tests.rs index 9fa9146e3..3e29c3954 100644 --- a/crates/ra_hir/src/module/nameres/tests.rs +++ b/crates/ra_hir/src/module/nameres/tests.rs @@ -43,6 +43,25 @@ fn item_map_smoke_test() { assert!(resolution.def_id.is_some()); } +#[test] +fn test_self() { + let (item_map, module_id) = item_map( + " + //- /lib.rs + mod foo; + use crate::foo::bar::Baz::{self}; + <|> + //- /foo/mod.rs + pub mod bar; + //- /foo/bar.rs + pub struct Baz; + ", + ); + let name = SmolStr::from("Baz"); + let resolution = &item_map.per_module[&module_id].items[&name]; + assert!(resolution.def_id.is_some()); +} + #[test] fn item_map_across_crates() { let (mut db, sr) = MockDatabase::with_files( -- cgit v1.2.3