Add tests for checking the impl self type

This commit is contained in:
Florian Diebold 2019-12-02 19:27:31 +01:00
parent cfa50df33e
commit a5a07bde04
2 changed files with 47 additions and 0 deletions

View file

@ -3433,6 +3433,20 @@ pub fn baz() -> usize { 31usize }
assert_eq!("(i32, usize)", type_at_pos(&db, pos));
}
#[test]
fn method_resolution_unify_impl_self_type() {
let t = type_at(
r#"
//- /main.rs
struct S<T>;
impl S<u32> { fn foo(&self) -> u8 {} }
impl S<i32> { fn foo(&self) -> i8 {} }
fn test() { (S::<u32>.foo(), S::<i32>.foo())<|>; }
"#,
);
assert_eq!(t, "(u8, i8)");
}
#[test]
fn method_resolution_trait_before_autoref() {
let t = type_at(