From 497073abc66df21b178c931e91969fccd8afcdc3 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Sun, 26 Apr 2020 16:56:25 +0200 Subject: For associated type shorthand (T::Item), use the substs from the where clause So e.g. if we have `fn foo>() -> T::Item`, we want to lower that to `>::Item` and not `>::Item`. --- crates/ra_hir_ty/src/tests/traits.rs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'crates/ra_hir_ty/src/tests') diff --git a/crates/ra_hir_ty/src/tests/traits.rs b/crates/ra_hir_ty/src/tests/traits.rs index f51cdd496..e555c879a 100644 --- a/crates/ra_hir_ty/src/tests/traits.rs +++ b/crates/ra_hir_ty/src/tests/traits.rs @@ -1897,6 +1897,36 @@ fn test() { assert_eq!(t, "u32"); } +#[test] +fn unselected_projection_chalk_fold() { + let t = type_at( + r#" +//- /main.rs +trait Interner {} +trait Fold { + type Result; +} + +struct Ty {} +impl Fold for Ty { + type Result = Ty; +} + +fn fold(interner: &I, t: T) -> T::Result +where + T: Fold, +{ + loop {} +} + +fn foo(interner: &I, t: Ty) { + fold(interner, t)<|>; +} +"#, + ); + assert_eq!(t, "Ty"); +} + #[test] fn trait_impl_self_ty() { let t = type_at( -- cgit v1.2.3