Refactoring: "simplify negated binary expression" is now an inspection
This commit is contained in:
@@ -0,0 +1 @@
|
||||
org.jetbrains.kotlin.idea.inspections.SimplifyNegatedBinaryExpressionInspection
|
||||
@@ -0,0 +1,4 @@
|
||||
// FIX: Simplify negated '==' expression to '!='
|
||||
fun test(n: Int) {
|
||||
<caret>!(0 == 1)
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
// FIX: Simplify negated '==' expression to '!='
|
||||
fun test(n: Int) {
|
||||
0 != 1
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
// FIX: Simplify negated '>' expression to '<='
|
||||
fun test(n: Int) {
|
||||
<caret>!(0 > 1)
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
// FIX: Simplify negated '>' expression to '<='
|
||||
fun test(n: Int) {
|
||||
0 <= 1
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
// FIX: Simplify negated '>=' expression to '<'
|
||||
fun test(n: Int) {
|
||||
<caret>!(0 >= 1)
|
||||
}
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
// FIX: Simplify negated '>=' expression to '<'
|
||||
fun test(n: Int) {
|
||||
0 < 1
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// INTENTION_TEXT: Simplify negated 'in' expression to '!in'
|
||||
// FIX: Simplify negated 'in' expression to '!in'
|
||||
class A(val e: Int) {
|
||||
operator fun contains(i: Int): Boolean = e == i
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// INTENTION_TEXT: Simplify negated 'in' expression to '!in'
|
||||
// FIX: Simplify negated 'in' expression to '!in'
|
||||
class A(val e: Int) {
|
||||
operator fun contains(i: Int): Boolean = e == i
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
// PROBLEM: none
|
||||
infix fun Int.lt(b: Int): Boolean = this < b
|
||||
fun test(n: Int) {
|
||||
<caret>!(1 lt 2)
|
||||
+20
-20
@@ -5,8 +5,8 @@
|
||||
<line>3</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/notIs.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Simplify Negated Binary Expression</problem_class>
|
||||
<description>Simplify negated '!is' expression to 'is'</description>
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Negated boolean expression that can be simplified</problem_class>
|
||||
<description>Negated expression can be simplified</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
@@ -14,8 +14,8 @@
|
||||
<line>8</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/notIn.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Simplify Negated Binary Expression</problem_class>
|
||||
<description>Simplify negated '!in' expression to 'in'</description>
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Negated boolean expression that can be simplified</problem_class>
|
||||
<description>Negated expression can be simplified</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
@@ -23,8 +23,8 @@
|
||||
<line>3</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/notEquals.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Simplify Negated Binary Expression</problem_class>
|
||||
<description>Simplify negated '!=' expression to '=='</description>
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Negated boolean expression that can be simplified</problem_class>
|
||||
<description>Negated expression can be simplified</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
@@ -32,8 +32,8 @@
|
||||
<line>3</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/lessThanOrEquals.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Simplify Negated Binary Expression</problem_class>
|
||||
<description>Simplify negated '<=' expression to '>'</description>
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Negated boolean expression that can be simplified</problem_class>
|
||||
<description>Negated expression can be simplified</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
@@ -41,8 +41,8 @@
|
||||
<line>3</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/lessThan.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Simplify Negated Binary Expression</problem_class>
|
||||
<description>Simplify negated '<' expression to '>='</description>
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Negated boolean expression that can be simplified</problem_class>
|
||||
<description>Negated expression can be simplified</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
@@ -50,8 +50,8 @@
|
||||
<line>3</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/is.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Simplify Negated Binary Expression</problem_class>
|
||||
<description>Simplify negated 'is' expression to '!is'</description>
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Negated boolean expression that can be simplified</problem_class>
|
||||
<description>Negated expression can be simplified</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
@@ -59,8 +59,8 @@
|
||||
<line>8</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/in.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Simplify Negated Binary Expression</problem_class>
|
||||
<description>Simplify negated 'in' expression to '!in'</description>
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Negated boolean expression that can be simplified</problem_class>
|
||||
<description>Negated expression can be simplified</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
@@ -68,8 +68,8 @@
|
||||
<line>3</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/greaterThanOrEquals.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Simplify Negated Binary Expression</problem_class>
|
||||
<description>Simplify negated '>=' expression to '<'</description>
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Negated boolean expression that can be simplified</problem_class>
|
||||
<description>Negated expression can be simplified</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
@@ -77,8 +77,8 @@
|
||||
<line>3</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/greaterThan.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Simplify Negated Binary Expression</problem_class>
|
||||
<description>Simplify negated '>' expression to '<='</description>
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Negated boolean expression that can be simplified</problem_class>
|
||||
<description>Negated expression can be simplified</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
@@ -86,8 +86,8 @@
|
||||
<line>3</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/equals.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Simplify Negated Binary Expression</problem_class>
|
||||
<description>Simplify negated '==' expression to '!='</description>
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Negated boolean expression that can be simplified</problem_class>
|
||||
<description>Negated expression can be simplified</description>
|
||||
</problem>
|
||||
|
||||
</problems>
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
// INSPECTION_CLASS: org.jetbrains.kotlin.idea.inspections.SimplifyNegatedBinaryExpressionInspection
|
||||
@@ -0,0 +1,4 @@
|
||||
// FIX: Simplify negated 'is' expression to '!is'
|
||||
fun test(n: Int) {
|
||||
<caret>!(0 is Int)
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
// FIX: Simplify negated 'is' expression to '!is'
|
||||
fun test(n: Int) {
|
||||
0 !is Int
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
// FIX: Simplify negated '<' expression to '>='
|
||||
fun test(n: Int) {
|
||||
<caret>!(0 < 1)
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
// FIX: Simplify negated '<' expression to '>='
|
||||
fun test(n: Int) {
|
||||
0 >= 1
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
// FIX: Simplify negated '<=' expression to '>'
|
||||
fun test(n: Int) {
|
||||
<caret>!(0 <= 1)
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
// FIX: Simplify negated '<=' expression to '>'
|
||||
fun test(n: Int) {
|
||||
0 > 1
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
// FIX: Simplify negated '!=' expression to '=='
|
||||
fun test(n: Int) {
|
||||
<caret>!(0 != 1)
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
// FIX: Simplify negated '!=' expression to '=='
|
||||
fun test(n: Int) {
|
||||
0 == 1
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// INTENTION_TEXT: Simplify negated '!in' expression to 'in'
|
||||
// FIX: Simplify negated '!in' expression to 'in'
|
||||
class A(val e: Int) {
|
||||
operator fun contains(i: Int): Boolean = e == i
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// INTENTION_TEXT: Simplify negated '!in' expression to 'in'
|
||||
// FIX: Simplify negated '!in' expression to 'in'
|
||||
class A(val e: Int) {
|
||||
operator fun contains(i: Int): Boolean = e == i
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
// FIX: Simplify negated '!is' expression to 'is'
|
||||
fun test(n: Int) {
|
||||
<caret>!(0 !is Int)
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
// FIX: Simplify negated '!is' expression to 'is'
|
||||
fun test(n: Int) {
|
||||
0 is Int
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// IS_APPLICABLE: false
|
||||
// PROBLEM: none
|
||||
fun test(n: Int) {
|
||||
!<caret>true
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
org.jetbrains.kotlin.idea.intentions.SimplifyNegatedBinaryExpressionIntention
|
||||
@@ -1,4 +0,0 @@
|
||||
// INTENTION_TEXT: Simplify negated '==' expression to '!='
|
||||
fun test(n: Int) {
|
||||
!<caret>(0 == 1)
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
// INTENTION_TEXT: Simplify negated '==' expression to '!='
|
||||
fun test(n: Int) {
|
||||
0 != 1
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
// INTENTION_TEXT: Simplify negated '>' expression to '<='
|
||||
fun test(n: Int) {
|
||||
!<caret>(0 > 1)
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
// INTENTION_TEXT: Simplify negated '>' expression to '<='
|
||||
fun test(n: Int) {
|
||||
0 <= 1
|
||||
}
|
||||
-4
@@ -1,4 +0,0 @@
|
||||
// INTENTION_TEXT: Simplify negated '>=' expression to '<'
|
||||
fun test(n: Int) {
|
||||
<caret>!(0 >= 1)
|
||||
}
|
||||
-4
@@ -1,4 +0,0 @@
|
||||
// INTENTION_TEXT: Simplify negated '>=' expression to '<'
|
||||
fun test(n: Int) {
|
||||
0 < 1
|
||||
}
|
||||
-1
@@ -1 +0,0 @@
|
||||
// INSPECTION_CLASS: org.jetbrains.kotlin.idea.intentions.SimplifyNegatedBinaryExpressionInspection
|
||||
@@ -1,4 +0,0 @@
|
||||
// INTENTION_TEXT: Simplify negated 'is' expression to '!is'
|
||||
fun test(n: Int) {
|
||||
<caret>!(0 is Int)
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
// INTENTION_TEXT: Simplify negated 'is' expression to '!is'
|
||||
fun test(n: Int) {
|
||||
0 !is Int
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
// INTENTION_TEXT: Simplify negated '<' expression to '>='
|
||||
fun test(n: Int) {
|
||||
<caret>!(0 < 1)
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
// INTENTION_TEXT: Simplify negated '<' expression to '>='
|
||||
fun test(n: Int) {
|
||||
0 >= 1
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
// INTENTION_TEXT: Simplify negated '<=' expression to '>'
|
||||
fun test(n: Int) {
|
||||
<caret>!(0 <= 1)
|
||||
}
|
||||
-4
@@ -1,4 +0,0 @@
|
||||
// INTENTION_TEXT: Simplify negated '<=' expression to '>'
|
||||
fun test(n: Int) {
|
||||
0 > 1
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
// INTENTION_TEXT: Simplify negated '!=' expression to '=='
|
||||
fun test(n: Int) {
|
||||
<caret>!(0 != 1)
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
// INTENTION_TEXT: Simplify negated '!=' expression to '=='
|
||||
fun test(n: Int) {
|
||||
0 == 1
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
// INTENTION_TEXT: Simplify negated '!is' expression to 'is'
|
||||
fun test(n: Int) {
|
||||
<caret>!(0 !is Int)
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
// INTENTION_TEXT: Simplify negated '!is' expression to 'is'
|
||||
fun test(n: Int) {
|
||||
0 is Int
|
||||
}
|
||||
Reference in New Issue
Block a user