The `b` in `a(c[0]!!(), b)` will error with type m...
# getting-started
s
The
b
in
a(c[0]!!(), b)
will error with type mismatch. Expected
CapturedType(out B*>)
but
B<*>
. How to pass the
b
as param? https://pl.kotl.in/VVNMv8Zso Edited: add comment
Copy code
// KSerializer in my actual env
open class A<T>

// An external class from lib
class B<T>

// My serializer
class C : A<B<Int>>()
// A map to take correct serializer by arg
val c: Map<Int, () -> A<out B<*>>> = mapOf(0 to { C() })

// CompositeEncoder#encodeSerializableElement in my actual env
fun <U, T : A<U>> a(a: T, b: U) {
}

// KSerializer#serialize(encoder: Encoder, value: B<*>) in my actual env
fun b(b: B<*>) {
    a(c[0]!!(), b)
}
Error
Copy code
Type mismatch.
Required:
CapturedType(out B*>)
Found:
B<*>