Foldable if-then: do not highlight for is checks #KT-24978 Fixed

This commit is contained in:
Toshiaki Kameyama
2018-08-30 10:40:22 +03:00
committed by Mikhail Glukhikh
parent ac14c5e74f
commit bae754a266
13 changed files with 18 additions and 91 deletions
@@ -31,7 +31,6 @@ import org.jetbrains.kotlin.idea.intentions.getLeftMostReceiverExpression
import org.jetbrains.kotlin.idea.intentions.replaceFirstReceiver
import org.jetbrains.kotlin.idea.refactoring.inline.KotlinInlineValHandler
import org.jetbrains.kotlin.idea.refactoring.introduce.introduceVariable.KotlinIntroduceVariableHandler
import org.jetbrains.kotlin.idea.refactoring.isMultiLine
import org.jetbrains.kotlin.idea.references.mainReference
import org.jetbrains.kotlin.idea.resolve.frontendService
import org.jetbrains.kotlin.idea.util.getResolutionScope
@@ -306,14 +305,6 @@ internal fun KtIfExpression.shouldBeTransformed(): Boolean {
val baseClause = (if (condition.operationToken == KtTokens.EQEQ) `else` else then)?.unwrapBlockOrParenthesis()
!baseClause.isClauseTransformableToLetOnly()
}
is KtIsExpression -> {
val baseClause = (if (condition.isNegated) `else` else then)?.unwrapBlockOrParenthesis()
when {
baseClause.isClauseTransformableToLetOnly() -> false
!isMultiLine() -> true
else -> baseClause !is KtDotQualifiedExpression
}
}
else -> false
}
}