dead.fish
09/26/2024, 11:55 AMexpected
declaration needs to match the actual
type-specific one, which obviously does not work. Here is an example:
// common
interface SomeType
abstract class AbstractTypeWrapper<T: SomeType> {
protected abstract fun instantiate(): T
}
expect class TypeWrapper : AbstractTypeWrapper<SomeType>
^^^--- this is obviously different
// android
interface AndroidType: SomeType
actual class TypeWrapper : AbstractTypeWrapper<AndroidType>() {
override fun instantiate(): AndroidType {
// ...
}
}
// desktop
interface DesktopType: SomeType
actual class TypeWrapper : AbstractTypeWrapper<DesktopType>() {
override fun instantiate(): DesktopType {
// ...
}
}
How would I continue here?dead.fish
09/26/2024, 2:30 PMexpect/actual
seems to be the way to go.