Upcast if branches if they have different types