Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/tests/traits.rs')
| -rw-r--r-- | crates/hir-ty/src/tests/traits.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/crates/hir-ty/src/tests/traits.rs b/crates/hir-ty/src/tests/traits.rs index 677e35775d..a54c0a799d 100644 --- a/crates/hir-ty/src/tests/traits.rs +++ b/crates/hir-ty/src/tests/traits.rs @@ -5079,3 +5079,23 @@ fn foo(base_layer_two: &dyn BaseLayerOne) { "#, ); } + +#[test] +fn default_assoc_types() { + check_types( + r#" +trait Trait<T> { + type Assoc<U> = (T, U); + fn method(self) -> Self::Assoc<i32> { loop {} } +} + +struct Struct<T>(T); +impl<T> Trait<((), T)> for Struct<T> {} + +fn foo(v: Struct<f32>) { + v.method(); + // ^^^^^^^^^^ (((), f32), i32) +} + "#, + ); +} |