IfThenToSafeAccessInspection: do not report if condition is SENSELESS_COMPARISON/USELESS_IS_CHECK (#3007)

#KT-36051 Fixed
This commit is contained in:
Toshiaki Kameyama
2020-08-19 18:22:10 +09:00
committed by GitHub
parent 122bba9102
commit d965ad0a98
7 changed files with 34 additions and 17 deletions
@@ -1,3 +1,4 @@
// PROBLEM: none
class Foo
class Bar {
@@ -1,8 +0,0 @@
class Foo
class Bar {
fun Foo?.test() {
this@Bar?.bar()
}
fun bar() {}
}
@@ -136,15 +136,6 @@
<problem_class severity="INFO" attribute_key="INFO_ATTRIBUTES">If-Then foldable to '?.'</problem_class>
<description>Foldable if-then</description>
</problem>
<problem>
<file>implicitReceiver3.kt</file>
<line>5</line>
<module>light_idea_test_case</module>
<package>&lt;default&gt;</package>
<entry_point TYPE="file" FQNAME="temp:///src/implicitReceiver3.kt" />
<problem_class severity="INFO" attribute_key="INFO_ATTRIBUTES">If-Then foldable to '?.'</problem_class>
<description>Foldable if-then</description>
</problem>
<problem>
<file>resultCall.kt</file>
<line>6</line>
@@ -0,0 +1,10 @@
// PROBLEM: none
fun test(foo: Foo) {
<caret>if (foo != null) {
foo.bar()
}
}
class Foo {
fun bar() {}
}
@@ -0,0 +1,10 @@
// PROBLEM: none
fun test(foo: Foo) {
<caret>if (foo is Foo) {
foo.bar()
}
}
class Foo {
fun bar() {}
}