boolean (@NotNull PyType type, @NotNull String superClassName, @NotNull TypeEvalContext context) { if (type instanceof PyStructuralType) { // TODO: Convert abc types to structural types and check them properly return true; } if (type instanceof PyClassType classType) { final PyClass pyClass = classType.getPyClass(); if (classType.isDefinition()) { final PyClassLikeType metaClassType = classType.getMetaClassType(context, true); if (metaClassType instanceof PyClassType metaClass) { return isSubclass(metaClass.getPyClass(), superClassName, true, context); } } else { return isSubclass(pyClass, superClassName, true, context); } } if (type instanceof PyUnionType) { return PyTypeUtil.toStream(type).nonNull().anyMatch(it -> isSubtype(it, superClassName, context)); } return false; }