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.