private void checkCompleteness(@NotNull List<? extends PsiCaseLabelElement> elements,
                                 boolean inclusiveUnconditionalAndDefault,
                                 @NotNull Consumer<? super HighlightInfo.Builder> errorSink) {
    //T is an intersection type T1& ... &Tn, and P covers Ti, for one of the type Ti (1≤i≤n)
    List<PsiType> selectorTypes = getAllTypes(mySelectorType);

    if (inclusiveUnconditionalAndDefault) {
      PsiCaseLabelElement elementCoversType =
        selectorTypes.stream()
          .map(type -> findUnconditionalPatternForType(elements, type))
          .filter(t -> t != null)
          .findAny()
          .orElse(null);
      PsiElement defaultElement = SwitchUtils.findDefaultElement(myBlock);
      if (defaultElement != null && elementCoversType != null) {
        HighlightInfo.Builder defaultInfo =
          createError(defaultElement.getFirstChild(), JavaErrorBundle.message("switch.unconditional.pattern.and.default.exist"));
        registerDeleteFixForDefaultElement(defaultInfo, defaultElement, defaultElement.getFirstChild());
        errorSink.accept(defaultInfo);
        HighlightInfo.Builder patternInfo = createError(elementCoversType, JavaErrorBundle.message(
          "switch.unconditional.pattern.and.default.exist"));
        IntentionAction action = getFixFactory().createDeleteSwitchLabelFix(elementCoversType);
        patternInfo.registerFix(action, null, null, null, null);
        errorSink.accept(patternInfo);
        return;
      }
      //default (or unconditional), TRUE and FALSE cannot be together
      if ((defaultElement != null || elementCoversType != null) && mySelectorKind == SelectorKind.BOOLEAN && elements.size() >= 2) {
        if (hasTrueAndFalse(elements)) {
          if (defaultElement != null) {
            HighlightInfo.Builder defaultInfo =
              createError(defaultElement.getFirstChild(), JavaErrorBundle.message("switch.unconditional.boolean.and.default.exist"));
            registerDeleteFixForDefaultElement(defaultInfo, defaultElement, defaultElement.getFirstChild());
            errorSink.accept(defaultInfo);
          }
          if (elementCoversType != null) {
            HighlightInfo.Builder patternInfo = createError(elementCoversType,
                                                            JavaErrorBundle.message(
                                                              "switch.unconditional.boolean.and.unconditional.exist"));
            IntentionAction action = getFixFactory().createDeleteSwitchLabelFix(elementCoversType);
            patternInfo.registerFix(action, null, null, null, null);
            errorSink.accept(patternInfo);
          }
        }
      }
      if (defaultElement != null || elementCoversType != null) return;
    }
    if (isExhaustiveForSwitchSelectorPrimitiveWrapper(elements)) return;
    if (mySelectorKind == SelectorKind.BOOLEAN && hasTrueAndFalse(elements)) return;
    //enums are final; checking intersections are not needed
    PsiClass selectorClass = PsiUtil.resolveClassInClassTypeOnly(TypeConversionUtil.erasure(mySelectorType));
    if (selectorClass != null && mySelectorKind == SelectorKind.ENUM) {
      List<PsiEnumConstant> enumElements = new SmartList<>();
      elements.stream()
        .map(SwitchBlockHighlightingModel::getEnumConstant)
        .filter(Objects::nonNull)
        .forEach(enumElements::add);
      checkEnumCompleteness(selectorClass, enumElements, !elements.isEmpty(), errorSink);
      return;
    }
    List<PsiType> sealedTypes = getAbstractSealedTypes(selectorTypes);
    if (!sealedTypes.isEmpty()) {
      errorSink.accept(checkSealedClassCompleteness(mySelectorType, elements));
      return;
    }
    //records are final; checking intersections are not needed
    if (selectorClass != null && selectorClass.isRecord()) {
      if (!checkRecordCaseSetNotEmpty(elements)) {
        errorSink.accept(createCompletenessInfoForSwitch(!elements.isEmpty()));
      }
      else {
        errorSink.accept(checkRecordExhaustiveness(elements, mySelectorType));
      }
    }
    else {
      errorSink.accept(createCompletenessInfoForSwitch(!elements.isEmpty()));
    }
  }

  
private void checkCompleteness(@NotNull List<? extends PsiCaseLabelElement> elements,
                                 boolean inclusiveUnconditionalAndDefault,
                                 @NotNull Consumer<? super HighlightInfo.Builder> errorSink)