@@ -7,7 +7,7 @@ impl<A> Wrapper<A> {
77 }
88}
99
10- #[ derive( Debug , Default ) ]
10+ #[ derive( Debug , Default , Clone , Copy ) ]
1111struct S ;
1212
1313#[ derive( Debug , Default ) ]
@@ -270,6 +270,41 @@ mod type_param_access_associated_type {
270270 }
271271 }
272272
273+ // Associated type accessed on another associated type
274+
275+ fn tp_nested_assoc_type < T : GetSet > ( thing : T ) -> <<T as GetSet >:: Output as GetSet >:: Output
276+ where
277+ <T as GetSet >:: Output : GetSet ,
278+ {
279+ thing. get ( ) . get ( ) // $ target=GetSet::get target=GetSet::get
280+ }
281+
282+ pub trait GetSetWrap {
283+ type Assoc : GetSet ;
284+
285+ // GetSetWrap::get_wrap
286+ fn get_wrap ( & self ) -> Self :: Assoc ;
287+ }
288+
289+ impl GetSetWrap for S {
290+ type Assoc = S ;
291+
292+ // S::get_wrap
293+ fn get_wrap ( & self ) -> Self :: Assoc {
294+ S
295+ }
296+ }
297+
298+ // Nested associated type accessed on a type parameter of an impl block
299+ impl < TI > Wrapper < TI >
300+ where
301+ TI : GetSetWrap ,
302+ {
303+ fn extract2 ( & self ) -> <<TI as GetSetWrap >:: Assoc as GetSet >:: Output {
304+ self . 0 . get_wrap ( ) . get ( ) // $ fieldof=Wrapper target=GetSetWrap::get_wrap $ MISSING: target=GetSet::get
305+ }
306+ }
307+
273308 pub fn test ( ) {
274309 let _o1 = tp_with_as ( S ) ; // $ target=tp_with_as type=_o1:S3
275310 let _o2 = tp_without_as ( S ) ; // $ target=tp_without_as type=_o2:S3
@@ -278,8 +313,12 @@ mod type_param_access_associated_type {
278313 _o4, // $ type=_o4:bool
279314 ) = tp_assoc_from_supertrait ( S ) ; // $ target=tp_assoc_from_supertrait
280315
316+ let _o5 = tp_nested_assoc_type ( Wrapper ( S ) ) ; // $ target=tp_nested_assoc_type MISSING: type=_o5:S3
317+
281318 let w = Wrapper ( S ) ;
282319 let _extracted = w. extract ( ) ; // $ target=extract type=_extracted:S3
320+
321+ let _extracted2 = w. extract2 ( ) ; // $ target=extract2 MISSING: type=_extracted2:S3
283322 }
284323}
285324
0 commit comments