PsiExpression (@NotNull PsiExpression element) { PsiExpression expression = element; PsiElement parent = expression; while (parent instanceof PsiExpression parentExpression && !(parent instanceof PsiAssignmentExpression) && (PsiTypes.booleanType().equals(parentExpression.getType()) || parent instanceof PsiConditionalExpression)) { expression = parentExpression; parent = parent.getParent(); } return expression; }