Check type of fields when struct is matched against enum-like pattern

Try field type pattern check instead of ad-hoc type check.
Fix #4849