Skip to content

Commit e2efef7

Browse files
committed
Kotlin: Add more type check tests for MissingInstanceofInEquals query
1 parent 39fd1b4 commit e2efef7

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
| Test.kt:0:0:0:0 | equals | equals() method does not seem to check argument type. |
2+
| Test.kt:4:14:6:5 | equals | equals() method does not seem to check argument type. |
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Likely Bugs/Comparison/MissingInstanceofInEquals.ql
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
data class D(val x: Int) {}
2+
3+
data class E(val x: Int) {
4+
override fun equals(other: Any?): Boolean {
5+
return (other as? E)?.x == this.x
6+
}
7+
}

0 commit comments

Comments
 (0)