Hi all, I have following:
fun <T> checkCondition(fn: MyMatcher.(arg: T) -> Unit) {
val matcher = MyMatcher()
matcher.fn(arg)
println("check condition call")
}
Unfortunately arg is an unresolved reference in fun body ;/, however, when I did:
fun <T> checkCondition(fn: MyMatcher.(arg: T) -> Unit) = { arg: T ->
val matcher = MyMatcher()
matcher.fn(arg)
println("check condition call")
}
but now the only way I can make call to this function is by:
checkCondition<Int> ({ isGreaterThanZero(myInt) })(otherIgnoredInFunBodyInt)
where otherIgnoredInFunBodyInt
is not considered in my function body, I get proper results for myInt
simple:
checkCondition<Int> ({ isGreaterThanZero(myInt) })
is called never.
Thanks in advance for resolving my misunderstandings