1
Fork 0

Check type when struct is matched against enum-like pattern

Previously check always succeeded because struct type was derived from
the matched expression, not the matched pattern.
This commit is contained in:
Seo Sanghyeon 2013-02-20 01:43:15 +09:00
parent 67ee95e943
commit a29023e9b2
3 changed files with 23 additions and 3 deletions

View file

@ -0,0 +1,11 @@
// error-pattern: mismatched types
struct S { a: int }
enum E { C(int) }
fn main() {
match S { a: 1 } {
C(_) => (),
_ => ()
}
}