"Suspicious ==/===": do not report when comparison with null is included
So #KT-24001 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
d15e43f38a
commit
4d1b8405cb
+9
@@ -34,4 +34,13 @@
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Suspicious combination of == and ===</problem_class>
|
||||
<description>Suspicious combination of == and ===</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>test.kt</file>
|
||||
<line>18</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="test.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Suspicious combination of == and ===</problem_class>
|
||||
<description>Suspicious combination of == and ===</description>
|
||||
</problem>
|
||||
</problems>
|
||||
@@ -7,6 +7,15 @@ object Main {
|
||||
if (type === CONST1 || type == CONST2 && !(type === CONST3)) return
|
||||
if (type === CONST1 || type1 == CONST2 && type === CONST3) return
|
||||
if (type === CONST1 || type1 == CONST1 && type === CONST3) return
|
||||
|
||||
val type2: Main? = null
|
||||
if (type2 == null || type === type2) return
|
||||
|
||||
val type3: Main? = null
|
||||
if (type3 === null || type == type3) return
|
||||
|
||||
val type4: Main? = null
|
||||
if (type4 == null || type === type2 || type1 == type) return
|
||||
}
|
||||
|
||||
val CONST1 = Main;
|
||||
|
||||
Reference in New Issue
Block a user