aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/tests
diff options
context:
space:
mode:
authorBenjamin Coenen <[email protected]>2020-10-28 10:20:05 +0000
committerBenjamin Coenen <[email protected]>2020-10-28 10:20:05 +0000
commit8762b797fd37e9a9cab3e5fe534a9672f30e6022 (patch)
tree9963daa57cd59318cc9a855b5cf665b174027c5f /crates/hir_ty/src/tests
parent73161cc9cdcdf7b9f797d7984f2cad497a3f4553 (diff)
do not use associated types placeholder for inlay hint
Signed-off-by: Benjamin Coenen <[email protected]>
Diffstat (limited to 'crates/hir_ty/src/tests')
-rw-r--r--crates/hir_ty/src/tests/traits.rs45
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 @@
1use expect_test::expect; 1use expect_test::expect;
2use test_utils::mark; 2use test_utils::mark;
3 3
4use super::{check_infer, check_infer_with_mismatches, check_types}; 4use super::{check_infer, check_infer_with_mismatches, check_types, check_types_source_code};
5 5
6#[test] 6#[test]
7fn infer_await() { 7fn infer_await() {
@@ -907,7 +907,7 @@ fn test<T: Trait>(t: T) { (*t); }
907} 907}
908 908
909#[test] 909#[test]
910fn associated_type_placeholder() { 910fn associated_type_inlay_hints() {
911 check_types( 911 check_types(
912 r#" 912 r#"
913pub trait ApplyL { 913pub trait ApplyL {
@@ -929,7 +929,7 @@ fn test<T: ApplyL>() {
929} 929}
930 930
931#[test] 931#[test]
932fn associated_type_placeholder_2() { 932fn associated_type_inlay_hints_2() {
933 check_types( 933 check_types(
934 r#" 934 r#"
935pub trait ApplyL { 935pub trait ApplyL {
@@ -946,6 +946,45 @@ fn test<T: ApplyL>(t: T) {
946} 946}
947 947
948#[test] 948#[test]
949fn associated_type_placeholder() {
950 check_types_source_code(
951 r#"
952pub trait ApplyL {
953 type Out;
954}
955
956pub struct RefMutL<T>;
957
958impl<T> ApplyL for RefMutL<T> {
959 type Out = <T as ApplyL>::Out;
960}
961
962fn 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]
971fn associated_type_placeholder_2() {
972 check_types_source_code(
973 r#"
974pub trait ApplyL {
975 type Out;
976}
977fn foo<T: ApplyL>(t: T) -> <T as ApplyL>::Out;
978
979fn test<T: ApplyL>(t: T) {
980 let y = foo(t);
981 y;
982} //^ ApplyL::Out<T>
983"#,
984 );
985}
986
987#[test]
949fn argument_impl_trait() { 988fn argument_impl_trait() {
950 check_infer_with_mismatches( 989 check_infer_with_mismatches(
951 r#" 990 r#"