KT-2422 Invalid warning "Condition is always true"
#KT-2422 fixed
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
package bar
|
||||
|
||||
class Test {
|
||||
val foo: Int? = null
|
||||
fun foo(o: Test) = foo == null && o.foo == null // ERROR warning: o.test == null is always true
|
||||
|
||||
fun bar(a: Test, b: Test) {
|
||||
if (a.foo != null) {
|
||||
useInt(<!TYPE_MISMATCH!>b.foo<!>)
|
||||
}
|
||||
if (a.foo != null) {
|
||||
useInt(<!TYPE_MISMATCH!>foo<!>)
|
||||
}
|
||||
if (this.foo != null) {
|
||||
useInt(foo)
|
||||
}
|
||||
if (foo != null) {
|
||||
useInt(this.foo)
|
||||
}
|
||||
}
|
||||
|
||||
fun useInt(i: Int) = i
|
||||
}
|
||||
Reference in New Issue
Block a user