]>
Commit | Line | Data |
---|---|---|
32a655c1 SL |
1 | #![feature(associated_type_defaults)] |
2 | ||
3 | trait Tr { | |
4 | type Y = u16; | |
5 | fn Y() {} | |
6 | } | |
7 | impl Tr for u8 {} | |
8 | ||
9 | trait Dr { | |
10 | type X = u16; | |
11 | fn Z() {} | |
12 | } | |
13 | impl Dr for u8 {} | |
14 | ||
15 | enum E { Y } | |
16 | type A = u32; | |
17 | ||
18 | fn main() { | |
19 | let _: <u8 as Tr>::N; //~ ERROR cannot find associated type `N` in trait `Tr` | |
20 | let _: <u8 as E>::N; //~ ERROR cannot find associated type `N` in enum `E` | |
21 | let _: <u8 as A>::N; //~ ERROR cannot find associated type `N` in `A` | |
22 | <u8 as Tr>::N; //~ ERROR cannot find method or associated constant `N` in trait `Tr` | |
23 | <u8 as E>::N; //~ ERROR cannot find method or associated constant `N` in enum `E` | |
24 | <u8 as A>::N; //~ ERROR cannot find method or associated constant `N` in `A` | |
25 | let _: <u8 as Tr>::Y; // OK | |
26 | let _: <u8 as E>::Y; //~ ERROR expected associated type, found variant `E::Y` | |
27 | <u8 as Tr>::Y; // OK | |
28 | <u8 as E>::Y; //~ ERROR expected method or associated constant, found unit variant `E::Y` | |
29 | ||
30 | let _: <u8 as Tr>::N::NN; //~ ERROR cannot find associated type `N` in trait `Tr` | |
31 | let _: <u8 as E>::N::NN; //~ ERROR cannot find associated type `N` in enum `E` | |
32 | let _: <u8 as A>::N::NN; //~ ERROR cannot find associated type `N` in `A` | |
33 | <u8 as Tr>::N::NN; //~ ERROR cannot find associated type `N` in trait `Tr` | |
34 | <u8 as E>::N::NN; //~ ERROR cannot find associated type `N` in enum `E` | |
35 | <u8 as A>::N::NN; //~ ERROR cannot find associated type `N` in `A` | |
36 | let _: <u8 as Tr>::Y::NN; //~ ERROR ambiguous associated type | |
37 | let _: <u8 as E>::Y::NN; //~ ERROR expected associated type, found variant `E::Y` | |
74b04a01 | 38 | <u8 as Tr>::Y::NN; //~ ERROR no associated item named `NN` found for type `u16` |
32a655c1 SL |
39 | <u8 as E>::Y::NN; //~ ERROR expected associated type, found variant `E::Y` |
40 | ||
41 | let _: <u8 as Tr::N>::NN; //~ ERROR cannot find associated type `NN` in `Tr::N` | |
42 | let _: <u8 as E::N>::NN; //~ ERROR cannot find associated type `NN` in `E::N` | |
43 | let _: <u8 as A::N>::NN; //~ ERROR cannot find associated type `NN` in `A::N` | |
44 | <u8 as Tr::N>::NN; //~ ERROR cannot find method or associated constant `NN` in `Tr::N` | |
45 | <u8 as E::N>::NN; //~ ERROR cannot find method or associated constant `NN` in `E::N` | |
46 | <u8 as A::N>::NN; //~ ERROR cannot find method or associated constant `NN` in `A::N` | |
47 | let _: <u8 as Tr::Y>::NN; //~ ERROR cannot find associated type `NN` in `Tr::Y` | |
48663c56 | 48 | let _: <u8 as E::Y>::NN; //~ ERROR failed to resolve: `Y` is a variant, not a module |
32a655c1 | 49 | <u8 as Tr::Y>::NN; //~ ERROR cannot find method or associated constant `NN` in `Tr::Y` |
48663c56 | 50 | <u8 as E::Y>::NN; //~ ERROR failed to resolve: `Y` is a variant, not a module |
32a655c1 | 51 | |
ba9703b0 | 52 | let _: <u8 as Dr>::Z; //~ ERROR expected associated type, found associated function `Dr::Z` |
32a655c1 | 53 | <u8 as Dr>::X; //~ ERROR expected method or associated constant, found associated type `Dr::X` |
ba9703b0 | 54 | let _: <u8 as Dr>::Z::N; //~ ERROR expected associated type, found associated function `Dr::Z` |
74b04a01 | 55 | <u8 as Dr>::X::N; //~ ERROR no associated item named `N` found for type `u16` |
32a655c1 | 56 | } |