Type Inference with Extended Pattern Matching and Subtypes