CLOVIS
03/29/2026, 10:07 PMList has a subtype that contains elements that are a subtype of the elements of the parent?
interface A
class AImpl : A
interface Container : List<A>
class ContainerImpl : Container, List<AImpl> {
// …
}
I'm getting:
Type parameter 'E' of 'interface List<out E> : Collection<E>' has inconsistent values: A, AImpl.
I know I can do:
interface Container<T> : List<T>
class ContainerImpl : Container<AImpl> {
// …
}
but it doesn't make sense for Container to be parameterized in my case.ephemient
03/29/2026, 10:23 PMYoussef Shoaib [MOD]
03/30/2026, 5:56 PMinterface A
class AImpl : A
typealias Container = ContainerT<*>
interface ContainerT<out T: A> : List<T>
class ContainerImpl : ContainerT<AImpl>CLOVIS
03/30/2026, 6:22 PM