I want to override an extension function and want to call super implementation.
here is the example source code and link to the playground.
open class TestA {}
open class Test1 {
open fun <T : TestA> T.function1(): T = apply {
// do something
}
open fun <T : Test1> T.function2(): T = apply {
// do something
}
}
class Test2 : Test1() {
override fun <T : TestA> T.function1(): T = apply {
super.function1() // compile error at here: Unresolved reference.
// do somethings or changing access modifier
}
override fun <T : Test1> T.function2(): T = apply {
super.function2() // compile error at here: 'super' is not an expression, it can not be used as a receiver for extension functions
// do somethings or changing access modifier
}
}