Skip to content

Commit 077fc9f

Browse files
committed
Rust: Add type inference test for associated type acces on a type parameter of an impl block
1 parent 1203da1 commit 077fc9f

File tree

2 files changed

+528
-495
lines changed

2 files changed

+528
-495
lines changed

rust/ql/test/library-tests/type-inference/associated_types.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,13 +260,26 @@ mod type_param_access_associated_type {
260260
)
261261
}
262262

263+
// Associated type accessed on a type parameter of an impl block
264+
impl<TI> Wrapper<TI>
265+
where
266+
TI: GetSet,
267+
{
268+
fn extract(&self) -> TI::Output {
269+
self.0.get() // $ fieldof=Wrapper target=GetSet::get
270+
}
271+
}
272+
263273
pub fn test() {
264274
let _o1 = tp_with_as(S); // $ target=tp_with_as MISSING: type=_o1:S3
265275
let _o2 = tp_without_as(S); // $ target=tp_without_as MISSING: type=_o2:S3
266276
let (
267277
_o3, // $ MISSING: type=_o3:S3
268278
_o4, // $ MISSING: type=_o4:bool
269279
) = tp_assoc_from_supertrait(S); // $ target=tp_assoc_from_supertrait
280+
281+
let w = Wrapper(S);
282+
let _extracted = w.extract(); // $ target=extract MISSING: type=_extracted:S3
270283
}
271284
}
272285

0 commit comments

Comments
 (0)