tccgen: unify type redefinition checks