File tree Expand file tree Collapse file tree 3 files changed +868
-801
lines changed
rust/ql/test/library-tests/type-inference
shared/typeinference/codeql/typeinference/internal Expand file tree Collapse file tree 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 {
275275 }
276276 }
277277
278+ // Type parameter with bound occurs in the root of a parameter type.
278279 fn call_trait_m1 < T1 , T2 : MyTrait < T1 > > ( x : T2 ) -> T1 {
279280 x. m1 ( )
280281 }
281282
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+
282288 impl < T > MyTrait < T > for MyThing < T > {
283289 fn m1 ( self ) -> T {
284290 self . a
@@ -298,11 +304,21 @@ mod function_trait_bounds {
298304 println ! ( "{:?}" , x. m2( ) ) ;
299305 println ! ( "{:?}" , y. m2( ) ) ;
300306
301- let x = MyThing { a : S1 } ;
302- let y = MyThing { a : S2 } ;
307+ let x2 = MyThing { a : S1 } ;
308+ let y2 = MyThing { a : S2 } ;
303309
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) ) ;
306322 }
307323}
308324
You can’t perform that action at this time.
0 commit comments