Skip to content

nothing #11903

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

nothing #11903

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion crates/hir/src/source_analyzer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,13 @@ fn resolve_hir_path_(
let (ty, remaining) =
resolver.resolve_path_in_type_ns(db.upcast(), path.mod_path())?;
match remaining {
Some(remaining) if remaining > 1 => None,
Some(remaining) if remaining > 1 => {
if remaining + 1 == path.segments().len() {
Some((ty, path.segments().last()))
} else {
None
}
}
_ => Some((ty, path.segments().get(1))),
}
}
Expand Down
43 changes: 43 additions & 0 deletions crates/ide/src/hover/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3764,6 +3764,49 @@ pub fn gimme() -> theitem::TheItem {
);
}

#[test]
fn test_hover_trait_assoc_typealias() {
check(
r#"
fn main() {}

trait T1 {
type Bar;
type Baz;
}

struct Foo;

mod t2 {
pub trait T2 {
type Bar;
}
}

use t2::T2;

impl T2 for Foo {
type Bar = String;
}

impl T1 for Foo {
type Bar = <Foo as t2::T2>::Ba$0r;
// ^^^ unresolvedReference
}
"#,
expect![[r#"
*Bar*

```rust
test::t2
```

```rust
pub type Bar
```
"#]],
);
}
#[test]
fn hover_generic_assoc() {
check(
Expand Down