Kotlin function type inference

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.

Ok, I'm starting to think this is a bug, because this works:

val aFunc = {

}

val bFunc = {

}

doSomething(

  "a" to aFunc,

  "b" to bFunc

);

I’m not sure why inlining the functions should change anything.

I have logged a bug: http://youtrack.jetbrains.com/issue/KT-3435

All right, it's bug. Thanks.