Why does calling an extension property make my object "capture script class instance"?

This situation looks like a bug to me, but I’m new with Kotlin and really can’t tell.

I’m getting the following error:

Object ImportantConfigClass captures the script class instance. Try to use class or anonymous object instead

object ImportantConfigClass {
    init {
        DataClass().propExtension
    }
}

data class DataClass (
    val paused: Boolean = false
)

val DataClass.propExtension: Boolean
    get() {
        return this.paused
    }

What does it mean that it captures the script class instance, and why does that happen?

Are you doing this in a Scratch file in IntelliJ, or a Kotlin Script File? (I know nothing about Kotlin Script Files or if they’re even a thing.)

If that was a regular Kotlin file that you’re compiling and running… yeah I agree, that looks like a bug. I would expect your init block to just be useless, because it calls the extension property on the object, but doesn’t store any value, so it’d all be garbage collected.