Mark
04/29/2022, 1:35 AMinterface Sequenceable<out T> {
fun asSequence(): Sequence<T>
}
interface Item
interface TypeOfItem: Item
interface Items: Sequenceable<Item>
interface TypeOfItems : Items, Sequenceable<TypeOfItem> // Error message: Type parameter T of 'Sequenceable' has inconsistent values: Item, TypeOfItem
https://pl.kotl.in/BSez9qCNJephemient
04/29/2022, 2:07 AMinterface Items: Sequenceable<Item> {
fun asSequence(): Sequence<Item> = sequenceOf()
}
now TypeOfItems.asSequence()
, if it doesn't override asSequence()
, does not return a Sequence<TypeOfItem>
Mark
04/29/2022, 2:53 AMephemient
04/29/2022, 3:08 AMMark
04/29/2022, 3:34 AMephemient
04/29/2022, 3:51 AMTim Oltjenbruns
04/29/2022, 12:05 PMItems<out T: Item> : Sequencable<T>
and then interface TypeOfItems : Items<TypeOfItem>
If the naming Items<Item>
at call site isn’t desirable you could typealias it typealias PlainItems = Items<Item>