I want to pass a parameter to a function (actually a super class constructor call), and this parameter is a complicated expression and I tried using
run { ... }
. However,
run
is overloaded as both an extension and non-extension function. Since the context includes an implicit "this" receiver, Kotlin favours calling the extension version. How can I force it to run the non-extension version?
Klitos Kyriacou
09/29/2022, 2:52 PM
Found the answer: call
kotlin.run
instead of just
run
.
e
ephemient
09/29/2022, 2:52 PM
Kotlin should always prefer calling a member function. what do you mean by "non-extension function"?