I'd like to create a function like this:
fun doSomething(vararg options: Pair<String, ()->Unit>) {
})
and call it like this:
doSomething(
"a" to {
},
"b" to {
}
)
Unfortunately, the compiler complains:
Kotlin: Type inference failed: Not enough information to infer parameter B in fun <A, B> A.to(that : B) : kotlin.Pair<A, B> Please specify it explicitly.
Is there no way to do this? I figured that since the call target specified the types that the type inference of the ‘to’ function would work.