2018-12-15 08:48:52 -06:00
|
|
|
#![feature(type_alias_enum_variants)]
|
|
|
|
|
|
|
|
enum Enum<T> { TSVariant(T), SVariant { v: T } }
|
|
|
|
type Alias<T> = Enum<T>;
|
|
|
|
type AliasFixed = Enum<()>;
|
|
|
|
|
|
|
|
impl<T> Enum<T> {
|
|
|
|
fn ts_variant() {
|
2018-12-19 21:26:07 -06:00
|
|
|
Self::TSVariant(());
|
2018-12-20 12:38:55 -06:00
|
|
|
//~^ ERROR mismatched types [E0308]
|
2018-12-15 08:48:52 -06:00
|
|
|
Self::TSVariant::<()>(());
|
2018-12-17 18:40:22 -06:00
|
|
|
//~^ ERROR type arguments are not allowed on this entity [E0109]
|
2018-12-15 08:48:52 -06:00
|
|
|
Self::<()>::TSVariant(());
|
2018-12-17 18:40:22 -06:00
|
|
|
//~^ ERROR type arguments are not allowed on this entity [E0109]
|
2018-12-20 12:38:55 -06:00
|
|
|
//~^^ ERROR mismatched types [E0308]
|
2018-12-15 08:48:52 -06:00
|
|
|
Self::<()>::TSVariant::<()>(());
|
2018-12-17 18:40:22 -06:00
|
|
|
//~^ ERROR type arguments are not allowed on this entity [E0109]
|
|
|
|
//~^^ ERROR type arguments are not allowed on this entity [E0109]
|
2018-12-15 08:48:52 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
fn s_variant() {
|
2018-12-19 21:26:07 -06:00
|
|
|
Self::SVariant { v: () };
|
2018-12-20 12:38:55 -06:00
|
|
|
//~^ ERROR mismatched types [E0308]
|
2018-12-18 12:59:00 -06:00
|
|
|
Self::SVariant::<()> { v: () };
|
2018-12-17 18:40:22 -06:00
|
|
|
//~^ ERROR type arguments are not allowed on this entity [E0109]
|
2018-12-18 12:59:00 -06:00
|
|
|
//~^^ ERROR mismatched types [E0308]
|
|
|
|
Self::<()>::SVariant { v: () };
|
2018-12-17 18:40:22 -06:00
|
|
|
//~^ ERROR type arguments are not allowed on this entity [E0109]
|
2018-12-18 12:59:00 -06:00
|
|
|
//~^^ ERROR mismatched types [E0308]
|
|
|
|
Self::<()>::SVariant::<()> { v: () };
|
2018-12-17 18:40:22 -06:00
|
|
|
//~^ ERROR type arguments are not allowed on this entity [E0109]
|
|
|
|
//~^^ ERROR type arguments are not allowed on this entity [E0109]
|
2018-12-18 12:59:00 -06:00
|
|
|
//~^^^ ERROR mismatched types [E0308]
|
2018-12-15 08:48:52 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
// Tuple struct variant
|
|
|
|
|
|
|
|
Enum::<()>::TSVariant::<()>(());
|
2018-12-17 18:40:22 -06:00
|
|
|
//~^ ERROR type arguments are not allowed on this entity [E0109]
|
2018-12-15 08:48:52 -06:00
|
|
|
|
|
|
|
Alias::TSVariant::<()>(());
|
2018-12-17 18:40:22 -06:00
|
|
|
//~^ ERROR type arguments are not allowed on this entity [E0109]
|
2018-12-15 08:48:52 -06:00
|
|
|
Alias::<()>::TSVariant::<()>(());
|
2018-12-17 18:40:22 -06:00
|
|
|
//~^ ERROR type arguments are not allowed on this entity [E0109]
|
2018-12-15 08:48:52 -06:00
|
|
|
|
|
|
|
AliasFixed::TSVariant::<()>(());
|
2018-12-17 18:40:22 -06:00
|
|
|
//~^ ERROR type arguments are not allowed on this entity [E0109]
|
2018-12-15 08:48:52 -06:00
|
|
|
AliasFixed::<()>::TSVariant(());
|
|
|
|
//~^ ERROR wrong number of type arguments: expected 0, found 1 [E0107]
|
|
|
|
AliasFixed::<()>::TSVariant::<()>(());
|
2018-12-17 18:40:22 -06:00
|
|
|
//~^ ERROR type arguments are not allowed on this entity [E0109]
|
2018-12-15 08:48:52 -06:00
|
|
|
//~^^ ERROR wrong number of type arguments: expected 0, found 1 [E0107]
|
|
|
|
|
|
|
|
// Struct variant
|
|
|
|
|
2018-12-18 12:59:00 -06:00
|
|
|
Enum::<()>::SVariant::<()> { v: () };
|
2018-12-17 18:40:22 -06:00
|
|
|
//~^ ERROR type arguments are not allowed on this entity [E0109]
|
2018-12-15 08:48:52 -06:00
|
|
|
|
2018-12-18 12:59:00 -06:00
|
|
|
Alias::SVariant::<()> { v: () };
|
2018-12-17 18:40:22 -06:00
|
|
|
//~^ ERROR type arguments are not allowed on this entity [E0109]
|
2018-12-18 12:59:00 -06:00
|
|
|
Alias::<()>::SVariant::<()> { v: () };
|
2018-12-17 18:40:22 -06:00
|
|
|
//~^ ERROR type arguments are not allowed on this entity [E0109]
|
2018-12-15 08:48:52 -06:00
|
|
|
|
2018-12-18 12:59:00 -06:00
|
|
|
AliasFixed::SVariant::<()> { v: () };
|
2018-12-17 18:40:22 -06:00
|
|
|
//~^ ERROR type arguments are not allowed on this entity [E0109]
|
2018-12-18 12:59:00 -06:00
|
|
|
AliasFixed::<()>::SVariant { v: () };
|
2018-12-15 08:48:52 -06:00
|
|
|
//~^ ERROR wrong number of type arguments: expected 0, found 1 [E0107]
|
2018-12-18 12:59:00 -06:00
|
|
|
AliasFixed::<()>::SVariant::<()> { v: () };
|
2018-12-17 18:40:22 -06:00
|
|
|
//~^ ERROR type arguments are not allowed on this entity [E0109]
|
2018-12-15 08:48:52 -06:00
|
|
|
//~^^ ERROR wrong number of type arguments: expected 0, found 1 [E0107]
|
|
|
|
}
|