aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src
diff options
context:
space:
mode:
authorEdwin Cheng <[email protected]>2019-11-30 15:29:21 +0000
committerEdwin Cheng <[email protected]>2019-11-30 15:29:21 +0000
commitbb601e7eafa00e471a5306ac920f0be6c809aab0 (patch)
treed6713da23941b3e4daac0914d77221c357558db8 /crates/ra_hir_ty/src
parent8b278b1ab660df0728508e45e88ac769a2e03a58 (diff)
Add BuiltinShadowMode
Diffstat (limited to 'crates/ra_hir_ty/src')
-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 abbc1546c..3766ab981 100644
--- a/crates/ra_hir_ty/src/tests.rs
+++ b/crates/ra_hir_ty/src/tests.rs
@@ -3642,6 +3642,42 @@ fn main() {
3642} 3642}
3643 3643
3644#[test] 3644#[test]
3645fn not_shadowing_primitive_by_module() {
3646 let t = type_at(
3647 r#"
3648//- /str.rs
3649fn foo() {}
3650
3651//- /main.rs
3652mod str;
3653fn foo() -> &'static str { "" }
3654
3655fn main() {
3656 foo()<|>;
3657}"#,
3658 );
3659 assert_eq!(t, "&str");
3660}
3661
3662#[test]
3663fn not_shadowing_module_by_primitive() {
3664 let t = type_at(
3665 r#"
3666//- /str.rs
3667fn foo() -> u32 {0}
3668
3669//- /main.rs
3670mod str;
3671fn foo() -> &'static str { "" }
3672
3673fn main() {
3674 str::foo()<|>;
3675}"#,
3676 );
3677 assert_eq!(t, "u32");
3678}
3679
3680#[test]
3645fn deref_trait() { 3681fn deref_trait() {
3646 let t = type_at( 3682 let t = type_at(
3647 r#" 3683 r#"