Detect infinite recursion in is_sub_type