diff options
Diffstat (limited to 'crates/ra_hir_ty')
-rw-r--r-- | crates/ra_hir_ty/src/tests/simple.rs | 46 |
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] | ||
1746 | fn should_be_shadowing_imports() { | ||
1747 | let t = type_at( | ||
1748 | r#" | ||
1749 | mod a { | ||
1750 | pub fn foo() -> i8 {0} | ||
1751 | pub struct foo { a: i8 } | ||
1752 | } | ||
1753 | mod b { pub fn foo () -> u8 {0} } | ||
1754 | mod c { pub struct foo { a: u8 } } | ||
1755 | mod d { | ||
1756 | pub use super::a::*; | ||
1757 | pub use super::c::foo; | ||
1758 | pub use super::b::foo; | ||
1759 | } | ||
1760 | |||
1761 | fn main() { | ||
1762 | d::foo()<|>; | ||
1763 | }"#, | ||
1764 | ); | ||
1765 | assert_eq!(t, "u8"); | ||
1766 | |||
1767 | let t = type_at( | ||
1768 | r#" | ||
1769 | mod a { | ||
1770 | pub fn foo() -> i8 {0} | ||
1771 | pub struct foo { a: i8 } | ||
1772 | } | ||
1773 | mod b { pub fn foo () -> u8 {0} } | ||
1774 | mod c { pub struct foo { a: u8 } } | ||
1775 | mod d { | ||
1776 | pub use super::a::*; | ||
1777 | pub use super::c::foo; | ||
1778 | pub use super::b::foo; | ||
1779 | } | ||
1780 | |||
1781 | fn main() { | ||
1782 | d::foo{a:0<|>}; | ||
1783 | }"#, | ||
1784 | ); | ||
1785 | assert_eq!(t, "u8"); | ||
1786 | } | ||
1787 | |||
1742 | #[test] | 1788 | #[test] |
1743 | fn closure_return() { | 1789 | fn closure_return() { |
1744 | assert_snapshot!( | 1790 | assert_snapshot!( |