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.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/crates/hir-ty/src/tests/traits.rs b/crates/hir-ty/src/tests/traits.rs
index 48dd954032..003ae60e8e 100644
--- a/crates/hir-ty/src/tests/traits.rs
+++ b/crates/hir-ty/src/tests/traits.rs
@@ -2598,6 +2598,34 @@ fn test<T: Trait>() {
}
#[test]
+fn associated_type_in_type_bound() {
+ check_types(
+ r#"
+//- minicore: deref
+fn fb(f: Foo<&u8>) {
+ f.foobar();
+ //^^^^^^^^^^ u8
+}
+trait Bar {
+ fn bar(&self) -> u8;
+}
+impl Bar for u8 {
+ fn bar(&self) -> u8 { *self }
+}
+
+struct Foo<F> {
+ foo: F,
+}
+impl<F: core::ops::Deref<Target = impl Bar>> Foo<F> {
+ fn foobar(&self) -> u8 {
+ self.foo.deref().bar()
+ }
+}
+"#,
+ )
+}
+
+#[test]
fn dyn_trait_through_chalk() {
check_types(
r#"