aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src/tests
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-06-27 03:51:54 +0100
committerGitHub <[email protected]>2020-06-27 03:51:54 +0100
commit656cbc68a1f500510cd721cee2c3a515da53dc31 (patch)
tree92835abecdf6ed44b5b5cef2b20bfb695148ee51 /crates/ra_hir_ty/src/tests
parent9a4d02faf9c47f401b8756c3f7fcab2198f5f9cd (diff)
parent1f5d30ff1662eb94839bd1cf2e0cb57cc6fac4e4 (diff)
Merge #5033
5033: Order of glob imports should not affect import shadowing r=Nashenas88 a=Nashenas88 Fixes #5032 Co-authored-by: Paul Daniel Faria <[email protected]>
Diffstat (limited to 'crates/ra_hir_ty/src/tests')
-rw-r--r--crates/ra_hir_ty/src/tests/simple.rs46
1 files changed, 46 insertions, 0 deletions
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() {
1739 assert_eq!(t, "u32"); 1739 assert_eq!(t, "u32");
1740} 1740}
1741 1741
1742// This test is actually testing the shadowing behavior within ra_hir_def. It
1743// lives here because the testing infrastructure in ra_hir_def isn't currently
1744// capable of asserting the necessary conditions.
1745#[test]
1746fn should_be_shadowing_imports() {
1747 let t = type_at(
1748 r#"
1749mod a {
1750 pub fn foo() -> i8 {0}
1751 pub struct foo { a: i8 }
1752}
1753mod b { pub fn foo () -> u8 {0} }
1754mod c { pub struct foo { a: u8 } }
1755mod d {
1756 pub use super::a::*;
1757 pub use super::c::foo;
1758 pub use super::b::foo;
1759}
1760
1761fn main() {
1762 d::foo()<|>;
1763}"#,
1764 );
1765 assert_eq!(t, "u8");
1766
1767 let t = type_at(
1768 r#"
1769mod a {
1770 pub fn foo() -> i8 {0}
1771 pub struct foo { a: i8 }
1772}
1773mod b { pub fn foo () -> u8 {0} }
1774mod c { pub struct foo { a: u8 } }
1775mod d {
1776 pub use super::a::*;
1777 pub use super::c::foo;
1778 pub use super::b::foo;
1779}
1780
1781fn main() {
1782 d::foo{a:0<|>};
1783}"#,
1784 );
1785 assert_eq!(t, "u8");
1786}
1787
1742#[test] 1788#[test]
1743fn closure_return() { 1789fn closure_return() {
1744 assert_snapshot!( 1790 assert_snapshot!(