boolean (PsiExpression expression) { PsiElement element = PsiUtil.skipParenthesizedExprUp(expression.getParent()); if (element instanceof PsiExpressionStatement) { return !(element.getParent() instanceof PsiSwitchLabeledRuleStatement ruleStatement) || !(ruleStatement.getEnclosingSwitchBlock() instanceof PsiSwitchExpression); } if (element instanceof PsiExpressionList && element.getParent() instanceof PsiExpressionListStatement) { return true; } if (element instanceof PsiLambdaExpression lambda) { return PsiTypes.voidType().equals(LambdaUtil.getFunctionalInterfaceReturnType(lambda)); } return false; }