Files
codeql/java/ql/test-kotlin2/query-tests/UselessNullCheck/Test.kt
Owen Mansel-Chan 29b0c286a7 Fix 3 more tests
2026-06-11 23:40:14 +02:00

19 lines
313 B
Kotlin

fun fn(x:Any?, y: Any?) {
if (x == null && y == null) {
throw Exception()
}
if (x != null) {
println("x not null")
} else if (y != null) {
println("y not null")
}
}
fun fn0(o: Any?) {
if (o != null) {
o?.toString() // $ Alert
o.toString()
}
}