private static boolean match(@NotNull MultiChildDescriptor childDescriptor1,
                               @NotNull MultiChildDescriptor childDescriptor2,
                               @NotNull AbstractMatchingVisitor g) {

    if (childDescriptor1.getType() != childDescriptor2.getType()) {
      return false;
    }

    final PsiElement[] elements1 = childDescriptor1.getElements();
    final PsiElement[] elements2 = childDescriptor2.getElements();

    return switch (childDescriptor1.getType()) {
      case DEFAULT -> g.matchSequentially(elements1, elements2);
      case OPTIONALLY_IN_PATTERN, OPTIONALLY -> g.matchOptionally(elements1, elements2);
      case IN_ANY_ORDER -> g.matchInAnyOrder(elements1, elements2);
    };
  }
private static boolean match(@NotNull MultiChildDescriptor childDescriptor1,
                               @NotNull MultiChildDescriptor childDescriptor2,
                               @NotNull AbstractMatchingVisitor g)