From 8762b797fd37e9a9cab3e5fe534a9672f30e6022 Mon Sep 17 00:00:00 2001 From: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com> Date: Wed, 28 Oct 2020 11:20:05 +0100 Subject: do not use associated types placeholder for inlay hint Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com> --- crates/hir_ty/src/tests/traits.rs | 45 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) (limited to 'crates/hir_ty/src/tests') 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 @@ use expect_test::expect; use test_utils::mark; -use super::{check_infer, check_infer_with_mismatches, check_types}; +use super::{check_infer, check_infer_with_mismatches, check_types, check_types_source_code}; #[test] fn infer_await() { @@ -907,7 +907,7 @@ fn test(t: T) { (*t); } } #[test] -fn associated_type_placeholder() { +fn associated_type_inlay_hints() { check_types( r#" pub trait ApplyL { @@ -929,7 +929,7 @@ fn test() { } #[test] -fn associated_type_placeholder_2() { +fn associated_type_inlay_hints_2() { check_types( r#" pub trait ApplyL { @@ -945,6 +945,45 @@ fn test(t: T) { ); } +#[test] +fn associated_type_placeholder() { + check_types_source_code( + r#" +pub trait ApplyL { + type Out; +} + +pub struct RefMutL; + +impl ApplyL for RefMutL { + type Out = ::Out; +} + +fn test() { + let y: as ApplyL>::Out = no_matter; + y; +} //^ ApplyL::Out +"#, + ); +} + +#[test] +fn associated_type_placeholder_2() { + check_types_source_code( + r#" +pub trait ApplyL { + type Out; +} +fn foo(t: T) -> ::Out; + +fn test(t: T) { + let y = foo(t); + y; +} //^ ApplyL::Out +"#, + ); +} + #[test] fn argument_impl_trait() { check_infer_with_mismatches( -- cgit v1.2.3