boolean (PsiStatement statement) { if (!(statement instanceof PsiExpressionStatement expressionStatement)) { return false; } if (expressionStatement.getParent() instanceof PsiSwitchLabeledRuleStatement) { return false; } final PsiExpression expression = expressionStatement.getExpression(); if (!(expression instanceof PsiAssignmentExpression assignment)) { return false; } final PsiExpression rhs = PsiUtil.skipParenthesizedExprDown(assignment.getRExpression()); if (rhs == null || rhs instanceof PsiLiteralExpression) { return false; } final PsiType assignmentType = rhs.getType(); return PsiTypes.booleanType().equals(assignmentType); }