private static @NotNull PsiExpression @NotNull [] findDiffs(@NotNull PsiSwitchBlock block, @NotNull List<PsiExpression> branches) {
    EquivalenceChecker equivalence = EquivalenceChecker.getCanonicalPsiEquivalence();
    PsiExpression[] diffs = new PsiExpression[branches.size()];
    for (int i = 1; i < branches.size(); i++) {
      EquivalenceChecker.Match match = equivalence.expressionsMatch(branches.get(0), branches.get(i));
      if (match.isExactMismatch()) return PsiExpression.EMPTY_ARRAY;
      if (match.isExactMatch()) {
        diffs[i] = diffs[0];
        continue;
      }
      if (!(match.getLeftDiff() instanceof PsiExpression first) ||
          !(match.getRightDiff() instanceof PsiExpression cur) ||
          diffs[0] != null && diffs[0] != first) {
        return PsiExpression.EMPTY_ARRAY;
      }
      if (PsiTypes.voidType().equals(first.getType()) || PsiTypes.voidType().equals(cur.getType())) return PsiExpression.EMPTY_ARRAY;
      if (diffs[0] == null) {
        for (int j = 0; j < i; j++) {
          if (diffs[j] == null) diffs[j] = first;
        }
      }
      diffs[i] = cur;
    }
    if (ArrayUtil.contains(null, diffs)) return PsiExpression.EMPTY_ARRAY;
    if (block instanceof PsiSwitchStatement statement && isNonExhaustiveSwitchStatement(statement)) {
      return PsiExpression.EMPTY_ARRAY;
    }
    return diffs;
  }
private static @NotNull PsiExpression @NotNull [] findDiffs(@NotNull PsiSwitchBlock block, @NotNull List<PsiExpression> branches)