I.e. ```abstract class ReceiverClass { open fun ...
# announcements
p
I.e.
Copy code
abstract class ReceiverClass {

 open fun String.onSomethingHappened(){
   println(this)
 }
}

class Child  : ReceiverClass(){

  override fun String.onSomethingHappened() {
    super.onSomethingHappened() <-- doesnt compile
    println("hello world")
  }
}
s
does the code compile without the
super.onSomethingHappened
?? I'm very much surprised that you seem to be able to override functions with receivers at all, since my mental model for them is that it's basically syntactic sugar for static methods.
p
Sure why not
Its not synthetic sugar for static methods its synthetic sugar to have a receiver 🙂
I use it on android with viewBinding
So I have an open
B.onBindingCreated()
function and all my rendering functions have the binding as a receiver
k
super.onSomethingHappend()
would make the
super
the receiver instead of the
String
. We still don't have a way to do multiple receivers.
I found this workaround