type-checking for if statements