Kotlin: Add more type check tests for MissingInstanceofInEquals query

This commit is contained in:
Tamas Vajk
2022-05-13 13:50:59 +02:00
parent 39fd1b48fc
commit e2efef7bd7
3 changed files with 10 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
| Test.kt:0:0:0:0 | equals | equals() method does not seem to check argument type. |
| Test.kt:4:14:6:5 | equals | equals() method does not seem to check argument type. |

View File

@@ -0,0 +1 @@
Likely Bugs/Comparison/MissingInstanceofInEquals.ql

View File

@@ -0,0 +1,7 @@
data class D(val x: Int) {}
data class E(val x: Int) {
override fun equals(other: Any?): Boolean {
return (other as? E)?.x == this.x
}
}