@@ -39,21 +39,25 @@ import com.intellij.psi.PsiExpression
3939import com.intellij.psi.PsiInstanceOfExpression
4040import com.intellij.psi.PsiType
4141import com.intellij.psi.PsiTypeCastExpression
42+ import com.intellij.psi.PsiTypeTestPattern
4243import com.intellij.psi.util.PsiUtil
4344
4445/* *
45- * Looks for `ConstantConditions` warnings on type casts and checks if they are casts to interfaces introduced by mixins
46+ * Looks for `ConstantConditions`, `ConstantValue` and `DataFlowIssue` warnings on type casts and checks if they are
47+ * casts to interfaces introduced by mixins
4648 */
4749class MixinClassCastInspectionSuppressor : InspectionSuppressor {
4850
4951 override fun isSuppressedFor (element : PsiElement , toolId : String ): Boolean {
50- if (toolId != INSPECTION ) {
52+ if (toolId !in INSPECTIONS ) {
5153 return false
5254 }
5355
5456 // check instanceof
5557 if (element is PsiInstanceOfExpression ) {
56- val castType = element.checkType?.type ? : return false
58+ val castType = element.checkType?.type
59+ ? : (element.pattern as ? PsiTypeTestPattern )?.checkType?.type
60+ ? : return false
5761 var operand = PsiUtil .skipParenthesizedExprDown(element.operand) ? : return false
5862 while (operand is PsiTypeCastExpression ) {
5963 operand = PsiUtil .skipParenthesizedExprDown(operand.operand) ? : return false
@@ -126,6 +130,6 @@ class MixinClassCastInspectionSuppressor : InspectionSuppressor {
126130 SuppressQuickFix .EMPTY_ARRAY
127131
128132 companion object {
129- private const val INSPECTION = " ConstantConditions"
133+ private val INSPECTIONS = setOf ( " ConstantConditions" , " ConstantValue " , " DataFlowIssue " )
130134 }
131135}
0 commit comments