is it intended behavior that ``` fun ParseNode.ac...
# announcements
g
is it intended behavior that
Copy code
fun ParseNode.accept(visitor: Visitor){
    when(this){
        is NodeTypeA -> this.internalAccept(visitor::visitEnter, visitor::visitLeave)
    }
}

private fun <T> T.internalAccept(enter: (T) -> Unit, leave: (T) -> Unit): Unit = TODO()
will not compile without the
this.
infront of
internalAccept
? It seems like theres a corner case I'm hitting between smart casting and type inference that isnt covered here.
a
groostav: What error message do you get when trying to compile it?
g
if you remove the
this.
from the third line, then
Error:(31, 50) Kotlin: None of the following functions can be called with the arguments supplied:
public final fun visitEnter(node: NodeTypeA): Unit defined in com.empowerops.Visitor
public final fun visitEnter(node: NodeTypeB): Unit defined in com.empowerops.Visitor
and so on