groostav
03/06/2017, 6:28 AMfun 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.Andreas Sinz
03/06/2017, 8:50 AMgroostav
03/06/2017, 7:47 PMthis.
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