boolean (@NotNull ASTNode n1, @NotNull ASTNode n2) { if (n1 instanceof LeafElement && n2 instanceof LeafElement) { return textMatches(n1, n2) == ThreeState.YES; } if (n1 instanceof PsiErrorElement && n2 instanceof PsiErrorElement) { PsiErrorElement e1 = (PsiErrorElement)n1; PsiErrorElement e2 = (PsiErrorElement)n2; if (!Objects.equals(e1.getErrorDescription(), e2.getErrorDescription())) return false; } return ((TreeElement)n1).hc() == ((TreeElement)n2).hc(); }