Do not show "Replace overloaded operator with function call" intention on incomplete expressions
#KT-33115 fixed
This commit is contained in:
+2
@@ -40,6 +40,7 @@ class OperatorToFunctionIntention :
|
||||
SelfTargetingIntention<KtExpression>(KtExpression::class.java, "Replace overloaded operator with function call") {
|
||||
companion object {
|
||||
private fun isApplicableUnary(element: KtUnaryExpression, caretOffset: Int): Boolean {
|
||||
if (element.baseExpression == null) return false
|
||||
val opRef = element.operationReference
|
||||
if (!opRef.textRange.containsOffset(caretOffset)) return false
|
||||
return when (opRef.getReferencedNameElementType()) {
|
||||
@@ -63,6 +64,7 @@ class OperatorToFunctionIntention :
|
||||
}
|
||||
|
||||
private fun isApplicableBinary(element: KtBinaryExpression, caretOffset: Int): Boolean {
|
||||
if (element.left == null || element.right == null) return false
|
||||
val opRef = element.operationReference
|
||||
if (!opRef.textRange.containsOffset(caretOffset)) return false
|
||||
return when (opRef.getReferencedNameElementType()) {
|
||||
|
||||
Reference in New Issue
Block a user