Here is a minimal example that demonstrates the problem:
abstract class Base {
abstract fun String.extension(x: Char)
}
class Derived : Base() {
ove
Your extension function is defined only inside of Base/Derived class. See Declaring Extensions as Members.
abstract class Base {
abstract fun String.extension(x: Char)
}
class Derived : Base() {
override fun String.extension(x: Char) {
// Calling lots of methods on String, hence extension method
println("${first()} $length ${last()} ${firstOrNull { it == x }} ...")
}
fun callExtension(c: Char) {
"hello".extension(c)
}
}
fun main(args: Array) {
val base = Derived()
base.callExtension('h')
}