Damien
08/03/2021, 11:43 PMout
parameter, but the compiler is complaining.
Error: Type parameter T is declared as 'out' but occurs in 'in' position in type (T) -> C<T>ephemient
08/04/2021, 12:21 AMB : A
,
val c = C<B>()
c.foo { value: A -> C<A>(value) }
should not be allowed, but would be if your function were accepted and val c: C<A> = C<B>()
which is allowed by <out T>
ephemient
08/04/2021, 12:28 AMfun <T> C<T>.foo(f: (T) -> C<T>): C<T>
it would be accepted, as you can't cause any issues with thatephemient
08/04/2021, 12:29 AMclass C<out T>(val member: T) {
fun foo(f: (value: T) -> C<@UnsafeVariance T>): C<T>
}
is accepted, but as the annotation name indicates…