Why can't Kotlin's compiler infer the generic type with some operator calls? For example:
class Example {
operator inline fun <reified T : Any> unaryMinus(): T {
...
}
}
Using it in a main method...
fun main(args: Array<String>) {
val ex = Example()
val works: Boolean = ex.unaryMinus()
val doesntWork: Boolean = -ex
}
This is unfortunately the result of a bug: https://youtrack.jetbrains.com/issue/KT-10453