Kotlin: Add FP test case for unnecessarily complex bool expression

This commit is contained in:
Tamas Vajk
2022-11-16 09:35:18 +01:00
parent c70f3d35d0
commit de833d620e
3 changed files with 15 additions and 0 deletions

View File

@@ -0,0 +1 @@
| SimplifyBoolExpr.kt:8:8:8:16 | ... (value equals) ... | Expressions of the form "A == true" can be simplified to "A". |

View File

@@ -0,0 +1,13 @@
fun main() {
f(null)
f(true)
f(false)
}
fun f(x: Boolean?) {
if(x == true) {
println("Yes")
} else {
println("No")
}
}

View File

@@ -0,0 +1 @@
Violations of Best Practice/Boolean Logic/SimplifyBoolExpr.ql