]>
Commit | Line | Data |
---|---|---|
b7449926 | 1 | // run-pass |
1a4d82fc JJ |
2 | |
3 | ||
4 | // Tests that we can call a function bounded over a supertrait from | |
5 | // a default method | |
223e47cc | 6 | |
c34b1796 | 7 | fn require_y<T: Y>(x: T) -> isize { x.y() } |
1a4d82fc JJ |
8 | |
9 | trait Y { | |
c34b1796 | 10 | fn y(self) -> isize; |
1a4d82fc | 11 | } |
223e47cc | 12 | |
223e47cc | 13 | |
1a4d82fc | 14 | trait Z: Y + Sized { |
c34b1796 | 15 | fn x(self) -> isize { |
1a4d82fc JJ |
16 | require_y(self) |
17 | } | |
18 | } | |
19 | ||
c34b1796 AL |
20 | impl Y for isize { |
21 | fn y(self) -> isize { self } | |
1a4d82fc JJ |
22 | } |
23 | ||
c34b1796 | 24 | impl Z for isize {} |
970d7e83 | 25 | |
1a4d82fc JJ |
26 | pub fn main() { |
27 | assert_eq!(12.x(), 12); | |
223e47cc | 28 | } |