1 // run-pass
2 #![allow(dead_code)]
3 // Test that we are handle to correctly handle a projection type
4 // that appears in a supertrait bound. Issue #20559.
5 
6 
7 trait A
8 {
9     type TA;
10 
dummy(&self)11     fn dummy(&self) { }
12 }
13 
14 trait B<TB>
15 {
foo(&self, t : TB) -> String16     fn foo (&self, t : TB) -> String;
17 }
18 
19 trait C<TC : A> : B<<TC as A>::TA> { }
20 
21 struct X;
22 
23 impl A for X
24 {
25     type TA = i32;
26 }
27 
28 struct Y;
29 
30 impl C<X> for Y { }
31 
32 // Both of these impls are required for successful compilation
33 impl B<i32> for Y
34 {
35     fn foo (&self, t : i32) -> String
36     {
37         format!("First {}", t)
38     }
39 }
40 
41 fn main ()
42 {
43     let y = Y;
44     assert_eq!(y.foo(5), format!("First 5"));
45 }
46