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 | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/crates/hir-ty/src/tests/traits.rs b/crates/hir-ty/src/tests/traits.rs index eb4ae5ec8a..677e35775d 100644 --- a/crates/hir-ty/src/tests/traits.rs +++ b/crates/hir-ty/src/tests/traits.rs @@ -4134,7 +4134,7 @@ trait Trait { } fn f(t: &dyn Trait<T = (), T = ()>) {} - //^&'? {unknown} + //^&'? (dyn Trait<T = ()> + 'static) "#, ); } @@ -5056,3 +5056,26 @@ trait MoveMessage { "#, ); } + +#[test] +fn dyn_trait_supertrait_projections_are_elaborated() { + check_types( + r#" +//- minicore: deref, sized, unsize, coerce_unsized, dispatch_from_dyn +use core::ops::Deref; + +struct Base; + +impl Base { + fn func(&self) -> i32 { 111 } +} + +trait BaseLayerOne: Deref<Target = Base>{} + +fn foo(base_layer_two: &dyn BaseLayerOne) { + let _r = base_layer_two.func(); + // ^^ i32 +} + "#, + ); +} |