Kelvin Chung
07/26/2025, 6:01 PMinterface Base<T> {
fun doSomething(): T
}
interface IntBase : Base<Int> {
override fun doSomething() = 0
}
interface MyInterface : Base<Int>, IntBase {
override fun doSomething() = super.doSomething()
}
It seems like I am required to have the line in MyInterface
, despite only inheriting a default implementation from only one place. Is this normal, or is it because I'm using an older version of Kotlin?Joffrey
07/26/2025, 6:06 PMJoffrey
07/26/2025, 6:07 PMGleb Minaev
07/26/2025, 6:33 PMKelvin Chung
07/26/2025, 9:17 PMinterface Base<T> {
val value: T
}
interface IntBase : Base<Int> {
override val value get() = 0
}
interface MyIntBase : Base<Int>, IntBase
The compiler is saying that I have to explicitly override value
in MyIntBase
, despite there being only one super-interface where a default implementation is provided.Joffrey
07/27/2025, 6:39 AMKelvin Chung
07/27/2025, 9:55 PMcommonMain
, so it probably shouldn't matter since the only platform-specific code is JVM at the moment.