private class A { val bar = 1 val parent: A get() = null!! } fun myrun(f: () -> T) = f() private fun test(a: A) { myrun { a.bar } }