void (@NotNull PsiPolyadicExpression expression) { class Processor { private @Nullable PsiType processBinaryExpressionOperand(final PsiExpression operand, final PsiType otherType, final IElementType binaryToken) { if (operand instanceof PsiTypeCastExpression typeCast) { PsiExpression toCast = typeCast.getOperand(); if (toCast != null && otherType != null && TypeConversionUtil.isBinaryOperatorApplicable(binaryToken, toCast.getType(), otherType, false)) { addToResults(typeCast); return toCast.getType(); } } return operand != null ? operand.getType() : null; } } Processor processor = new Processor(); IElementType tokenType = expression.getOperationTokenType(); PsiExpression[] operands = expression.getOperands(); if (operands.length >= 2) { PsiType lType = processor.processBinaryExpressionOperand(deparenthesizeExpression(operands[0]), operands[1].getType(), tokenType); for (int i = 1; i < operands.length; i++) { PsiExpression operand = deparenthesizeExpression(operands[i]); if (operand == null) continue; PsiType rType = processor.processBinaryExpressionOperand(operand, lType, tokenType); lType = TypeConversionUtil.calcTypeForBinaryExpression(lType, rType, tokenType, true); } } super.visitPolyadicExpression(expression); }