From e50201345ecc91b9eeb284cd04c6b55f9c5ce0fd Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Fri, 21 Feb 2020 13:47:49 +0100 Subject: Normalize associated types in types coming from Chalk Fixes #3232. --- crates/ra_hir_ty/src/tests/traits.rs | 42 ++++++++++++++++++++++++++++++++++++ 1 file changed, 42 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 aa2018944..7d796d0b9 100644 --- a/crates/ra_hir_ty/src/tests/traits.rs +++ b/crates/ra_hir_ty/src/tests/traits.rs @@ -1910,3 +1910,45 @@ fn test() -> impl Trait { "### ); } + +#[test] +fn assoc_types_from_bounds() { + assert_snapshot!( + infer(r#" +//- /main.rs +#[lang = "fn_once"] +trait FnOnce { + type Output; +} + +trait T { + type O; +} + +impl T for () { + type O = (); +} + +fn f(_v: F) +where + X: T, + F: FnOnce(&X::O), +{ } + +fn main() { + f::<(), _>(|z| { z; }); +} +"#), + @r###" + [147; 149) '_v': F + [192; 195) '{ }': () + [207; 238) '{ ... }); }': () + [213; 223) 'f::<(), _>': fn f<(), |&()| -> ()>(|&()| -> ()) -> () + [213; 235) 'f::<()... z; })': () + [224; 234) '|z| { z; }': |&()| -> () + [225; 226) 'z': &() + [228; 234) '{ z; }': () + [230; 231) 'z': &() + "### + ); +} -- cgit v1.2.3