1 // Checks that applied type arguments of enums, and aliases to them, are respected.
2 // For example, `Self` is never a type constructor. Therefore, no types can be applied to it.
4 // We also check that the variant to an type-aliased enum cannot be type applied whether
5 // that alias is generic or monomorphic.
7 enum Enum<T> { TSVariant(T), SVariant { v: T }, UVariant }
8 type Alias<T> = Enum<T>;
9 type AliasFixed = Enum<()>;
14 //~^ ERROR mismatched types [E0308]
15 Self::TSVariant::<()>(());
16 //~^ ERROR type arguments are not allowed on this type [E0109]
17 Self::<()>::TSVariant(());
18 //~^ ERROR type arguments are not allowed on self type [E0109]
19 //~| ERROR mismatched types [E0308]
20 Self::<()>::TSVariant::<()>(());
21 //~^ ERROR type arguments are not allowed on self type [E0109]
22 //~| ERROR type arguments are not allowed on this type [E0109]
26 Self::SVariant { v: () };
27 //~^ ERROR mismatched types [E0308]
28 Self::SVariant::<()> { v: () };
29 //~^ ERROR type arguments are not allowed on this type [E0109]
30 //~| ERROR mismatched types [E0308]
31 Self::<()>::SVariant { v: () };
32 //~^ ERROR type arguments are not allowed on self type [E0109]
33 //~| ERROR mismatched types [E0308]
34 Self::<()>::SVariant::<()> { v: () };
35 //~^ ERROR type arguments are not allowed on self type [E0109]
36 //~| ERROR type arguments are not allowed on this type [E0109]
37 //~| ERROR mismatched types [E0308]
42 //~^ ERROR type arguments are not allowed on this type [E0109]
44 //~^ ERROR type arguments are not allowed on self type [E0109]
45 Self::<()>::UVariant::<()>;
46 //~^ ERROR type arguments are not allowed on self type [E0109]
47 //~| ERROR type arguments are not allowed on this type [E0109]
52 // Tuple struct variant
54 Enum::<()>::TSVariant::<()>(());
55 //~^ ERROR type arguments are not allowed on tuple variant `TSVariant` [E0109]
57 Alias::TSVariant::<()>(());
58 //~^ ERROR type arguments are not allowed on this type [E0109]
59 Alias::<()>::TSVariant::<()>(());
60 //~^ ERROR type arguments are not allowed on this type [E0109]
62 AliasFixed::TSVariant::<()>(());
63 //~^ ERROR type arguments are not allowed on this type [E0109]
64 AliasFixed::<()>::TSVariant(());
65 //~^ ERROR this type alias takes 0 generic arguments but 1 generic argument was supplied [E0107]
66 AliasFixed::<()>::TSVariant::<()>(());
67 //~^ ERROR type arguments are not allowed on this type [E0109]
68 //~| ERROR this type alias takes 0 generic arguments but 1 generic argument was supplied [E0107]
72 Enum::<()>::SVariant::<()> { v: () };
73 //~^ ERROR type arguments are not allowed on variant `SVariant` [E0109]
75 Alias::SVariant::<()> { v: () };
76 //~^ ERROR type arguments are not allowed on this type [E0109]
77 Alias::<()>::SVariant::<()> { v: () };
78 //~^ ERROR type arguments are not allowed on this type [E0109]
80 AliasFixed::SVariant::<()> { v: () };
81 //~^ ERROR type arguments are not allowed on this type [E0109]
82 AliasFixed::<()>::SVariant { v: () };
83 //~^ ERROR this type alias takes 0 generic arguments but 1 generic argument was supplied [E0107]
84 AliasFixed::<()>::SVariant::<()> { v: () };
85 //~^ ERROR type arguments are not allowed on this type [E0109]
86 //~| ERROR this type alias takes 0 generic arguments but 1 generic argument was supplied [E0107]
90 Enum::<()>::UVariant::<()>;
91 //~^ ERROR type arguments are not allowed on unit variant `UVariant` [E0109]
93 Alias::UVariant::<()>;
94 //~^ ERROR type arguments are not allowed on this type [E0109]
95 Alias::<()>::UVariant::<()>;
96 //~^ ERROR type arguments are not allowed on this type [E0109]
98 AliasFixed::UVariant::<()>;
99 //~^ ERROR type arguments are not allowed on this type [E0109]
100 AliasFixed::<()>::UVariant;
101 //~^ ERROR this type alias takes 0 generic arguments but 1 generic argument was supplied [E0107]
102 AliasFixed::<()>::UVariant::<()>;
103 //~^ ERROR type arguments are not allowed on this type [E0109]
104 //~| ERROR this type alias takes 0 generic arguments but 1 generic argument was supplied [E0107]