Skip to content

Commit 250d15a

Browse files
committed
Rust: More path resolution tests
1 parent 77df65f commit 250d15a

File tree

3 files changed

+318
-247
lines changed

3 files changed

+318
-247
lines changed

rust/ql/test/library-tests/path-resolution/CONSISTENCY/PathResolutionConsistency.expected

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ multipleCallTargets
44
| main.rs:369:9:371:16 | ...::f(...) |
55
| main.rs:450:9:454:16 | ...::f(...) |
66
| main.rs:455:9:459:16 | ...::f(...) |
7+
| main.rs:534:13:534:25 | ...::Assoc(...) |
8+
| main.rs:545:14:545:26 | ...::Assoc(...) |

rust/ql/test/library-tests/path-resolution/main.rs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,47 @@ mod m16 {
504504
let x: Self::AssocType = true; // $ item=S2Trait4AssocType
505505
}
506506
}
507+
508+
trait Trait5 {
509+
type Assoc; // Trait5Assoc
510+
511+
fn Assoc() -> Self::Assoc; // $ item=Trait5Assoc
512+
}
513+
514+
#[rustfmt::skip]
515+
impl Trait5 for S { // $ item=Trait5 item=I90
516+
type Assoc = i32 // $ item=i32
517+
; // AssocType
518+
519+
fn Assoc()
520+
-> Self::Assoc { // $ item=AssocType
521+
Self::Assoc() + 1 // $ item=AssocFunc
522+
} // AssocFunc
523+
}
524+
525+
struct S3<T3>(T3); // $ item=T3
526+
527+
#[rustfmt::skip]
528+
impl Trait5 for S3<i32> { // $ item=Trait5 item=S3 item=i32
529+
type Assoc = i32 // $ item=i32
530+
; // S3i32AssocType
531+
532+
fn Assoc()
533+
-> Self::Assoc { // $ item=S3i32AssocType
534+
Self::Assoc() + 1 // $ item=S3i32AssocFunc $ SPURIOUS: item=S3boolAssocFunc
535+
} // S3i32AssocFunc
536+
}
537+
538+
#[rustfmt::skip]
539+
impl Trait5 for S3<bool> { // $ item=Trait5 item=S3 item=bool
540+
type Assoc = bool // $ item=bool
541+
; // S3boolAssocType
542+
543+
fn Assoc()
544+
-> Self::Assoc { // $ item=S3boolAssocType
545+
!Self::Assoc() // $ item=S3boolAssocFunc $ SPURIOUS: item=S3i32AssocFunc
546+
} // S3boolAssocFunc
547+
}
507548
}
508549

509550
mod trait_visibility {

0 commit comments

Comments
 (0)