bidir typecheking