The compiler shows an error
“Overload resolution ambiguity:
public final operator fun div(other: Byte): Int defined in kotlin.Int
public final operator fun div(other: Double): Double defined in kotlin.Int
public final operator fun div(other: Float): Float defined in kotlin.Int
public final operator fun div(other: Int): Int defined in kotlin.Int
public final operator fun div(other: Long): Long defined in kotlin.Int
public final operator fun div(other: Short): Int defined in kotlin.Int”
This does not work as well as expected for generics :
interface I {
fun exists(n: Int): Boolean
fun exists(n: String): Boolean
}
abstract class A<T> {
abstract val m: I.(T) -> Boolean
}
class B : A<Int>() {
override val m = I::exists // Overload resolution ambiguity
}