void (@NotNull PsiTypeCastExpression expression) { super.visitTypeCastExpression(expression); final PsiTypeElement castType = expression.getCastType(); if (castType == null) { return; } final PsiExpression operand = PsiUtil.skipParenthesizedExprDown(expression.getOperand()); if (!(operand instanceof PsiReferenceExpression referenceExpression)) return; PsiType castType1 = castType.getType(); PsiInstanceOfExpression conflictingInstanceof = InstanceOfUtils.getConflictingInstanceof(castType1, referenceExpression, expression); if (conflictingInstanceof == null) return; PsiTypeElement instanceofTypeElement = conflictingInstanceof.getCheckType(); if (instanceofTypeElement == null) return; PsiType psiType = TypeConstraint.fromDfType(CommonDataflow.getDfType(operand)).getPsiType(operand.getProject()); if (psiType != null && castType1.isAssignableFrom(psiType)) return; registerError(expression, referenceExpression, castType, instanceofTypeElement); }