i just tried beta4 with Doodle and i'm seeing issu...
# k2-adopters
n
i just tried beta4 with Doodle and i'm seeing issues with extending `expect`/`actual` classes. I have a class as follows:
Copy code
public interface Pool<in T> {
    public operator fun plusAssign (item: T)
    public operator fun minusAssign(item: T)
}

public expect open class SetPool<T> private constructor(delegate: MutableSet<T>): Pool<T>, Set<T> {
    public constructor()
}
And the corresponding actual:
Copy code
public actual open class SetPool<T> actual constructor(private val delegate: MutableSet<T>): Pool<T>, Set<T> by delegate {
    public actual constructor(): this(CopyOnWriteArraySet())

    override fun plusAssign (item: T) { delegate += item }
    override fun minusAssign(item: T) { delegate -= item }
}
This worked in 1.9.x, but now fails with the following error:
Copy code
'actual class SetPool<T> : Pool<T>, Set<T>' has no corresponding members for expected class members:

    expect fun contains(element: T): Boolean

    The following declaration is incompatible because modality is different:
        fun contains(element: T): Boolean

    expect fun containsAll(elements: Collection<T>): Boolean

    The following declaration is incompatible because modality is different:
        fun containsAll(elements: Collection<T>): Boolean

    expect fun isEmpty(): Boolean

    The following declaration is incompatible because modality is different:
        fun isEmpty(): Boolean

    expect fun iterator(): Iterator<T>

    The following declaration is incompatible because modality is different:
        fun iterator(): Iterator<T>

    expect val size: Int

    The following declaration is incompatible because modality is different:
        val size: Int
is there some issue with
expect
/`actual` classes implementing interfaces?
e
Not sure what the issue is, but it looks like it's related to the delegation, not the implementation of the interface.
p
Well, it is a long story. You can read it here. As I understand, it was already depreacated with warning in 1.9.20. The workaround here is to write explicit overrides in expect class. This make sense - you expect class is not abstract, but by some reason doesn't implement methods of it's super interface. I think you also should have some error about that. Also, as they are not implemented, they are abstract, and having abstract expect and open actual is not allowed (because it for example can lead to several implementations of same method in subclasses of SetPool in common code).