type_alias_enum_variants: add regression test for #61801.

This commit is contained in:
Mazdak Farrokhzad 2019-06-14 09:16:39 +02:00
parent d3024138f8
commit 065151f8b2

View file

@ -0,0 +1,30 @@
// In this regression test we check that a path pattern referring to a unit variant
// through a type alias is successful in inferring the generic argument.
// compile-pass
#![feature(type_alias_enum_variants)]
enum Opt<T> {
N,
S(T),
}
type OptAlias<T> = Opt<T>;
fn f1(x: OptAlias<u8>) {
match x {
OptAlias::N // We previously failed to infer `T` to `u8`.
=> (),
_ => (),
}
match x {
<
OptAlias<_> // And we failed to infer this type also.
>::N => (),
_ => (),
}
}
fn main() {}