Implement typeCheck of restrict.