diff options
author | Florian Diebold <[email protected]> | 2019-12-02 18:27:31 +0000 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2019-12-02 18:33:13 +0000 |
commit | a5a07bde049c59059bc4a68b16a49a174d22cf65 (patch) | |
tree | 85d98a376e1e55aea6fa2bcdc4bbfa1f69ec45d9 /crates/ra_hir_ty | |
parent | cfa50df33e1ebfa89f7fbdece7454699f858de92 (diff) |
Add tests for checking the impl self type
Diffstat (limited to 'crates/ra_hir_ty')
-rw-r--r-- | crates/ra_hir_ty/src/tests.rs | 14 |
1 files changed, 14 insertions, 0 deletions
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 | |||
@@ -3434,6 +3434,20 @@ pub fn baz() -> usize { 31usize } | |||
3434 | } | 3434 | } |
3435 | 3435 | ||
3436 | #[test] | 3436 | #[test] |
3437 | fn method_resolution_unify_impl_self_type() { | ||
3438 | let t = type_at( | ||
3439 | r#" | ||
3440 | //- /main.rs | ||
3441 | struct S<T>; | ||
3442 | impl S<u32> { fn foo(&self) -> u8 {} } | ||
3443 | impl S<i32> { fn foo(&self) -> i8 {} } | ||
3444 | fn test() { (S::<u32>.foo(), S::<i32>.foo())<|>; } | ||
3445 | "#, | ||
3446 | ); | ||
3447 | assert_eq!(t, "(u8, i8)"); | ||
3448 | } | ||
3449 | |||
3450 | #[test] | ||
3437 | fn method_resolution_trait_before_autoref() { | 3451 | fn method_resolution_trait_before_autoref() { |
3438 | let t = type_at( | 3452 | let t = type_at( |
3439 | r#" | 3453 | r#" |