diff options
Diffstat (limited to 'crates/ra_hir_ty')
-rw-r--r-- | crates/ra_hir_ty/src/tests.rs | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/crates/ra_hir_ty/src/tests.rs b/crates/ra_hir_ty/src/tests.rs index c856d6afd..a3cc5cf95 100644 --- a/crates/ra_hir_ty/src/tests.rs +++ b/crates/ra_hir_ty/src/tests.rs | |||
@@ -3694,6 +3694,42 @@ fn main() { | |||
3694 | } | 3694 | } |
3695 | 3695 | ||
3696 | #[test] | 3696 | #[test] |
3697 | fn not_shadowing_primitive_by_module() { | ||
3698 | let t = type_at( | ||
3699 | r#" | ||
3700 | //- /str.rs | ||
3701 | fn foo() {} | ||
3702 | |||
3703 | //- /main.rs | ||
3704 | mod str; | ||
3705 | fn foo() -> &'static str { "" } | ||
3706 | |||
3707 | fn main() { | ||
3708 | foo()<|>; | ||
3709 | }"#, | ||
3710 | ); | ||
3711 | assert_eq!(t, "&str"); | ||
3712 | } | ||
3713 | |||
3714 | #[test] | ||
3715 | fn not_shadowing_module_by_primitive() { | ||
3716 | let t = type_at( | ||
3717 | r#" | ||
3718 | //- /str.rs | ||
3719 | fn foo() -> u32 {0} | ||
3720 | |||
3721 | //- /main.rs | ||
3722 | mod str; | ||
3723 | fn foo() -> &'static str { "" } | ||
3724 | |||
3725 | fn main() { | ||
3726 | str::foo()<|>; | ||
3727 | }"#, | ||
3728 | ); | ||
3729 | assert_eq!(t, "u32"); | ||
3730 | } | ||
3731 | |||
3732 | #[test] | ||
3697 | fn deref_trait() { | 3733 | fn deref_trait() { |
3698 | let t = type_at( | 3734 | let t = type_at( |
3699 | r#" | 3735 | r#" |