How does this compile without errors?
fun main() {
val list = listOf(5, 3, 4, 11, 6)
print(test(1, "abc", 4))
}
fun test(criteria: T, actual: T, points: Int): Int {
if (criteria == null) return 0
return if (criteria == actual) points else 0
}
// prints 0
The arguments provided in main function does not match generics contract in the test function. How does this compile? Tested with Kotlin 1.7.10, here's the kotlin playground link: <a href="
https://pl.kotl.in/s9fJVUw0D" rel="nofollow...