KT-12019 Highlighting of redundant 'if' statements (#871)

This commit is contained in:
Vladislav Golub
2016-05-23 21:02:38 +03:00
committed by Dmitry Jemerov
parent cf56ac0305
commit bb32c2d350
12 changed files with 180 additions and 2 deletions
@@ -0,0 +1,18 @@
<problems>
<problem>
<file>redundantIf.kt</file>
<line>2</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="redundantIf.kt" />
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Redundant 'if' statement</problem_class>
<description>Redundant 'if' statement</description>
</problem>
<problem>
<file>redundantIf.kt</file>
<line>10</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="redundantIf.kt" />
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Redundant 'if' statement</problem_class>
<description>Redundant 'if' statement</description>
</problem>
</problems>
@@ -0,0 +1 @@
// INSPECTION_CLASS: org.jetbrains.kotlin.idea.inspections.RedundantIfInspection
+11
View File
@@ -0,0 +1,11 @@
fun foo() {
if (value % 2 == 0) {
return true
} else {
return false
}
}
fun bar() {
if (value % 2 == 0) return true else return false
}