TwoClocks
03/22/2021, 5:46 AMType mismatch: inferred type is MessageDispatch but Nothing was expected
what's a nothing
? And the docs say it should be an instance of the class... which it is.. very confused.TwoClocks
03/22/2021, 6:05 AMRuckus
03/22/2021, 3:17 PMNothing
is the "bottom type" in Kotlin, which can be thought of as the logical opposite to Any?
.Ruckus
03/22/2021, 3:22 PMString
, you don't know if it a list of `String`s, `Comparable<String>`s, `Comparable<*>`s, Any
, etc. (and that can more than double if you take all the nullable variants into account as well).TwoClocks
03/22/2021, 4:46 PMNothing
problem, and now running into issues w/ KFunction and the instance (I think.. not sure). I don't think I'm having type erasure issues at the moment, but I can see how it'd come up. I made a stripped down version of my problem here : https://stackoverflow.com/questions/66750194/kotlin-reflection-how-to-add-a-kfunction-to-a-list-via-reflectionTwoClocks
03/22/2021, 4:47 PMYoussef Shoaib [MOD]
03/22/2021, 5:26 PM(Any) -> Any
at first and then add in a lambda that then calls your KFunction with the associated receiver like this:
println("found match, setting type = $parmType")
val lst = prop.call(dis) as MutableList<(Any) -> Any>
lst.add( { param -> func.call(myReceiverInstance, param) } ) // You just need to supply the myReceiverInstance
TwoClocks
03/22/2021, 5:29 PMYoussef Shoaib [MOD]
03/22/2021, 5:32 PMThis error makes me think the instance isn't associated w/ theand that's what I'm referring to. The error is indeed that the function is missing the instance, and this is how you attach itI'm adding to the list... but I don't know how to associate it. I have the instance handy, I just don't know how to attach it. Or maybe it's something else entirely.KFunction
TwoClocks
03/22/2021, 5:33 PM{param -> func.call(app,param)}
?Youssef Shoaib [MOD]
03/22/2021, 5:33 PMTwoClocks
03/22/2021, 5:36 PMTwoClocks
03/22/2021, 5:36 PMTwoClocks
03/22/2021, 5:39 PMYoussef Shoaib [MOD]
03/22/2021, 5:52 PMTwoClocks
03/22/2021, 6:04 PMlst.add(this::myFunc)
is there? I assume the normal way is just syntactic sugar over the same thing?TwoClocks
03/22/2021, 6:20 PMYoussef Shoaib [MOD]
03/22/2021, 6:23 PM