@NotNull
  private static ReduceResult reduce(@NotNull PsiType selectorType,
                                     @NotNull PsiElement context,
                                     @NotNull Set<? extends PatternDescription> currentPatterns,
                                     @NotNull ReduceCache cache) {
    currentPatterns = new HashSet<>(currentPatterns);
    ReduceResultCacheContext cacheContext = new ReduceResultCacheContext(selectorType, currentPatterns);
    ReduceResult result = cache.loopReduceCache().get(cacheContext);
    if (result == null) {
      result = new ReduceResult(currentPatterns, false)
        .reduceRecordPatterns(context, cache)
        .reduceDeconstructionRecordToTypePattern(context)
        .reduceClasses(selectorType, context);
      cache.loopReduceCache().put(cacheContext, result);
    }
    return result;
  }
@NotNull
  private static ReduceResult reduce(@NotNull PsiType selectorType,
                                     @NotNull PsiElement context,
                                     @NotNull Set<? extends PatternDescription> currentPatterns,
                                     @NotNull ReduceCache cache)