But the receiver type is of the companion object of the class and doesn't work if the class doesn't have any companion object, so this is not what I want
I want to be able to do
AnyClass.create { }
and have the receiver equal to the receiver when doing
AnyClass().apply { }
i
ilya.gorbunov
02/14/2022, 5:29 AM
No, it's not possible.
ilya.gorbunov
02/14/2022, 5:33 AM
If https://youtrack.jetbrains.com/issue/KT-11968 is implemented, it would be possible to provide a static extension for an arbitrary, but still a concrete type. However, we're also exploring the design space of the further possibilities, such as providing "static-like" extensions for a generic type.