Replaces a series of if-else statements with type checks in conditions by pattern matching. Note that this operation can change the execution order of conditions.