If a KCallable
is created using Any()::toString
then when it's later referenced you don't need to pass that Any
instance (when using call
).
Though if it's created using Any::toString
(not an instance of Any
) it's required to pass an Any
instance.
So my question is how can I easily find out whether I need to pass that instance parameter and is this parameter mandatory?
I found a way to do this:
callable.parameters[0].kind == KParameter.Kind.INSTANCE
but it isn't quite nice and I wonder if there's an easier or recommended way to solve this. Thanks!