File tree 2 files changed +50
-1
lines changed
2 files changed +50
-1
lines changed Original file line number Diff line number Diff line change @@ -652,7 +652,13 @@ fn resolve_hir_path_(
652
652
let ( ty, remaining) =
653
653
resolver. resolve_path_in_type_ns ( db. upcast ( ) , path. mod_path ( ) ) ?;
654
654
match remaining {
655
- Some ( remaining) if remaining > 1 => None ,
655
+ Some ( remaining) if remaining > 1 => {
656
+ if remaining + 1 == path. segments ( ) . len ( ) {
657
+ Some ( ( ty, path. segments ( ) . last ( ) ) )
658
+ } else {
659
+ None
660
+ }
661
+ }
656
662
_ => Some ( ( ty, path. segments ( ) . get ( 1 ) ) ) ,
657
663
}
658
664
}
Original file line number Diff line number Diff line change @@ -3764,6 +3764,49 @@ pub fn gimme() -> theitem::TheItem {
3764
3764
) ;
3765
3765
}
3766
3766
3767
+ #[ test]
3768
+ fn test_hover_trait_assoc_typealias ( ) {
3769
+ check (
3770
+ r#"
3771
+ fn main() {}
3772
+
3773
+ trait T1 {
3774
+ type Bar;
3775
+ type Baz;
3776
+ }
3777
+
3778
+ struct Foo;
3779
+
3780
+ mod t2 {
3781
+ pub trait T2 {
3782
+ type Bar;
3783
+ }
3784
+ }
3785
+
3786
+ use t2::T2;
3787
+
3788
+ impl T2 for Foo {
3789
+ type Bar = String;
3790
+ }
3791
+
3792
+ impl T1 for Foo {
3793
+ type Bar = <Foo as t2::T2>::Ba$0r;
3794
+ // ^^^ unresolvedReference
3795
+ }
3796
+ "# ,
3797
+ expect ! [ [ r#"
3798
+ *Bar*
3799
+
3800
+ ```rust
3801
+ test::t2
3802
+ ```
3803
+
3804
+ ```rust
3805
+ pub type Bar
3806
+ ```
3807
+ "# ] ] ,
3808
+ ) ;
3809
+ }
3767
3810
#[ test]
3768
3811
fn hover_generic_assoc ( ) {
3769
3812
check (
You can’t perform that action at this time.
0 commit comments