zceejkr
11/10/2019, 7:04 PMsealed class S {}
data class A: S() {}
data class B: S() {}
data class C: S() {}
But then I have a Decoder<T> type, which is defined like so:
interface State<A, S> {
val runState: (s: S) -> Pair<A, S>
}
typealias Decoder<A> = State<A, ByteArrayBuffer>
Then I created Decoder<A>, Decoder<B> and Decoder<C>.
And I wanted to use a when expression to create Decoder<S>. But the compiler complains that I am returning A instead of S in the Decoder<S> definition.
Any ideas what to do?