Redundant object type check: fix problem highlighting #KT-22484 Fixed
This commit is contained in:
+4
-7
@@ -38,17 +38,14 @@ class RedundantObjectTypeCheckInspection : AbstractKotlinInspection() {
|
|||||||
super.visitIsExpression(expression)
|
super.visitIsExpression(expression)
|
||||||
val typeReference = expression.typeReference ?: return
|
val typeReference = expression.typeReference ?: return
|
||||||
if (!typeReference.isObject()) return
|
if (!typeReference.isObject()) return
|
||||||
registerProblem(expression.operationReference, ReplaceWithEqualityFix(expression.isNegated))
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun registerProblem(element: KtElement, quickFix: LocalQuickFix) {
|
|
||||||
holder.registerProblem(
|
holder.registerProblem(
|
||||||
element,
|
expression.operationReference,
|
||||||
TextRange(0, 2),
|
TextRange(0, if (expression.isNegated) 3 else 2),
|
||||||
"Redundant type checks for object",
|
"Redundant type checks for object",
|
||||||
quickFix
|
ReplaceWithEqualityFix(expression.isNegated)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user