Exception during code generation (inlining suspend functions)


#1

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:


#2

Thanks for the report. Please share your build.gradle file with all dependencies, so we can reproduce this problem with your sample code. You can do it by submitting an issue here: http://kotl.in/issue.