import kotlin.reflect.KProperty class Delegate(val value: T? = null) { operator fun getValue(instance: Any?, property: KProperty<*>): T = value!! } val nonLocal by Delegate() val init0 = run { val local1 by Delegate() val local2 by Delegate() } val init1 = run { val local3 by Delegate() } class Class { init { val local4 by Delegate>() } fun f() { val local5 by Delegate?>() fun g() { val local6 by Delegate() } } }