class A { fun foo(a: Int, b: Int): Int { return object: Function0 { override fun invoke(): Int { return i() } private fun i() = a + b - 1 } } }