File tree Expand file tree Collapse file tree 3 files changed +982
-916
lines changed
rust/ql/test/library-tests/type-inference Expand file tree Collapse file tree 3 files changed +982
-916
lines changed Original file line number Diff line number Diff line change
1
+ multipleMethodCallTargets
2
+ | main.rs:401:26:401:42 | x.common_method() | main.rs:376:9:379:9 | fn common_method |
3
+ | main.rs:401:26:401:42 | x.common_method() | main.rs:388:9:391:9 | fn common_method |
4
+ | main.rs:402:26:402:44 | x.common_method_2() | main.rs:381:9:384:9 | fn common_method_2 |
5
+ | main.rs:402:26:402:44 | x.common_method_2() | main.rs:393:9:396:9 | fn common_method_2 |
Original file line number Diff line number Diff line change @@ -362,6 +362,47 @@ mod method_non_parametric_trait_impl {
362
362
}
363
363
}
364
364
365
+ mod impl_overlap {
366
+ #[ derive( Debug , Clone , Copy ) ]
367
+ struct S1 ;
368
+
369
+ trait OverlappingTrait {
370
+ fn common_method ( self ) -> S1 ;
371
+
372
+ fn common_method_2 ( self , s1 : S1 ) -> S1 ;
373
+ }
374
+
375
+ impl OverlappingTrait for S1 {
376
+ // <S1_as_OverlappingTrait>::common_method
377
+ fn common_method ( self ) -> S1 {
378
+ panic ! ( "not called" ) ;
379
+ }
380
+
381
+ // <S1_as_OverlappingTrait>::common_method_2
382
+ fn common_method_2 ( self , s1 : S1 ) -> S1 {
383
+ panic ! ( "not called" ) ;
384
+ }
385
+ }
386
+
387
+ impl S1 {
388
+ // S1::common_method
389
+ fn common_method ( self ) -> S1 {
390
+ self
391
+ }
392
+
393
+ // S1::common_method_2
394
+ fn common_method_2 ( self ) -> S1 {
395
+ self
396
+ }
397
+ }
398
+
399
+ pub fn f ( ) {
400
+ let x = S1 ;
401
+ println ! ( "{:?}" , x. common_method( ) ) ; // $ method=S1::common_method SPURIOUS: method=<S1_as_OverlappingTrait>::common_method
402
+ println ! ( "{:?}" , x. common_method_2( ) ) ; // $ method=S1::common_method_2 SPURIOUS: method=<S1_as_OverlappingTrait>::common_method_2
403
+ }
404
+ }
405
+
365
406
mod type_parameter_bounds {
366
407
use std:: fmt:: Debug ;
367
408
You can’t perform that action at this time.
0 commit comments