Replace call with comparison inspection introduced #KT-11425 Fixed

(cherry picked from commit 042fc0d)
This commit is contained in:
Mikhail Glukhikh
2016-07-28 11:56:59 +03:00
committed by Mikhail Glukhikh
parent fc13b25ca4
commit 475dc6541b
7 changed files with 75 additions and 0 deletions
@@ -0,0 +1,34 @@
<problems>
<problem>
<file>test.kt</file>
<line>2</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/test.kt" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Can be replaced with comparison</problem_class>
<description>Replace with '==' operator</description>
</problem>
<problem>
<file>test.kt</file>
<line>3</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/test.kt" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Can be replaced with comparison</problem_class>
<description>Replace with '==' operator</description>
</problem>
<problem>
<file>test.kt</file>
<line>6</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/test.kt" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Can be replaced with comparison</problem_class>
<description>Replace with '&gt;' operator</description>
</problem>
<problem>
<file>test.kt</file>
<line>7</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/test.kt" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Can be replaced with comparison</problem_class>
<description>Replace with '&lt;=' operator</description>
</problem>
</problems>
@@ -0,0 +1 @@
// INSPECTION_CLASS: org.jetbrains.kotlin.idea.intentions.conventionNameCalls.ReplaceCallWithComparisonInspection
@@ -0,0 +1,10 @@
fun foo() {
1.equals(1) // YES
!1.equals(2) // YES
1.compareTo(1) // NO
1.compareTo(1) == 0 // NO
2.compareTo(1) > 0 // YES
0 >= 1.compareTo(2) // YES
2.plus(2) // NO
2.times(2) // NO
}