Skip to content

Commit f7f1207

Browse files
committed
Kotlin: Add test case for ::class type check in equals
1 parent 0e6735b commit f7f1207

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
| Test.kt:10:14:12:5 | equals | This 'equals()' method does not check argument type. |

java/ql/test/kotlin/query-tests/MissingInstanceofInEquals/Test.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,9 @@ data class E(val x: Int) {
55
return (other as? E)?.x == this.x
66
}
77
}
8+
9+
data class F(val x: Int) {
10+
override fun equals(other: Any?): Boolean {
11+
return other != null && other::class == this::class
12+
}
13+
}

0 commit comments

Comments
 (0)