Smart casting of Kotlin functions to Java SAMs?

Why does this work:

   Platform.runLater { ....code..... }

Given a Java prototype of:

   public static void runLater(Runnable runnable)

… but this does not work …

    val x: Runnable = { print("foo") }

Error: type mismatch: java.lang.Runnabel vs ()->Unit
If you write this though, the compiler is happy:

    val x: Runnable = Runnable { print("foo") }

Seems like the compiler should figure this out for itself.

Looks like a bug to me. Could you please submit an issue?

https://youtrack.jetbrains.com/issue/KT-8049