Improve wording in some inspections

This commit is contained in:
Mikhail Glukhikh
2017-12-26 18:06:40 +03:00
parent 1534488dd1
commit 429c31c010
52 changed files with 83 additions and 93 deletions
@@ -1,5 +1,5 @@
<html> <html>
<body> <body>
This inspection detects '==' or '!=' operator for arrays that should be replaced with 'Arrays.equals' This inspection detects '==' or '!=' operator for arrays that should be replaced with 'contentEquals'
</body> </body>
</html> </html>
@@ -55,7 +55,7 @@ class ReplaceWithOperatorAssignmentInspection : AbstractApplicabilityBasedInspec
override val defaultFixText = "Replace with operator-assignment" override val defaultFixText = "Replace with operator-assignment"
override fun fixText(element: KtBinaryExpression) = override fun fixText(element: KtBinaryExpression) =
"Replace with ${element.operationReference.operationSignTokenType?.value}= expression" "Replace with '${element.operationReference.operationSignTokenType?.value}='"
private fun checkExpressionRepeat(variableExpression: KtNameReferenceExpression, expression: KtBinaryExpression, bindingContext: BindingContext): Boolean { private fun checkExpressionRepeat(variableExpression: KtNameReferenceExpression, expression: KtBinaryExpression, bindingContext: BindingContext): Boolean {
val descriptor = bindingContext[BindingContext.REFERENCE_TARGET, expression.operationReference]?.containingDeclaration val descriptor = bindingContext[BindingContext.REFERENCE_TARGET, expression.operationReference]?.containingDeclaration
@@ -49,15 +49,15 @@ class SimplifyNegatedBinaryExpressionInspection : AbstractApplicabilityBasedInsp
override fun inspectionTarget(element: KtPrefixExpression) = element.operationReference override fun inspectionTarget(element: KtPrefixExpression) = element.operationReference
override fun inspectionText(element: KtPrefixExpression) = "Negated expression should be simplified" override fun inspectionText(element: KtPrefixExpression) = "Negated operation should be simplified"
override val defaultFixText = "Simplify negated expression" override val defaultFixText = "Simplify negated operation"
override fun fixText(element: KtPrefixExpression): String { override fun fixText(element: KtPrefixExpression): String {
val expression = KtPsiUtil.deparenthesize(element.baseExpression) as? KtOperationExpression ?: return defaultFixText val expression = KtPsiUtil.deparenthesize(element.baseExpression) as? KtOperationExpression ?: return defaultFixText
val operation = expression.operationReference.getReferencedNameElementType() as? KtSingleValueToken ?: return defaultFixText val operation = expression.operationReference.getReferencedNameElementType() as? KtSingleValueToken ?: return defaultFixText
val negatedOperation = operation.negate() ?: return defaultFixText val negatedOperation = operation.negate() ?: return defaultFixText
return "Simplify negated '${operation.value}' expression to '${negatedOperation.value}'" return "Replace negated '${operation.value}' operation with '${negatedOperation.value}'"
} }
override fun isApplicable(element: KtPrefixExpression): Boolean { override fun isApplicable(element: KtPrefixExpression): Boolean {
@@ -31,13 +31,13 @@ class IntroduceWhenSubjectInspection : AbstractApplicabilityBasedInspection<KtWh
override fun inspectionTarget(element: KtWhenExpression) = element.whenKeyword override fun inspectionTarget(element: KtWhenExpression) = element.whenKeyword
override fun inspectionText(element: KtWhenExpression) = "'when' with argument should be used" override fun inspectionText(element: KtWhenExpression) = "'when' with subject should be used"
override val defaultFixText = "Introduce 'when' argument" override val defaultFixText = "Introduce 'when' subject"
override fun fixText(element: KtWhenExpression): String { override fun fixText(element: KtWhenExpression): String {
val subject = element.getSubjectToIntroduce() ?: return "" val subject = element.getSubjectToIntroduce() ?: return ""
return "Introduce '${subject.text}' as argument to 'when'" return "Introduce '${subject.text}' as subject of 'when'"
} }
override fun applyTo(element: PsiElement, project: Project, editor: Editor?) { override fun applyTo(element: PsiElement, project: Project, editor: Editor?) {
@@ -85,7 +85,7 @@ class ReplaceCallWithBinaryOperatorInspection : AbstractApplicabilityBasedInspec
override fun fixText(element: KtDotQualifiedExpression): String { override fun fixText(element: KtDotQualifiedExpression): String {
val calleeExpression = element.callExpression?.calleeExpression as? KtSimpleNameExpression ?: return defaultFixText val calleeExpression = element.callExpression?.calleeExpression as? KtSimpleNameExpression ?: return defaultFixText
val operation = operation(calleeExpression) ?: return defaultFixText val operation = operation(calleeExpression) ?: return defaultFixText
return "Replace with '${operation.value}' operator" return "Replace with '${operation.value}'"
} }
override fun applyTo(element: PsiElement, project: Project, editor: Editor?) { override fun applyTo(element: PsiElement, project: Project, editor: Editor?) {
@@ -72,7 +72,7 @@ class ReplaceGetOrSetInspection : AbstractApplicabilityBasedInspection<KtDotQual
return target.name != OperatorNameConventions.SET || !element.isUsedAsExpression(bindingContext) return target.name != OperatorNameConventions.SET || !element.isUsedAsExpression(bindingContext)
} }
override fun inspectionText(element: KtDotQualifiedExpression) = "Call replaceable with indexing operator" override fun inspectionText(element: KtDotQualifiedExpression) = "Should be replaced with indexing"
override fun inspectionHighlightType(element: KtDotQualifiedExpression): ProblemHighlightType { override fun inspectionHighlightType(element: KtDotQualifiedExpression): ProblemHighlightType {
return if ((element.toResolvedCall(BodyResolveMode.PARTIAL)!!.resultingDescriptor as FunctionDescriptor).isExplicitOperator()) { return if ((element.toResolvedCall(BodyResolveMode.PARTIAL)!!.resultingDescriptor as FunctionDescriptor).isExplicitOperator()) {
@@ -1,4 +1,4 @@
// FIX: Replace with '/' operator // FIX: Replace with '/'
fun test() { fun test() {
class Test { class Test {
operator fun div(a: Int): Test = Test() operator fun div(a: Int): Test = Test()
@@ -1,4 +1,4 @@
// FIX: Replace with '/' operator // FIX: Replace with '/'
fun test() { fun test() {
class Test { class Test {
operator fun div(a: Int): Test = Test() operator fun div(a: Int): Test = Test()
@@ -1,3 +1,3 @@
// FIX: Replace with '==' operator // FIX: Replace with '=='
val x = 2.<caret>equals(2) val x = 2.<caret>equals(2)
@@ -1,3 +1,3 @@
// FIX: Replace with '==' operator // FIX: Replace with '=='
val x = 2 == 2 val x = 2 == 2
@@ -1,3 +1,3 @@
// FIX: Replace with '>' operator // FIX: Replace with '>'
val x = 3.compare<caret>To(2) > 0 val x = 3.compare<caret>To(2) > 0
@@ -1,3 +1,3 @@
// FIX: Replace with '>' operator // FIX: Replace with '>'
val x = 3 > 2 val x = 3 > 2
@@ -1,3 +1,3 @@
// FIX: Replace with '<=' operator // FIX: Replace with '<='
val x = 0 >= 4.compare<caret>To(5) val x = 0 >= 4.compare<caret>To(5)
@@ -1,3 +1,3 @@
// FIX: Replace with '<=' operator // FIX: Replace with '<='
val x = 4 <= 5 val x = 4 <= 5
@@ -1,4 +1,4 @@
// FIX: Replace with '-' operator // FIX: Replace with '-'
fun test() { fun test() {
class Test { class Test {
operator fun minus(a: Int): Test = Test() operator fun minus(a: Int): Test = Test()
@@ -1,4 +1,4 @@
// FIX: Replace with '-' operator // FIX: Replace with '-'
fun test() { fun test() {
class Test { class Test {
operator fun minus(a: Int): Test = Test() operator fun minus(a: Int): Test = Test()
@@ -1,3 +1,3 @@
// FIX: Replace with '!=' operator // FIX: Replace with '!='
val x = !2.eq<caret>uals(3) val x = !2.eq<caret>uals(3)
@@ -1,3 +1,3 @@
// FIX: Replace with '!=' operator // FIX: Replace with '!='
val x = 2 != 3 val x = 2 != 3
@@ -1,3 +1,3 @@
// FIX: Replace with '!=' operator // FIX: Replace with '!='
val x = !(2.<caret>equals(3)) val x = !(2.<caret>equals(3))
@@ -1,3 +1,3 @@
// FIX: Replace with '!=' operator // FIX: Replace with '!='
val x = 2 != 3 val x = 2 != 3
@@ -1,3 +1,3 @@
// FIX: Replace with '==' operator // FIX: Replace with '=='
val x = !(2.equ<caret>als(3) && 4.equals(5)) val x = !(2.equ<caret>als(3) && 4.equals(5))
@@ -1,3 +1,3 @@
// FIX: Replace with '==' operator // FIX: Replace with '=='
val x = !(2 == 3 && 4.equals(5)) val x = !(2 == 3 && 4.equals(5))
@@ -1,4 +1,4 @@
// FIX: Replace with '+' operator // FIX: Replace with '+'
fun test() { fun test() {
class Test { class Test {
operator fun plus(a: Int): Test = Test() operator fun plus(a: Int): Test = Test()
@@ -1,4 +1,4 @@
// FIX: Replace with '+' operator // FIX: Replace with '+'
fun test() { fun test() {
class Test { class Test {
operator fun plus(a: Int): Test = Test() operator fun plus(a: Int): Test = Test()
@@ -1,4 +1,4 @@
// FIX: Replace with '..' operator // FIX: Replace with '..'
fun test() { fun test() {
class Test { class Test {
operator fun rangeTo(a: Int): Test = Test() operator fun rangeTo(a: Int): Test = Test()
@@ -1,4 +1,4 @@
// FIX: Replace with '..' operator // FIX: Replace with '..'
fun test() { fun test() {
class Test { class Test {
operator fun rangeTo(a: Int): Test = Test() operator fun rangeTo(a: Int): Test = Test()
@@ -1,4 +1,4 @@
// FIX: Replace with '%' operator // FIX: Replace with '%'
fun test() { fun test() {
class Test { class Test {
@@ -1,4 +1,4 @@
// FIX: Replace with '%' operator // FIX: Replace with '%'
fun test() { fun test() {
class Test { class Test {
@@ -1,4 +1,4 @@
// FIX: Replace with '*' operator // FIX: Replace with '*'
fun test() { fun test() {
class Test { class Test {
operator fun times(a: Int): Test = Test() operator fun times(a: Int): Test = Test()
@@ -1,4 +1,4 @@
// FIX: Replace with '*' operator // FIX: Replace with '*'
fun test() { fun test() {
class Test { class Test {
operator fun times(a: Int): Test = Test() operator fun times(a: Int): Test = Test()
@@ -5,7 +5,7 @@
<module>light_idea_test_case</module> <module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="singleArgument.kt" /> <entry_point TYPE="file" FQNAME="singleArgument.kt" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Explicit 'get' or 'set' call</problem_class> <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Explicit 'get' or 'set' call</problem_class>
<description>Call replaceable with indexing operator</description> <description>Should be replaced with indexing</description>
</problem> </problem>
<problem> <problem>
@@ -14,7 +14,7 @@
<module>light_idea_test_case</module> <module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="multiArgument.kt" /> <entry_point TYPE="file" FQNAME="multiArgument.kt" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Explicit 'get' or 'set' call</problem_class> <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Explicit 'get' or 'set' call</problem_class>
<description>Call replaceable with indexing operator</description> <description>Should be replaced with indexing</description>
</problem> </problem>
<problem> <problem>
@@ -23,7 +23,7 @@
<module>light_idea_test_case</module> <module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="functionalArgument.kt" /> <entry_point TYPE="file" FQNAME="functionalArgument.kt" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Explicit 'get' or 'set' call</problem_class> <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Explicit 'get' or 'set' call</problem_class>
<description>Call replaceable with indexing operator</description> <description>Should be replaced with indexing</description>
</problem> </problem>
<problem> <problem>
@@ -32,7 +32,7 @@
<module>light_idea_test_case</module> <module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="extensionFunction.kt" /> <entry_point TYPE="file" FQNAME="extensionFunction.kt" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Explicit 'get' or 'set' call</problem_class> <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Explicit 'get' or 'set' call</problem_class>
<description>Call replaceable with indexing operator</description> <description>Should be replaced with indexing</description>
</problem> </problem>
<problem> <problem>
@@ -41,7 +41,7 @@
<module>light_idea_test_case</module> <module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="argumentAndFunction.kt" /> <entry_point TYPE="file" FQNAME="argumentAndFunction.kt" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Explicit 'get' or 'set' call</problem_class> <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Explicit 'get' or 'set' call</problem_class>
<description>Call replaceable with indexing operator</description> <description>Should be replaced with indexing</description>
</problem> </problem>
<problem> <problem>
@@ -50,7 +50,7 @@
<module>light_idea_test_case</module> <module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="acceptableVararg.kt" /> <entry_point TYPE="file" FQNAME="acceptableVararg.kt" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Explicit 'get' or 'set' call</problem_class> <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Explicit 'get' or 'set' call</problem_class>
<description>Call replaceable with indexing operator</description> <description>Should be replaced with indexing</description>
</problem> </problem>
<problem> <problem>
@@ -59,7 +59,7 @@
<module>light_idea_test_case</module> <module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="qualifier.kt" /> <entry_point TYPE="file" FQNAME="qualifier.kt" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Explicit 'get' or 'set' call</problem_class> <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Explicit 'get' or 'set' call</problem_class>
<description>Call replaceable with indexing operator</description> <description>Should be replaced with indexing</description>
</problem> </problem>
<problem> <problem>
@@ -68,7 +68,7 @@
<module>light_idea_test_case</module> <module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="set.kt" /> <entry_point TYPE="file" FQNAME="set.kt" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Explicit 'get' or 'set' call</problem_class> <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Explicit 'get' or 'set' call</problem_class>
<description>Call replaceable with indexing operator</description> <description>Should be replaced with indexing</description>
</problem> </problem>
<problem> <problem>
@@ -77,6 +77,6 @@
<module>light_idea_test_case</module> <module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="set2.kt" /> <entry_point TYPE="file" FQNAME="set2.kt" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Explicit 'get' or 'set' call</problem_class> <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Explicit 'get' or 'set' call</problem_class>
<description>Call replaceable with indexing operator</description> <description>Should be replaced with indexing</description>
</problem> </problem>
</problems> </problems>
@@ -1,4 +1,4 @@
// FIX: Simplify negated '==' expression to '!=' // FIX: Replace negated '==' operation with '!='
fun test(n: Int) { fun test(n: Int) {
<caret>!(0 == 1) <caret>!(0 == 1)
} }
@@ -1,4 +1,4 @@
// FIX: Simplify negated '==' expression to '!=' // FIX: Replace negated '==' operation with '!='
fun test(n: Int) { fun test(n: Int) {
0 != 1 0 != 1
} }
@@ -1,4 +1,4 @@
// FIX: Simplify negated '>' expression to '<=' // FIX: Replace negated '>' operation with '<='
fun test(n: Int) { fun test(n: Int) {
<caret>!(0 > 1) <caret>!(0 > 1)
} }
@@ -1,4 +1,4 @@
// FIX: Simplify negated '>' expression to '<=' // FIX: Replace negated '>' operation with '<='
fun test(n: Int) { fun test(n: Int) {
0 <= 1 0 <= 1
} }
@@ -1,4 +1,4 @@
// FIX: Simplify negated '>=' expression to '<' // FIX: Replace negated '>=' operation with '<'
fun test(n: Int) { fun test(n: Int) {
<caret>!(0 >= 1) <caret>!(0 >= 1)
} }
@@ -1,4 +1,4 @@
// FIX: Simplify negated '>=' expression to '<' // FIX: Replace negated '>=' operation with '<'
fun test(n: Int) { fun test(n: Int) {
0 < 1 0 < 1
} }
@@ -1,4 +1,4 @@
// FIX: Simplify negated 'in' expression to '!in' // FIX: Replace negated 'in' operation with '!in'
class A(val e: Int) { class A(val e: Int) {
operator fun contains(i: Int): Boolean = e == i operator fun contains(i: Int): Boolean = e == i
} }
@@ -1,4 +1,4 @@
// FIX: Simplify negated 'in' expression to '!in' // FIX: Replace negated 'in' operation with '!in'
class A(val e: Int) { class A(val e: Int) {
operator fun contains(i: Int): Boolean = e == i operator fun contains(i: Int): Boolean = e == i
} }
@@ -5,9 +5,8 @@
<line>3</line> <line>3</line>
<module>light_idea_test_case</module> <module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/notIs.kt"/> <entry_point TYPE="file" FQNAME="temp:///src/notIs.kt"/>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Negated boolean expression that can be simplified <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Negated boolean expression that can be simplified</problem_class>
</problem_class> <description>Negated operation should be simplified</description>
<description>Negated expression should be simplified</description>
</problem> </problem>
<problem> <problem>
@@ -15,9 +14,8 @@
<line>8</line> <line>8</line>
<module>light_idea_test_case</module> <module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/notIn.kt"/> <entry_point TYPE="file" FQNAME="temp:///src/notIn.kt"/>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Negated boolean expression that can be simplified <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Negated boolean expression that can be simplified</problem_class>
</problem_class> <description>Negated operation should be simplified</description>
<description>Negated expression should be simplified</description>
</problem> </problem>
<problem> <problem>
@@ -25,9 +23,8 @@
<line>3</line> <line>3</line>
<module>light_idea_test_case</module> <module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/notEquals.kt"/> <entry_point TYPE="file" FQNAME="temp:///src/notEquals.kt"/>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Negated boolean expression that can be simplified <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Negated boolean expression that can be simplified</problem_class>
</problem_class> <description>Negated operation should be simplified</description>
<description>Negated expression should be simplified</description>
</problem> </problem>
<problem> <problem>
@@ -35,9 +32,8 @@
<line>3</line> <line>3</line>
<module>light_idea_test_case</module> <module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/lessThanOrEquals.kt"/> <entry_point TYPE="file" FQNAME="temp:///src/lessThanOrEquals.kt"/>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Negated boolean expression that can be simplified <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Negated boolean expression that can be simplified</problem_class>
</problem_class> <description>Negated operation should be simplified</description>
<description>Negated expression should be simplified</description>
</problem> </problem>
<problem> <problem>
@@ -45,9 +41,8 @@
<line>3</line> <line>3</line>
<module>light_idea_test_case</module> <module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/lessThan.kt"/> <entry_point TYPE="file" FQNAME="temp:///src/lessThan.kt"/>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Negated boolean expression that can be simplified <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Negated boolean expression that can be simplified</problem_class>
</problem_class> <description>Negated operation should be simplified</description>
<description>Negated expression should be simplified</description>
</problem> </problem>
<problem> <problem>
@@ -55,9 +50,8 @@
<line>3</line> <line>3</line>
<module>light_idea_test_case</module> <module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/is.kt"/> <entry_point TYPE="file" FQNAME="temp:///src/is.kt"/>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Negated boolean expression that can be simplified <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Negated boolean expression that can be simplified</problem_class>
</problem_class> <description>Negated operation should be simplified</description>
<description>Negated expression should be simplified</description>
</problem> </problem>
<problem> <problem>
@@ -65,9 +59,8 @@
<line>8</line> <line>8</line>
<module>light_idea_test_case</module> <module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/in.kt"/> <entry_point TYPE="file" FQNAME="temp:///src/in.kt"/>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Negated boolean expression that can be simplified <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Negated boolean expression that can be simplified</problem_class>
</problem_class> <description>Negated operation should be simplified</description>
<description>Negated expression should be simplified</description>
</problem> </problem>
<problem> <problem>
@@ -75,9 +68,8 @@
<line>3</line> <line>3</line>
<module>light_idea_test_case</module> <module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/greaterThanOrEquals.kt"/> <entry_point TYPE="file" FQNAME="temp:///src/greaterThanOrEquals.kt"/>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Negated boolean expression that can be simplified <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Negated boolean expression that can be simplified</problem_class>
</problem_class> <description>Negated operation should be simplified</description>
<description>Negated expression should be simplified</description>
</problem> </problem>
<problem> <problem>
@@ -85,9 +77,8 @@
<line>3</line> <line>3</line>
<module>light_idea_test_case</module> <module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/greaterThan.kt"/> <entry_point TYPE="file" FQNAME="temp:///src/greaterThan.kt"/>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Negated boolean expression that can be simplified <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Negated boolean expression that can be simplified</problem_class>
</problem_class> <description>Negated operation should be simplified</description>
<description>Negated expression should be simplified</description>
</problem> </problem>
<problem> <problem>
@@ -95,9 +86,8 @@
<line>3</line> <line>3</line>
<module>light_idea_test_case</module> <module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/equals.kt"/> <entry_point TYPE="file" FQNAME="temp:///src/equals.kt"/>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Negated boolean expression that can be simplified <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Negated boolean expression that can be simplified</problem_class>
</problem_class> <description>Negated operation should be simplified</description>
<description>Negated expression should be simplified</description>
</problem> </problem>
</problems> </problems>
@@ -1,4 +1,4 @@
// FIX: Simplify negated 'is' expression to '!is' // FIX: Replace negated 'is' operation with '!is'
fun test(n: Int) { fun test(n: Int) {
<caret>!(0 is Int) <caret>!(0 is Int)
} }
@@ -1,4 +1,4 @@
// FIX: Simplify negated 'is' expression to '!is' // FIX: Replace negated 'is' operation with '!is'
fun test(n: Int) { fun test(n: Int) {
0 !is Int 0 !is Int
} }
@@ -1,4 +1,4 @@
// FIX: Simplify negated '<' expression to '>=' // FIX: Replace negated '<' operation with '>='
fun test(n: Int) { fun test(n: Int) {
<caret>!(0 < 1) <caret>!(0 < 1)
} }
@@ -1,4 +1,4 @@
// FIX: Simplify negated '<' expression to '>=' // FIX: Replace negated '<' operation with '>='
fun test(n: Int) { fun test(n: Int) {
0 >= 1 0 >= 1
} }
@@ -1,4 +1,4 @@
// FIX: Simplify negated '<=' expression to '>' // FIX: Replace negated '<=' operation with '>'
fun test(n: Int) { fun test(n: Int) {
<caret>!(0 <= 1) <caret>!(0 <= 1)
} }
@@ -1,4 +1,4 @@
// FIX: Simplify negated '<=' expression to '>' // FIX: Replace negated '<=' operation with '>'
fun test(n: Int) { fun test(n: Int) {
0 > 1 0 > 1
} }
@@ -1,4 +1,4 @@
// FIX: Simplify negated '!=' expression to '==' // FIX: Replace negated '!=' operation with '=='
fun test(n: Int) { fun test(n: Int) {
<caret>!(0 != 1) <caret>!(0 != 1)
} }
@@ -1,4 +1,4 @@
// FIX: Simplify negated '!=' expression to '==' // FIX: Replace negated '!=' operation with '=='
fun test(n: Int) { fun test(n: Int) {
0 == 1 0 == 1
} }
@@ -1,4 +1,4 @@
// FIX: Simplify negated '!in' expression to 'in' // FIX: Replace negated '!in' operation with 'in'
class A(val e: Int) { class A(val e: Int) {
operator fun contains(i: Int): Boolean = e == i operator fun contains(i: Int): Boolean = e == i
} }
@@ -1,4 +1,4 @@
// FIX: Simplify negated '!in' expression to 'in' // FIX: Replace negated '!in' operation with 'in'
class A(val e: Int) { class A(val e: Int) {
operator fun contains(i: Int): Boolean = e == i operator fun contains(i: Int): Boolean = e == i
} }
@@ -1,4 +1,4 @@
// FIX: Simplify negated '!is' expression to 'is' // FIX: Replace negated '!is' operation with 'is'
fun test(n: Int) { fun test(n: Int) {
<caret>!(0 !is Int) <caret>!(0 !is Int)
} }
@@ -1,4 +1,4 @@
// FIX: Simplify negated '!is' expression to 'is' // FIX: Replace negated '!is' operation with 'is'
fun test(n: Int) { fun test(n: Int) {
0 is Int 0 is Int
} }