From a5a07bde049c59059bc4a68b16a49a174d22cf65 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Mon, 2 Dec 2019 19:27:31 +0100 Subject: Add tests for checking the impl self type --- crates/ra_hir_ty/src/tests.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'crates/ra_hir_ty/src') diff --git a/crates/ra_hir_ty/src/tests.rs b/crates/ra_hir_ty/src/tests.rs index d28e835c7..d5b8d10e2 100644 --- a/crates/ra_hir_ty/src/tests.rs +++ b/crates/ra_hir_ty/src/tests.rs @@ -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; +impl S { fn foo(&self) -> u8 {} } +impl S { fn foo(&self) -> i8 {} } +fn test() { (S::.foo(), S::.foo())<|>; } +"#, + ); + assert_eq!(t, "(u8, i8)"); +} + #[test] fn method_resolution_trait_before_autoref() { let t = type_at( -- cgit v1.2.3