Add BuiltinShadowMode

This commit is contained in:
Edwin Cheng 2019-11-30 23:29:21 +08:00
parent 8b278b1ab6
commit bb601e7eaf
7 changed files with 157 additions and 31 deletions

View file

@ -3641,6 +3641,42 @@ fn main() {
assert_eq!(t, "Foo");
}
#[test]
fn not_shadowing_primitive_by_module() {
let t = type_at(
r#"
//- /str.rs
fn foo() {}
//- /main.rs
mod str;
fn foo() -> &'static str { "" }
fn main() {
foo()<|>;
}"#,
);
assert_eq!(t, "&str");
}
#[test]
fn not_shadowing_module_by_primitive() {
let t = type_at(
r#"
//- /str.rs
fn foo() -> u32 {0}
//- /main.rs
mod str;
fn foo() -> &'static str { "" }
fn main() {
str::foo()<|>;
}"#,
);
assert_eq!(t, "u32");
}
#[test]
fn deref_trait() {
let t = type_at(