Nick
02/27/2024, 3:43 PMpublic 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:
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:
'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?eygraber
02/27/2024, 3:58 PMPavel Kunyavskiy [JB]
02/27/2024, 9:43 PM