typing: move redef class check before inheritance