aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src/tests/traits.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_ty/src/tests/traits.rs')
-rw-r--r--crates/ra_hir_ty/src/tests/traits.rs27
1 files changed, 27 insertions, 0 deletions
diff --git a/crates/ra_hir_ty/src/tests/traits.rs b/crates/ra_hir_ty/src/tests/traits.rs
index 22ae6ca90..af8c63d64 100644
--- a/crates/ra_hir_ty/src/tests/traits.rs
+++ b/crates/ra_hir_ty/src/tests/traits.rs
@@ -2023,6 +2023,33 @@ fn main() {
2023} 2023}
2024 2024
2025#[test] 2025#[test]
2026fn associated_type_bound() {
2027 let t = type_at(
2028 r#"
2029//- /main.rs
2030pub trait Trait {
2031 type Item: OtherTrait<u32>;
2032}
2033pub trait OtherTrait<T> {
2034 fn foo(&self) -> T;
2035}
2036
2037// this is just a workaround for chalk#234
2038pub struct S<T>;
2039impl<T: Trait> Trait for S<T> {
2040 type Item = <T as Trait>::Item;
2041}
2042
2043fn test<T: Trait>() {
2044 let y: <S<T> as Trait>::Item = no_matter;
2045 y.foo()<|>;
2046}
2047"#,
2048 );
2049 assert_eq!(t, "u32");
2050}
2051
2052#[test]
2026fn dyn_trait_through_chalk() { 2053fn dyn_trait_through_chalk() {
2027 let t = type_at( 2054 let t = type_at(
2028 r#" 2055 r#"