typechecking expressions