The combination of the following code causes a compiler exception:
inline fun <T,R> AsyncConnection<T>.mapEdges(crossinline transform: suspend (T) -> R): AsyncConnection<R> {
return object: AsyncConnection<R> {
override suspend fun loadEdges(): List<Edge<R>> {
return this@mapEdges.loadEdges().mapSuspend { DefaultEdge(transform(it.node), it.cursor) }
}
override suspend fun loadPageInfo(): PageInfo = this@mapEdges.loadPageInfo()
}
}
inline fun <T,R> AsyncConnection<T>.mapEdges(crossinline transform: suspend (T) -> R): AsyncConnection<R> {
return object: AsyncConnection<R> {
override suspend fun loadEdges(): List<Edge<R>> {
return this@mapEdges.loadEdges().mapSuspend { DefaultEdge(transform(it.node), it.cursor) }
}
override suspend fun loadPageInfo(): PageInfo = this@mapEdges.loadPageInfo()
}
}
Error:Kotlin: [Internal Error] java.lang.IllegalStateException: Backend Internal error: Exception during code generation
Cause: Back-end (JVM) Internal error: Couldn’t inline method call ‘mapSuspend’ into
public open suspend fun loadEdges(continuation: