Kotlin / kotlin-jupyter

Kotlin kernel for Jupyter/IPython
Apache License 2.0
1.09k stars 106 forks source link

Backend Internal error: Exception during IR lowering when using inline fun with crossinline and anonymous object defined in another cell #368

Open ileasile opened 2 years ago

ileasile commented 2 years ago

Original error is: Local class should have its name computed in InventNamesForLocalClasses

Execute two cells:

class R {
    val x: Int = 1
}
inline fun R.t(crossinline action: (R) -> Int) = object {
    val y get() = action(this@t)
}

and

R().t {it.x * 2}

Result:

Backend Internal error: Exception during IR lowering
File being compiled: Line_316.jupyter-kts
The root cause java.lang.RuntimeException was thrown at: org.jetbrains.kotlin.backend.jvm.codegen.FunctionCodegen.generate(FunctionCodegen.kt:50)