aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src/tests.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_ty/src/tests.rs')
-rw-r--r--crates/ra_hir_ty/src/tests.rs31
1 files changed, 29 insertions, 2 deletions
diff --git a/crates/ra_hir_ty/src/tests.rs b/crates/ra_hir_ty/src/tests.rs
index a3cc5cf95..d5b8d10e2 100644
--- a/crates/ra_hir_ty/src/tests.rs
+++ b/crates/ra_hir_ty/src/tests.rs
@@ -3433,7 +3433,20 @@ pub fn baz() -> usize { 31usize }
3433 assert_eq!("(i32, usize)", type_at_pos(&db, pos)); 3433 assert_eq!("(i32, usize)", type_at_pos(&db, pos));
3434} 3434}
3435 3435
3436#[ignore] 3436#[test]
3437fn method_resolution_unify_impl_self_type() {
3438 let t = type_at(
3439 r#"
3440//- /main.rs
3441struct S<T>;
3442impl S<u32> { fn foo(&self) -> u8 {} }
3443impl S<i32> { fn foo(&self) -> i8 {} }
3444fn test() { (S::<u32>.foo(), S::<i32>.foo())<|>; }
3445"#,
3446 );
3447 assert_eq!(t, "(u8, i8)");
3448}
3449
3437#[test] 3450#[test]
3438fn method_resolution_trait_before_autoref() { 3451fn method_resolution_trait_before_autoref() {
3439 let t = type_at( 3452 let t = type_at(
@@ -3449,7 +3462,6 @@ fn test() { S.foo()<|>; }
3449 assert_eq!(t, "u128"); 3462 assert_eq!(t, "u128");
3450} 3463}
3451 3464
3452#[ignore]
3453#[test] 3465#[test]
3454fn method_resolution_by_value_before_autoref() { 3466fn method_resolution_by_value_before_autoref() {
3455 let t = type_at( 3467 let t = type_at(
@@ -3496,6 +3508,21 @@ fn test() { S.foo()<|>; }
3496} 3508}
3497 3509
3498#[test] 3510#[test]
3511fn method_resolution_impl_ref_before_trait() {
3512 let t = type_at(
3513 r#"
3514//- /main.rs
3515trait Trait { fn foo(self) -> u128; }
3516struct S;
3517impl S { fn foo(&self) -> i8 { 0 } }
3518impl Trait for &S { fn foo(self) -> u128 { 0 } }
3519fn test() { S.foo()<|>; }
3520"#,
3521 );
3522 assert_eq!(t, "i8");
3523}
3524
3525#[test]
3499fn method_resolution_trait_autoderef() { 3526fn method_resolution_trait_autoderef() {
3500 let t = type_at( 3527 let t = type_at(
3501 r#" 3528 r#"