File tree 2 files changed +27
-1
lines changed
2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -584,7 +584,7 @@ impl<'a> FindUsages<'a> {
584
584
) -> bool {
585
585
match NameRefClass :: classify ( self . sema , name_ref) {
586
586
Some ( NameRefClass :: Definition ( Definition :: SelfType ( impl_) ) )
587
- if impl_. self_ty ( self . sema . db ) == * self_ty =>
587
+ if impl_. self_ty ( self . sema . db ) . as_adt ( ) == self_ty. as_adt ( ) =>
588
588
{
589
589
let FileRange { file_id, range } = self . sema . original_range ( name_ref. syntax ( ) ) ;
590
590
let reference = FileReference {
Original file line number Diff line number Diff line change @@ -683,6 +683,32 @@ enum Foo {
683
683
) ;
684
684
}
685
685
686
+ #[ test]
687
+ fn test_self ( ) {
688
+ check (
689
+ r#"
690
+ struct S$0<T> {
691
+ t: PhantomData<T>,
692
+ }
693
+
694
+ impl<T> S<T> {
695
+ fn new() -> Self {
696
+ Self {
697
+ t: Default::default(),
698
+ }
699
+ }
700
+ }
701
+ "# ,
702
+ expect ! [ [ r#"
703
+ S Struct FileId(0) 0..38 7..8
704
+
705
+ FileId(0) 48..49
706
+ FileId(0) 71..75
707
+ FileId(0) 86..90
708
+ "# ] ] ,
709
+ )
710
+ }
711
+
686
712
#[ test]
687
713
fn test_find_all_refs_two_modules ( ) {
688
714
check (
You can’t perform that action at this time.
0 commit comments