diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-06-14 09:16:39 +0200 |
|---|---|---|
| committer | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-06-14 09:17:29 +0200 |
| commit | 065151f8b2c31d9e4ddd34aaf8d3263a997f5cfe (patch) | |
| tree | 0a612a21eb6eca4055a7a77ca5130599129cca2b | |
| parent | d3024138f8e49e815a205dcb80e2e21decc57aa6 (diff) | |
| download | rust-065151f8b2c31d9e4ddd34aaf8d3263a997f5cfe.tar.gz rust-065151f8b2c31d9e4ddd34aaf8d3263a997f5cfe.zip | |
type_alias_enum_variants: add regression test for #61801.
| -rw-r--r-- | src/test/ui/type-alias-enum-variants/issue-61801-path-pattern-can-infer.rs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/test/ui/type-alias-enum-variants/issue-61801-path-pattern-can-infer.rs b/src/test/ui/type-alias-enum-variants/issue-61801-path-pattern-can-infer.rs new file mode 100644 index 00000000000..21be61acb0c --- /dev/null +++ b/src/test/ui/type-alias-enum-variants/issue-61801-path-pattern-can-infer.rs @@ -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() {} |
