Skip to content

Commit de833d6

Browse files
committed
Kotlin: Add FP test case for unnecessarily complex bool expression
1 parent c70f3d3 commit de833d6

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
| SimplifyBoolExpr.kt:8:8:8:16 | ... (value equals) ... | Expressions of the form "A == true" can be simplified to "A". |
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
fun main() {
2+
f(null)
3+
f(true)
4+
f(false)
5+
}
6+
7+
fun f(x: Boolean?) {
8+
if(x == true) {
9+
println("Yes")
10+
} else {
11+
println("No")
12+
}
13+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Violations of Best Practice/Boolean Logic/SimplifyBoolExpr.ql

0 commit comments

Comments
 (0)