@Override
    public void visitConditionalExpression(@NotNull PsiConditionalExpression conditionalExpression) {
      PsiElement gParent = PsiUtil.skipParenthesizedExprUp(conditionalExpression.getParent());
      if (gParent instanceof PsiLambdaExpression) return;
      if (gParent instanceof PsiReturnStatement &&
          PsiTreeUtil.getParentOfType(gParent, PsiMethod.class, PsiLambdaExpression.class) instanceof PsiLambdaExpression) return;

      if (!(gParent instanceof PsiExpressionList)) {
        PsiExpression thenExpression = deparenthesizeExpression(conditionalExpression.getThenExpression());
        PsiExpression elseExpression = deparenthesizeExpression(conditionalExpression.getElseExpression());
        if (thenExpression instanceof PsiTypeCastExpression) {
          visitConditional((PsiTypeCastExpression)thenExpression,
                           conditionalExpression,
                           getInnerMostOperand(elseExpression));
        }
        if (elseExpression instanceof PsiTypeCastExpression) {
          visitConditional((PsiTypeCastExpression)elseExpression,
                           conditionalExpression,
                           getInnerMostOperand(deparenthesizeExpression(conditionalExpression.getThenExpression())));
        }
      }

      addIfNarrowing(conditionalExpression.getCondition(), PsiTypes.booleanType());
      super.visitConditionalExpression(conditionalExpression);
    }
@Override
    public void visitConditionalExpression(@NotNull PsiConditionalExpression conditionalExpression)