File tree 3 files changed +868
-801
lines changed
rust/ql/test/library-tests/type-inference
shared/typeinference/codeql/typeinference/internal
3 files changed +868
-801
lines changed Original file line number Diff line number Diff line change @@ -275,10 +275,16 @@ mod function_trait_bounds {
275
275
}
276
276
}
277
277
278
+ // Type parameter with bound occurs in the root of a parameter type.
278
279
fn call_trait_m1 < T1 , T2 : MyTrait < T1 > > ( x : T2 ) -> T1 {
279
280
x. m1 ( )
280
281
}
281
282
283
+ // Type parameter with bound occurs nested within another type.
284
+ fn call_trait_thing_m1 < T1 , T2 : MyTrait < T1 > > ( x : MyThing < T2 > ) -> T1 {
285
+ x. a . m1 ( )
286
+ }
287
+
282
288
impl < T > MyTrait < T > for MyThing < T > {
283
289
fn m1 ( self ) -> T {
284
290
self . a
@@ -298,11 +304,21 @@ mod function_trait_bounds {
298
304
println ! ( "{:?}" , x. m2( ) ) ;
299
305
println ! ( "{:?}" , y. m2( ) ) ;
300
306
301
- let x = MyThing { a : S1 } ;
302
- let y = MyThing { a : S2 } ;
307
+ let x2 = MyThing { a : S1 } ;
308
+ let y2 = MyThing { a : S2 } ;
303
309
304
- println ! ( "{:?}" , call_trait_m1( x) ) ; // missing
305
- println ! ( "{:?}" , call_trait_m1( y) ) ; // missing
310
+ println ! ( "{:?}" , call_trait_m1( x2) ) ;
311
+ println ! ( "{:?}" , call_trait_m1( y2) ) ;
312
+
313
+ let x3 = MyThing {
314
+ a : MyThing { a : S1 } ,
315
+ } ;
316
+ let y3 = MyThing {
317
+ a : MyThing { a : S2 } ,
318
+ } ;
319
+
320
+ println ! ( "{:?}" , call_trait_thing_m1( x3) ) ;
321
+ println ! ( "{:?}" , call_trait_thing_m1( y3) ) ;
306
322
}
307
323
}
308
324
You can’t perform that action at this time.
0 commit comments