From 76755ce176222128c354647941cea65ac30ff4bd Mon Sep 17 00:00:00 2001 From: Paul Daniel Faria Date: Thu, 25 Jun 2020 21:34:39 -0400 Subject: Split glob import map to per-ns, switch ExprCollector to use a simpler push_res --- crates/ra_hir_ty/src/tests/simple.rs | 46 ++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'crates/ra_hir_ty/src/tests') diff --git a/crates/ra_hir_ty/src/tests/simple.rs b/crates/ra_hir_ty/src/tests/simple.rs index d7ef9add6..7d8197f8b 100644 --- a/crates/ra_hir_ty/src/tests/simple.rs +++ b/crates/ra_hir_ty/src/tests/simple.rs @@ -1739,6 +1739,52 @@ fn main() { assert_eq!(t, "u32"); } +// This test is actually testing the shadowing behavior within ra_hir_def. It +// lives here because the testing infrastructure in ra_hir_def isn't currently +// capable of asserting the necessary conditions. +#[test] +fn should_be_shadowing_imports() { + let t = type_at( + r#" +mod a { + pub fn foo() -> i8 {0} + pub struct foo { a: i8 } +} +mod b { pub fn foo () -> u8 {0} } +mod c { pub struct foo { a: u8 } } +mod d { + pub use super::a::*; + pub use super::c::foo; + pub use super::b::foo; +} + +fn main() { + d::foo()<|>; +}"#, + ); + assert_eq!(t, "u8"); + + let t = type_at( + r#" +mod a { + pub fn foo() -> i8 {0} + pub struct foo { a: i8 } +} +mod b { pub fn foo () -> u8 {0} } +mod c { pub struct foo { a: u8 } } +mod d { + pub use super::a::*; + pub use super::c::foo; + pub use super::b::foo; +} + +fn main() { + d::foo{a:0<|>}; +}"#, + ); + assert_eq!(t, "u8"); +} + #[test] fn closure_return() { assert_snapshot!( -- cgit v1.2.3