Open
Description
Consider the following example
This fails with
Back-end (JVM) Internal error: Failed to generate expression: KtNameReferenceExpression
File being compiled: (1,28) in Line_7.jupyter-kts
The root cause java.lang.UnsupportedOperationException was thrown at: org.jetbrains.kotlin.codegen.context.ConstructorContext.getOuterExpression(ConstructorContext.java:65)
See attached notebook (zipped because github does not allow ipynb attachments to tickets) for complete example.
This code is legit in a main
import kotlin.random.Random
fun main() {
val rand = Random(10)
rand.nextInt()
data class Foo(val smthg: Int = rand.nextInt() )
println(Foo())
}
Environment: Windows10 & Kotlin kernel v. 0.10.3.31, Kotlin v. 1.6.20-dev-3702