mirror of
https://github.com/github/codeql.git
synced 2026-04-29 02:35:15 +02:00
Kotlin: Add test for useless null check on safe calls
This commit is contained in:
@@ -9,3 +9,10 @@ fun fn(x:Any?, y: Any?) {
|
||||
println("y not null")
|
||||
}
|
||||
}
|
||||
|
||||
fun fn0(o: Any?) {
|
||||
if (o != null) {
|
||||
o?.toString()
|
||||
o.toString()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
| Test.kt:15:12:15:21 | ... (value equals) ... | This check is useless. $@ cannot be null at this check, since it is guarded by $@. | Test.kt:15:9:15:9 | tmp0_safe_receiver | tmp0_safe_receiver | Test.kt:14:9:14:17 | ... (value not-equals) ... | ... (value not-equals) ... |
|
||||
|
||||
Reference in New Issue
Block a user