Add type check to semantics.