Removing the private
modifier of myScope
(line 4) in the following working code will break the code. The reason for that is the changing type of myScope
. Is the visibility set to private
the type is: anonymous object : Scope
. Without private
the type is switched to Scope
. How can I fix this behavior?
interface Scope
operator fun<SD: Scope> SD.invoke(block: SD.() -> Unit) = block()
private val myScope = object : Scope {
fun Int.myScopedExtFunction() = 1337
}
fun usage() {
myScope {
1.myScopedExtFunction()
}
}