diff options
Diffstat (limited to 'crates/hir_ty/src/tests')
-rw-r--r-- | crates/hir_ty/src/tests/traits.rs | 45 |
1 files changed, 42 insertions, 3 deletions
diff --git a/crates/hir_ty/src/tests/traits.rs b/crates/hir_ty/src/tests/traits.rs index 7ad8b5830..e98d7c064 100644 --- a/crates/hir_ty/src/tests/traits.rs +++ b/crates/hir_ty/src/tests/traits.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | use expect_test::expect; | 1 | use expect_test::expect; |
2 | use test_utils::mark; | 2 | use test_utils::mark; |
3 | 3 | ||
4 | use super::{check_infer, check_infer_with_mismatches, check_types}; | 4 | use super::{check_infer, check_infer_with_mismatches, check_types, check_types_source_code}; |
5 | 5 | ||
6 | #[test] | 6 | #[test] |
7 | fn infer_await() { | 7 | fn infer_await() { |
@@ -907,7 +907,7 @@ fn test<T: Trait>(t: T) { (*t); } | |||
907 | } | 907 | } |
908 | 908 | ||
909 | #[test] | 909 | #[test] |
910 | fn associated_type_placeholder() { | 910 | fn associated_type_inlay_hints() { |
911 | check_types( | 911 | check_types( |
912 | r#" | 912 | r#" |
913 | pub trait ApplyL { | 913 | pub trait ApplyL { |
@@ -929,7 +929,7 @@ fn test<T: ApplyL>() { | |||
929 | } | 929 | } |
930 | 930 | ||
931 | #[test] | 931 | #[test] |
932 | fn associated_type_placeholder_2() { | 932 | fn associated_type_inlay_hints_2() { |
933 | check_types( | 933 | check_types( |
934 | r#" | 934 | r#" |
935 | pub trait ApplyL { | 935 | pub trait ApplyL { |
@@ -946,6 +946,45 @@ fn test<T: ApplyL>(t: T) { | |||
946 | } | 946 | } |
947 | 947 | ||
948 | #[test] | 948 | #[test] |
949 | fn associated_type_placeholder() { | ||
950 | check_types_source_code( | ||
951 | r#" | ||
952 | pub trait ApplyL { | ||
953 | type Out; | ||
954 | } | ||
955 | |||
956 | pub struct RefMutL<T>; | ||
957 | |||
958 | impl<T> ApplyL for RefMutL<T> { | ||
959 | type Out = <T as ApplyL>::Out; | ||
960 | } | ||
961 | |||
962 | fn test<T: ApplyL>() { | ||
963 | let y: <RefMutL<T> as ApplyL>::Out = no_matter; | ||
964 | y; | ||
965 | } //^ ApplyL::Out<T> | ||
966 | "#, | ||
967 | ); | ||
968 | } | ||
969 | |||
970 | #[test] | ||
971 | fn associated_type_placeholder_2() { | ||
972 | check_types_source_code( | ||
973 | r#" | ||
974 | pub trait ApplyL { | ||
975 | type Out; | ||
976 | } | ||
977 | fn foo<T: ApplyL>(t: T) -> <T as ApplyL>::Out; | ||
978 | |||
979 | fn test<T: ApplyL>(t: T) { | ||
980 | let y = foo(t); | ||
981 | y; | ||
982 | } //^ ApplyL::Out<T> | ||
983 | "#, | ||
984 | ); | ||
985 | } | ||
986 | |||
987 | #[test] | ||
949 | fn argument_impl_trait() { | 988 | fn argument_impl_trait() { |
950 | check_infer_with_mismatches( | 989 | check_infer_with_mismatches( |
951 | r#" | 990 | r#" |