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
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// FIX: Simplify negated 'in' expression to '!in'
|
||||
class A(val e: Int) {
|
||||
operator fun contains(i: Int): Boolean = e == i
|
||||
}
|
||||
|
||||
fun test(n: Int) {
|
||||
val a = A(1)
|
||||
<caret>!(0 in a)
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// FIX: Simplify negated 'in' expression to '!in'
|
||||
class A(val e: Int) {
|
||||
operator fun contains(i: Int): Boolean = e == i
|
||||
}
|
||||
|
||||
fun test(n: Int) {
|
||||
val a = A(1)
|
||||
0 !in a
|
||||
}
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
// PROBLEM: none
|
||||
infix fun Int.lt(b: Int): Boolean = this < b
|
||||
fun test(n: Int) {
|
||||
<caret>!(1 lt 2)
|
||||
}
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
<problems>
|
||||
|
||||
<problem>
|
||||
<file>notIs.kt</file>
|
||||
<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">Negated boolean expression that can be simplified</problem_class>
|
||||
<description>Negated expression can be simplified</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>notIn.kt</file>
|
||||
<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">Negated boolean expression that can be simplified</problem_class>
|
||||
<description>Negated expression can be simplified</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>notEquals.kt</file>
|
||||
<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">Negated boolean expression that can be simplified</problem_class>
|
||||
<description>Negated expression can be simplified</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>lessThanOrEquals.kt</file>
|
||||
<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">Negated boolean expression that can be simplified</problem_class>
|
||||
<description>Negated expression can be simplified</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>lessThan.kt</file>
|
||||
<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">Negated boolean expression that can be simplified</problem_class>
|
||||
<description>Negated expression can be simplified</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>is.kt</file>
|
||||
<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">Negated boolean expression that can be simplified</problem_class>
|
||||
<description>Negated expression can be simplified</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>in.kt</file>
|
||||
<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">Negated boolean expression that can be simplified</problem_class>
|
||||
<description>Negated expression can be simplified</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>greaterThanOrEquals.kt</file>
|
||||
<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">Negated boolean expression that can be simplified</problem_class>
|
||||
<description>Negated expression can be simplified</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>greaterThan.kt</file>
|
||||
<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">Negated boolean expression that can be simplified</problem_class>
|
||||
<description>Negated expression can be simplified</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>equals.kt</file>
|
||||
<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">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
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// FIX: Simplify negated '!in' expression to 'in'
|
||||
class A(val e: Int) {
|
||||
operator fun contains(i: Int): Boolean = e == i
|
||||
}
|
||||
|
||||
fun test(n: Int) {
|
||||
val a = A(1)
|
||||
<caret>!(0 !in a)
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// FIX: Simplify negated '!in' expression to 'in'
|
||||
class A(val e: Int) {
|
||||
operator fun contains(i: Int): Boolean = e == i
|
||||
}
|
||||
|
||||
fun test(n: Int) {
|
||||
val a = A(1)
|
||||
0 in a
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
// PROBLEM: none
|
||||
fun test(n: Int) {
|
||||
!<caret>true
|
||||
}
|
||||
Reference in New Issue
Block a user