Skip to content

Back-end (JVM) Internal error: Failed to generate expression: KtNameReferenceExpression #345

Open
@holgerbrandl

Description

@holgerbrandl

Consider the following example
image

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.

RandomInit.ipynb.zip

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions