static List<PsiType> getAllTypes(@NotNull PsiType selectorType) {
    List<PsiType> selectorTypes = new ArrayList<>();
    PsiClass resolvedClass = PsiUtil.resolveClassInClassTypeOnly(selectorType);
    //T is an intersection type T1& ... &Tn and P covers Ti, for one of the types Ti (1≤i≤n)
    if (resolvedClass instanceof PsiTypeParameter typeParameter) {
      PsiClassType[] types = typeParameter.getExtendsListTypes();
      Arrays.stream(types)
        .filter(t -> t != null)
        .forEach(t -> selectorTypes.add(t));
    }
    if (selectorType instanceof PsiIntersectionType psiIntersectionType) {
      for (PsiType conjunct : psiIntersectionType.getConjuncts()) {
        selectorTypes.addAll(getAllTypes(conjunct));
      }
    }
    if (selectorTypes.isEmpty()) {
      selectorTypes.add(selectorType);
    }
    return selectorTypes;
  }

  
static List<PsiType> getAllTypes(@NotNull PsiType selectorType)