aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-12-01 11:13:25 +0000
committerGitHub <[email protected]>2019-12-01 11:13:25 +0000
commitec164fbb68a4252ef56497ba95501c0f4417ef4e (patch)
tree904a0248de4794e650898c00be116fcec36c19e0 /crates/ra_hir_ty
parent780f476b4f438d473bc2e2299c2b8bf0a6fb9257 (diff)
parentcfc6e9e36646aa3b961018be875a7c3474aa7577 (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.rs36
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]
3697fn not_shadowing_primitive_by_module() {
3698 let t = type_at(
3699 r#"
3700//- /str.rs
3701fn foo() {}
3702
3703//- /main.rs
3704mod str;
3705fn foo() -> &'static str { "" }
3706
3707fn main() {
3708 foo()<|>;
3709}"#,
3710 );
3711 assert_eq!(t, "&str");
3712}
3713
3714#[test]
3715fn not_shadowing_module_by_primitive() {
3716 let t = type_at(
3717 r#"
3718//- /str.rs
3719fn foo() -> u32 {0}
3720
3721//- /main.rs
3722mod str;
3723fn foo() -> &'static str { "" }
3724
3725fn main() {
3726 str::foo()<|>;
3727}"#,
3728 );
3729 assert_eq!(t, "u32");
3730}
3731
3732#[test]
3697fn deref_trait() { 3733fn deref_trait() {
3698 let t = type_at( 3734 let t = type_at(
3699 r#" 3735 r#"