File tree Expand file tree Collapse file tree 2 files changed +372
-321
lines changed
rust/ql/test/library-tests/type-inference Expand file tree Collapse file tree 2 files changed +372
-321
lines changed Original file line number Diff line number Diff line change @@ -2295,6 +2295,10 @@ mod explicit_type_args {
2295
2295
field : T5 ,
2296
2296
}
2297
2297
2298
+ fn foo < T > ( x : T ) -> T {
2299
+ x
2300
+ }
2301
+
2298
2302
pub fn f ( ) {
2299
2303
let x1: Option < S1 < S2 > > = S1 :: assoc_fun ( ) ; // $ type=x1:T.T.S2 method=assoc_fun
2300
2304
let x2 = S1 :: < S2 > :: assoc_fun ( ) ; // $ type=x2:T.T.S2 method=assoc_fun
@@ -2315,6 +2319,7 @@ mod explicit_type_args {
2315
2319
{
2316
2320
field : S2 :: default ( ) , // $ method=default
2317
2321
} ;
2322
+ let x14 = foo :: < i32 > ( Default :: default ( ) ) ; // $ type=x14:i32 method=default method=foo
2318
2323
}
2319
2324
}
2320
2325
@@ -2457,6 +2462,27 @@ pub mod pattern_matching {
2457
2462
_ => ( ) ,
2458
2463
}
2459
2464
2465
+ let opt1 = Some ( Default :: default ( ) ) ; // $ MISSING: type=opt1:T.i32 method=default
2466
+ #[ rustfmt:: skip]
2467
+ let _ = if let Some :: < i32 > ( x) = opt1
2468
+ {
2469
+ x; // $ MISSING: type=x:i32
2470
+ } ;
2471
+
2472
+ let opt2 = Some ( Default :: default ( ) ) ; // $ MISSING: type=opt2:T.i32 method=default
2473
+ #[ rustfmt:: skip]
2474
+ let _ = if let Option :: Some :: < i32 > ( x) = opt2
2475
+ {
2476
+ x; // $ MISSING: type=x:i32
2477
+ } ;
2478
+
2479
+ let opt3 = Some ( Default :: default ( ) ) ; // $ type=opt3:T.i32 method=default
2480
+ #[ rustfmt:: skip]
2481
+ let _ = if let Option :: < i32 > :: Some ( x) = opt3
2482
+ {
2483
+ x; // $ type=x:i32
2484
+ } ;
2485
+
2460
2486
None
2461
2487
}
2462
2488
}
You can’t perform that action at this time.
0 commit comments