https://kotlinlang.org logo
#announcements
Title
# announcements
j

janvladimirmostert

09/11/2017, 12:28 PM
yeah, I've removed it, it says construction is not yet supported in inline functions
i

ilya.gorbunov

09/11/2017, 5:19 PM
j

janvladimirmostert

09/11/2017, 5:37 PM
Awesome stuff! That would obviously allow me to get rid of the
noinline
hacks. Would that also allow me to this?
Copy code
inline fun blah(
    f1: (em: EM) -> Unit = { },
    f2: (em: EM) -> Any? = { null } 
): Result {
    f1(em)
    val res = f2(em)
    return Result()
}
Copy code
blah {
   // no statement here
}
and
Copy code
blah {
   "a string statement" // statement which can be picked up by `val res = f2(em)`
}
i

ilya.gorbunov

09/11/2017, 6:02 PM
In both cases the lambda is passed as the
f2
argument.
j

janvladimirmostert

09/11/2017, 6:06 PM
Currently scenario 1 doesn't compile, should it?
Copy code
blah {
   // no statement here
}
Expected a value of Any?
Even when I reduce it to:
Copy code
val ffun: (em: EntityManager) -> Any? = { null }
Copy code
inline fun blah(
    noinline f: (em: EM) -> Any? = ffun
): Result {
    val res = f(em)
    return Result()
}
i

ilya.gorbunov

09/11/2017, 6:10 PM
I think it should. If it's not, please report a bug.
j

janvladimirmostert

09/11/2017, 6:10 PM
cool, will do so
2 Views