diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-12-01 11:13:25 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2019-12-01 11:13:25 +0000 |
commit | ec164fbb68a4252ef56497ba95501c0f4417ef4e (patch) | |
tree | 904a0248de4794e650898c00be116fcec36c19e0 /crates/ra_hir_ty | |
parent | 780f476b4f438d473bc2e2299c2b8bf0a6fb9257 (diff) | |
parent | cfc6e9e36646aa3b961018be875a7c3474aa7577 (diff) |
Merge #2455
2455: Add BuiltinShadowMode r=flodiebold a=edwin0cheng
This PR try to fix #1905 by introduce an `BuiltinShadowMode` in name resolving functions.
cc @flodiebold
Co-authored-by: Edwin Cheng <[email protected]>
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#" |