mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 15:15:24 +00:00
Display fully qualified associated types correctly
Currently they are formatted in the internal `Trait<Self = Type>::Assoc` forms where `hir_ty::TypeRef` is formatted, like hover.
This commit is contained in:
parent
af4ba46b40
commit
3bfe1d5d78
2 changed files with 78 additions and 7 deletions
|
@ -1556,6 +1556,49 @@ fn test_hover_function_show_types() {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_hover_function_associated_type_params() {
|
||||
check(
|
||||
r#"
|
||||
trait Foo { type Bar; }
|
||||
impl Foo for i32 { type Bar = i64; }
|
||||
fn foo(arg: <i32 as Foo>::Bar) {}
|
||||
fn main() { foo$0; }
|
||||
"#,
|
||||
expect![[r#"
|
||||
*foo*
|
||||
|
||||
```rust
|
||||
test
|
||||
```
|
||||
|
||||
```rust
|
||||
fn foo(arg: <i32 as Foo>::Bar)
|
||||
```
|
||||
"#]],
|
||||
);
|
||||
|
||||
check(
|
||||
r#"
|
||||
trait Foo<T> { type Bar<U>; }
|
||||
impl Foo<i64> for i32 { type Bar<U> = i32; }
|
||||
fn foo(arg: <<i32 as Foo<i64>>::Bar<i8> as Foo<i64>>::Bar<i8>) {}
|
||||
fn main() { foo$0; }
|
||||
"#,
|
||||
expect![[r#"
|
||||
*foo*
|
||||
|
||||
```rust
|
||||
test
|
||||
```
|
||||
|
||||
```rust
|
||||
fn foo(arg: <<i32 as Foo<i64>>::Bar<i8> as Foo<i64>>::Bar<i8>)
|
||||
```
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_hover_function_pointer_show_identifiers() {
|
||||
check(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue