about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlexander Regueiro <alexreg@me.com>2018-12-15 14:48:52 +0000
committerAlexander Regueiro <alexreg@me.com>2018-12-26 21:40:22 +0000
commit37e7f0a629db70e19646c8322f3d3b18444577e1 (patch)
treef83d69269c8b556a0ea67a613ddcc4b0e44916bf
parent66409e03346c23859a5ee0ff78ff44673725553e (diff)
downloadrust-37e7f0a629db70e19646c8322f3d3b18444577e1.tar.gz
rust-37e7f0a629db70e19646c8322f3d3b18444577e1.zip
Expanded tests for enum variants with generic args.
-rw-r--r--src/test/run-pass/enum-generic-args.rs34
-rw-r--r--src/test/run-pass/enum-variant-generic-args.rs55
-rw-r--r--src/test/run-pass/type-alias-enum-variants-2.rs30
-rw-r--r--src/test/ui/enum-generic-args.rs35
-rw-r--r--src/test/ui/enum-generic-args.stderr70
-rw-r--r--src/test/ui/enum-variant-generic-args.rs65
-rw-r--r--src/test/ui/enum-variant-generic-args.stderr259
-rw-r--r--src/test/ui/type-alias-enum-variants-panic.rs10
8 files changed, 419 insertions, 139 deletions
diff --git a/src/test/run-pass/enum-generic-args.rs b/src/test/run-pass/enum-generic-args.rs
deleted file mode 100644
index f8cac550b41..00000000000
--- a/src/test/run-pass/enum-generic-args.rs
+++ /dev/null
@@ -1,34 +0,0 @@
-#![feature(irrefutable_let_patterns)]
-#![feature(type_alias_enum_variants)]
-
-#![allow(irrefutable_let_patterns)]
-
-enum Enum<T> { Variant(T) }
-type Alias<T> = Enum<T>;
-type AliasFixed = Enum<()>;
-
-macro_rules! is_variant {
-    ($expr:expr) => (
-        assert!(if let Enum::Variant::<()>(_) = $expr { true } else { false },
-                "expr does not have correct type");
-    )
-}
-
-impl<T> Enum<T> {
-    fn foo() {
-        is_variant!(Self::Variant(()));
-    }
-}
-
-fn main() {
-    is_variant!(Enum::Variant(()));
-    is_variant!(Enum::Variant::<()>(()));
-    is_variant!(Enum::<()>::Variant(()));
-
-    is_variant!(Alias::Variant(()));
-    is_variant!(Alias::<()>::Variant(()));
-
-    is_variant!(AliasFixed::Variant(()));
-
-    Enum::<()>::foo();
-}
diff --git a/src/test/run-pass/enum-variant-generic-args.rs b/src/test/run-pass/enum-variant-generic-args.rs
new file mode 100644
index 00000000000..bb4a4c9cf0c
--- /dev/null
+++ b/src/test/run-pass/enum-variant-generic-args.rs
@@ -0,0 +1,55 @@
+#![feature(irrefutable_let_patterns)]
+#![feature(type_alias_enum_variants)]
+
+#![allow(irrefutable_let_patterns)]
+
+enum Enum<T> { TSVariant(T), SVariant { v: T } }
+type Alias<T> = Enum<T>;
+type AliasFixed = Enum<()>;
+
+macro_rules! is_variant {
+    (TSVariant, $expr:expr) => (is_variant!(@TSVariant, (_), $expr));
+    (SVariant, $expr:expr) => (is_variant!(@SVariant, { v: _ }, $expr));
+    (@$variant:ident, $matcher:tt, $expr:expr) => (
+        assert!(if let Enum::$variant::<()> $matcher = $expr { true } else { false },
+                "expr does not have correct type");
+    );
+}
+
+impl<T> Enum<T> {
+    fn ts_variant() {
+        is_variant!(TSVariant, Self::TSVariant(()));
+    }
+
+    fn s_variant() {
+        is_variant!(SVariant, Self::SVariant { v: () });
+    }
+}
+
+fn main() {
+    // Tuple struct variant
+
+    is_variant!(TSVariant, Enum::TSVariant(()));
+    is_variant!(TSVariant, Enum::TSVariant::<()>(()));
+    is_variant!(TSVariant, Enum::<()>::TSVariant(()));
+
+    is_variant!(TSVariant, Alias::TSVariant(()));
+    is_variant!(TSVariant, Alias::<()>::TSVariant(()));
+
+    is_variant!(TSVariant, AliasFixed::TSVariant(()));
+
+    Enum::<()>::ts_variant();
+
+    // Struct variant
+
+    is_variant!(SVariant, Enum::SVariant { v: () });
+    is_variant!(SVariant, Enum::SVariant::<()> { v: () });
+    is_variant!(SVariant, Enum::<()>::SVariant { v: () });
+
+    is_variant!(SVariant, Alias::SVariant { v: () });
+    is_variant!(SVariant, Alias::<()>::SVariant { v: () });
+
+    is_variant!(SVariant, AliasFixed::SVariant { v: () });
+
+    Enum::<()>::s_variant();
+}
diff --git a/src/test/run-pass/type-alias-enum-variants-2.rs b/src/test/run-pass/type-alias-enum-variants-2.rs
new file mode 100644
index 00000000000..0cf413babcb
--- /dev/null
+++ b/src/test/run-pass/type-alias-enum-variants-2.rs
@@ -0,0 +1,30 @@
+#![feature(type_alias_enum_variants)]
+
+#[derive(Debug, PartialEq, Eq)]
+enum Foo {
+    Bar(i32),
+    Baz { i: i32 },
+}
+
+type FooAlias = Foo;
+type OptionAlias = Option<i32>;
+
+impl Foo {
+    fn foo() -> Self {
+        Self::Bar(3)
+    }
+}
+
+fn main() {
+    let t = FooAlias::Bar(1);
+    assert_eq!(t, Foo::Bar(1));
+    let t = FooAlias::Baz { i: 2 };
+    assert_eq!(t, Foo::Baz { i: 2 });
+    match t {
+        FooAlias::Bar(_i) => {}
+        FooAlias::Baz { i } => { assert_eq!(i, 2); }
+    }
+    assert_eq!(Foo::foo(), Foo::Bar(3));
+
+    assert_eq!(OptionAlias::Some(4), Option::Some(4));
+}
diff --git a/src/test/ui/enum-generic-args.rs b/src/test/ui/enum-generic-args.rs
deleted file mode 100644
index 21378b044e1..00000000000
--- a/src/test/ui/enum-generic-args.rs
+++ /dev/null
@@ -1,35 +0,0 @@
-#![feature(type_alias_enum_variants)]
-
-enum Enum<T> { Variant(T) }
-type Alias<T> = Enum<T>;
-type AliasFixed = Enum<()>;
-
-impl<T> Enum<T> {
-    fn foo() {
-        Self::Variant::<()>(());
-        //~^ ERROR type parameters are not allowed on this type [E0109]
-        Self::<()>::Variant(());
-        //~^ ERROR type parameters are not allowed on this type [E0109]
-        Self::<()>::Variant::<()>(());
-        //~^ ERROR type parameters are not allowed on this type [E0109]
-        //~^^ ERROR type parameters are not allowed on this type [E0109]
-    }
-}
-
-fn main() {
-    Enum::<()>::Variant::<()>(());
-    //~^ ERROR type parameters are not allowed on this type [E0109]
-
-    Alias::Variant::<()>(());
-    //~^ ERROR type parameters are not allowed on this type [E0109]
-    Alias::<()>::Variant::<()>(());
-    //~^ ERROR type parameters are not allowed on this type [E0109]
-
-    AliasFixed::Variant::<()>(());
-    //~^ ERROR type parameters are not allowed on this type [E0109]
-    AliasFixed::<()>::Variant(());
-    //~^ ERROR wrong number of type arguments: expected 0, found 1 [E0107]
-    AliasFixed::<()>::Variant::<()>(());
-    //~^ ERROR type parameters are not allowed on this type [E0109]
-    //~^^ ERROR wrong number of type arguments: expected 0, found 1 [E0107]
-}
diff --git a/src/test/ui/enum-generic-args.stderr b/src/test/ui/enum-generic-args.stderr
deleted file mode 100644
index 0807ee15dc7..00000000000
--- a/src/test/ui/enum-generic-args.stderr
+++ /dev/null
@@ -1,70 +0,0 @@
-error[E0109]: type parameters are not allowed on this type
-  --> $DIR/enum-generic-args.rs:9:25
-   |
-LL |         Self::Variant::<()>(());
-   |                         ^^ type parameter not allowed
-
-error[E0109]: type parameters are not allowed on this type
-  --> $DIR/enum-generic-args.rs:11:16
-   |
-LL |         Self::<()>::Variant(());
-   |                ^^ type parameter not allowed
-
-error[E0109]: type parameters are not allowed on this type
-  --> $DIR/enum-generic-args.rs:13:16
-   |
-LL |         Self::<()>::Variant::<()>(());
-   |                ^^ type parameter not allowed
-
-error[E0109]: type parameters are not allowed on this type
-  --> $DIR/enum-generic-args.rs:13:31
-   |
-LL |         Self::<()>::Variant::<()>(());
-   |                               ^^ type parameter not allowed
-
-error[E0109]: type parameters are not allowed on this type
-  --> $DIR/enum-generic-args.rs:20:27
-   |
-LL |     Enum::<()>::Variant::<()>(());
-   |                           ^^ type parameter not allowed
-
-error[E0109]: type parameters are not allowed on this type
-  --> $DIR/enum-generic-args.rs:23:22
-   |
-LL |     Alias::Variant::<()>(());
-   |                      ^^ type parameter not allowed
-
-error[E0109]: type parameters are not allowed on this type
-  --> $DIR/enum-generic-args.rs:25:28
-   |
-LL |     Alias::<()>::Variant::<()>(());
-   |                            ^^ type parameter not allowed
-
-error[E0109]: type parameters are not allowed on this type
-  --> $DIR/enum-generic-args.rs:28:27
-   |
-LL |     AliasFixed::Variant::<()>(());
-   |                           ^^ type parameter not allowed
-
-error[E0107]: wrong number of type arguments: expected 0, found 1
-  --> $DIR/enum-generic-args.rs:30:18
-   |
-LL |     AliasFixed::<()>::Variant(());
-   |                  ^^ unexpected type argument
-
-error[E0107]: wrong number of type arguments: expected 0, found 1
-  --> $DIR/enum-generic-args.rs:32:18
-   |
-LL |     AliasFixed::<()>::Variant::<()>(());
-   |                  ^^ unexpected type argument
-
-error[E0109]: type parameters are not allowed on this type
-  --> $DIR/enum-generic-args.rs:32:33
-   |
-LL |     AliasFixed::<()>::Variant::<()>(());
-   |                                 ^^ type parameter not allowed
-
-error: aborting due to 11 previous errors
-
-Some errors occurred: E0107, E0109.
-For more information about an error, try `rustc --explain E0107`.
diff --git a/src/test/ui/enum-variant-generic-args.rs b/src/test/ui/enum-variant-generic-args.rs
new file mode 100644
index 00000000000..37109e89624
--- /dev/null
+++ b/src/test/ui/enum-variant-generic-args.rs
@@ -0,0 +1,65 @@
+#![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() {
+        Self::TSVariant::<()>(());
+        //~^ ERROR type parameters are not allowed on this type [E0109]
+        Self::<()>::TSVariant(());
+        //~^ ERROR type parameters are not allowed on this type [E0109]
+        Self::<()>::TSVariant::<()>(());
+        //~^ ERROR type parameters are not allowed on this type [E0109]
+        //~^^ ERROR type parameters are not allowed on this type [E0109]
+    }
+
+    fn s_variant() {
+        Self::SVariant::<()>(());
+        //~^ ERROR type parameters are not allowed on this type [E0109]
+        Self::<()>::SVariant(());
+        //~^ ERROR type parameters are not allowed on this type [E0109]
+        Self::<()>::SVariant::<()>(());
+        //~^ ERROR type parameters are not allowed on this type [E0109]
+        //~^^ ERROR type parameters are not allowed on this type [E0109]
+    }
+}
+
+fn main() {
+    // Tuple struct variant
+
+    Enum::<()>::TSVariant::<()>(());
+    //~^ ERROR type parameters are not allowed on this type [E0109]
+
+    Alias::TSVariant::<()>(());
+    //~^ ERROR type parameters are not allowed on this type [E0109]
+    Alias::<()>::TSVariant::<()>(());
+    //~^ ERROR type parameters are not allowed on this type [E0109]
+
+    AliasFixed::TSVariant::<()>(());
+    //~^ ERROR type parameters are not allowed on this type [E0109]
+    AliasFixed::<()>::TSVariant(());
+    //~^ ERROR wrong number of type arguments: expected 0, found 1 [E0107]
+    AliasFixed::<()>::TSVariant::<()>(());
+    //~^ ERROR type parameters are not allowed on this type [E0109]
+    //~^^ ERROR wrong number of type arguments: expected 0, found 1 [E0107]
+
+    // Struct variant
+
+    Enum::<()>::SVariant::<()>(());
+    //~^ ERROR type parameters are not allowed on this type [E0109]
+
+    Alias::SVariant::<()>(());
+    //~^ ERROR type parameters are not allowed on this type [E0109]
+    Alias::<()>::SVariant::<()>(());
+    //~^ ERROR type parameters are not allowed on this type [E0109]
+
+    AliasFixed::SVariant::<()>(());
+    //~^ ERROR type parameters are not allowed on this type [E0109]
+    AliasFixed::<()>::SVariant(());
+    //~^ ERROR wrong number of type arguments: expected 0, found 1 [E0107]
+    AliasFixed::<()>::SVariant::<()>(());
+    //~^ ERROR type parameters are not allowed on this type [E0109]
+    //~^^ ERROR wrong number of type arguments: expected 0, found 1 [E0107]
+}
diff --git a/src/test/ui/enum-variant-generic-args.stderr b/src/test/ui/enum-variant-generic-args.stderr
new file mode 100644
index 00000000000..4cae164b6ff
--- /dev/null
+++ b/src/test/ui/enum-variant-generic-args.stderr
@@ -0,0 +1,259 @@
+error[E0423]: expected function, found struct variant `Enum::SVariant`
+  --> $DIR/enum-variant-generic-args.rs:50:5
+   |
+LL |     Enum::<()>::SVariant::<()>(());
+   |     ^^^^^^^^^^^^--------^^^^^^
+   |     |           |
+   |     |           did you mean `TSVariant`?
+   |     did you mean `Enum::SVariant { /* fields */ }`?
+
+error[E0109]: type parameters are not allowed on this type
+  --> $DIR/enum-variant-generic-args.rs:9:27
+   |
+LL |         Self::TSVariant::<()>(());
+   |                           ^^ type parameter not allowed
+
+error[E0109]: type parameters are not allowed on this type
+  --> $DIR/enum-variant-generic-args.rs:11:16
+   |
+LL |         Self::<()>::TSVariant(());
+   |                ^^ type parameter not allowed
+
+error[E0109]: type parameters are not allowed on this type
+  --> $DIR/enum-variant-generic-args.rs:13:16
+   |
+LL |         Self::<()>::TSVariant::<()>(());
+   |                ^^ type parameter not allowed
+
+error[E0109]: type parameters are not allowed on this type
+  --> $DIR/enum-variant-generic-args.rs:13:33
+   |
+LL |         Self::<()>::TSVariant::<()>(());
+   |                                 ^^ type parameter not allowed
+
+error[E0109]: type parameters are not allowed on this type
+  --> $DIR/enum-variant-generic-args.rs:19:26
+   |
+LL |         Self::SVariant::<()>(());
+   |                          ^^ type parameter not allowed
+
+error[E0618]: expected function, found enum variant `<Self>::SVariant::<()>`
+  --> $DIR/enum-variant-generic-args.rs:19:9
+   |
+LL | enum Enum<T> { TSVariant(T), SVariant { v: T } }
+   |                              ----------------- `<Self>::SVariant::<()>` defined here
+...
+LL |         Self::SVariant::<()>(());
+   |         ^^^^^^^^^^^^^^^^^^^^----
+   |         |
+   |         call expression requires function
+help: `<Self>::SVariant::<()>` is a unit variant, you need to write it without the parenthesis
+   |
+LL |         <Self>::SVariant::<()>;
+   |         ^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0109]: type parameters are not allowed on this type
+  --> $DIR/enum-variant-generic-args.rs:21:16
+   |
+LL |         Self::<()>::SVariant(());
+   |                ^^ type parameter not allowed
+
+error[E0618]: expected function, found enum variant `<Self<()>>::SVariant`
+  --> $DIR/enum-variant-generic-args.rs:21:9
+   |
+LL | enum Enum<T> { TSVariant(T), SVariant { v: T } }
+   |                              ----------------- `<Self<()>>::SVariant` defined here
+...
+LL |         Self::<()>::SVariant(());
+   |         ^^^^^^^^^^^^^^^^^^^^----
+   |         |
+   |         call expression requires function
+help: `<Self<()>>::SVariant` is a unit variant, you need to write it without the parenthesis
+   |
+LL |         <Self<()>>::SVariant;
+   |         ^^^^^^^^^^^^^^^^^^^^
+
+error[E0109]: type parameters are not allowed on this type
+  --> $DIR/enum-variant-generic-args.rs:23:16
+   |
+LL |         Self::<()>::SVariant::<()>(());
+   |                ^^ type parameter not allowed
+
+error[E0109]: type parameters are not allowed on this type
+  --> $DIR/enum-variant-generic-args.rs:23:32
+   |
+LL |         Self::<()>::SVariant::<()>(());
+   |                                ^^ type parameter not allowed
+
+error[E0618]: expected function, found enum variant `<Self<()>>::SVariant::<()>`
+  --> $DIR/enum-variant-generic-args.rs:23:9
+   |
+LL | enum Enum<T> { TSVariant(T), SVariant { v: T } }
+   |                              ----------------- `<Self<()>>::SVariant::<()>` defined here
+...
+LL |         Self::<()>::SVariant::<()>(());
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^----
+   |         |
+   |         call expression requires function
+help: `<Self<()>>::SVariant::<()>` is a unit variant, you need to write it without the parenthesis
+   |
+LL |         <Self<()>>::SVariant::<()>;
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0109]: type parameters are not allowed on this type
+  --> $DIR/enum-variant-generic-args.rs:32:29
+   |
+LL |     Enum::<()>::TSVariant::<()>(());
+   |                             ^^ type parameter not allowed
+
+error[E0109]: type parameters are not allowed on this type
+  --> $DIR/enum-variant-generic-args.rs:35:24
+   |
+LL |     Alias::TSVariant::<()>(());
+   |                        ^^ type parameter not allowed
+
+error[E0109]: type parameters are not allowed on this type
+  --> $DIR/enum-variant-generic-args.rs:37:30
+   |
+LL |     Alias::<()>::TSVariant::<()>(());
+   |                              ^^ type parameter not allowed
+
+error[E0109]: type parameters are not allowed on this type
+  --> $DIR/enum-variant-generic-args.rs:40:29
+   |
+LL |     AliasFixed::TSVariant::<()>(());
+   |                             ^^ type parameter not allowed
+
+error[E0107]: wrong number of type arguments: expected 0, found 1
+  --> $DIR/enum-variant-generic-args.rs:42:18
+   |
+LL |     AliasFixed::<()>::TSVariant(());
+   |                  ^^ unexpected type argument
+
+error[E0107]: wrong number of type arguments: expected 0, found 1
+  --> $DIR/enum-variant-generic-args.rs:44:18
+   |
+LL |     AliasFixed::<()>::TSVariant::<()>(());
+   |                  ^^ unexpected type argument
+
+error[E0109]: type parameters are not allowed on this type
+  --> $DIR/enum-variant-generic-args.rs:44:35
+   |
+LL |     AliasFixed::<()>::TSVariant::<()>(());
+   |                                   ^^ type parameter not allowed
+
+error[E0109]: type parameters are not allowed on this type
+  --> $DIR/enum-variant-generic-args.rs:53:23
+   |
+LL |     Alias::SVariant::<()>(());
+   |                       ^^ type parameter not allowed
+
+error[E0618]: expected function, found enum variant `<Alias>::SVariant::<()>`
+  --> $DIR/enum-variant-generic-args.rs:53:5
+   |
+LL | enum Enum<T> { TSVariant(T), SVariant { v: T } }
+   |                              ----------------- `<Alias>::SVariant::<()>` defined here
+...
+LL |     Alias::SVariant::<()>(());
+   |     ^^^^^^^^^^^^^^^^^^^^^----
+   |     |
+   |     call expression requires function
+help: `<Alias>::SVariant::<()>` is a unit variant, you need to write it without the parenthesis
+   |
+LL |     <Alias>::SVariant::<()>;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0109]: type parameters are not allowed on this type
+  --> $DIR/enum-variant-generic-args.rs:55:29
+   |
+LL |     Alias::<()>::SVariant::<()>(());
+   |                             ^^ type parameter not allowed
+
+error[E0618]: expected function, found enum variant `<Alias<()>>::SVariant::<()>`
+  --> $DIR/enum-variant-generic-args.rs:55:5
+   |
+LL | enum Enum<T> { TSVariant(T), SVariant { v: T } }
+   |                              ----------------- `<Alias<()>>::SVariant::<()>` defined here
+...
+LL |     Alias::<()>::SVariant::<()>(());
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^----
+   |     |
+   |     call expression requires function
+help: `<Alias<()>>::SVariant::<()>` is a unit variant, you need to write it without the parenthesis
+   |
+LL |     <Alias<()>>::SVariant::<()>;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0109]: type parameters are not allowed on this type
+  --> $DIR/enum-variant-generic-args.rs:58:28
+   |
+LL |     AliasFixed::SVariant::<()>(());
+   |                            ^^ type parameter not allowed
+
+error[E0618]: expected function, found enum variant `<AliasFixed>::SVariant::<()>`
+  --> $DIR/enum-variant-generic-args.rs:58:5
+   |
+LL | enum Enum<T> { TSVariant(T), SVariant { v: T } }
+   |                              ----------------- `<AliasFixed>::SVariant::<()>` defined here
+...
+LL |     AliasFixed::SVariant::<()>(());
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^----
+   |     |
+   |     call expression requires function
+help: `<AliasFixed>::SVariant::<()>` is a unit variant, you need to write it without the parenthesis
+   |
+LL |     <AliasFixed>::SVariant::<()>;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0107]: wrong number of type arguments: expected 0, found 1
+  --> $DIR/enum-variant-generic-args.rs:60:18
+   |
+LL |     AliasFixed::<()>::SVariant(());
+   |                  ^^ unexpected type argument
+
+error[E0618]: expected function, found enum variant `<AliasFixed<()>>::SVariant`
+  --> $DIR/enum-variant-generic-args.rs:60:5
+   |
+LL | enum Enum<T> { TSVariant(T), SVariant { v: T } }
+   |                              ----------------- `<AliasFixed<()>>::SVariant` defined here
+...
+LL |     AliasFixed::<()>::SVariant(());
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^----
+   |     |
+   |     call expression requires function
+help: `<AliasFixed<()>>::SVariant` is a unit variant, you need to write it without the parenthesis
+   |
+LL |     <AliasFixed<()>>::SVariant;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0107]: wrong number of type arguments: expected 0, found 1
+  --> $DIR/enum-variant-generic-args.rs:62:18
+   |
+LL |     AliasFixed::<()>::SVariant::<()>(());
+   |                  ^^ unexpected type argument
+
+error[E0109]: type parameters are not allowed on this type
+  --> $DIR/enum-variant-generic-args.rs:62:34
+   |
+LL |     AliasFixed::<()>::SVariant::<()>(());
+   |                                  ^^ type parameter not allowed
+
+error[E0618]: expected function, found enum variant `<AliasFixed<()>>::SVariant::<()>`
+  --> $DIR/enum-variant-generic-args.rs:62:5
+   |
+LL | enum Enum<T> { TSVariant(T), SVariant { v: T } }
+   |                              ----------------- `<AliasFixed<()>>::SVariant::<()>` defined here
+...
+LL |     AliasFixed::<()>::SVariant::<()>(());
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----
+   |     |
+   |     call expression requires function
+help: `<AliasFixed<()>>::SVariant::<()>` is a unit variant, you need to write it without the parenthesis
+   |
+LL |     <AliasFixed<()>>::SVariant::<()>;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 30 previous errors
+
+Some errors occurred: E0107, E0109, E0423, E0618.
+For more information about an error, try `rustc --explain E0107`.
diff --git a/src/test/ui/type-alias-enum-variants-panic.rs b/src/test/ui/type-alias-enum-variants-panic.rs
new file mode 100644
index 00000000000..abed190d22b
--- /dev/null
+++ b/src/test/ui/type-alias-enum-variants-panic.rs
@@ -0,0 +1,10 @@
+#![feature(type_alias_enum_variants)]
+
+enum Enum { Variant {} }
+type Alias = Enum;
+
+fn main() {
+    Alias::Variant;
+    let Alias::Variant = panic!();
+    let Alias::Variant(..) = panic!();
+}