Not sure if it has its place here, but it seems to be a bug with 1.7.20-Beta, so I'm writing here.
Trying to play with context receivers, I am defining the following function:
fun <C1, C2, R> withBoth(c1: C1, c2: C2, block: context(C1, C2) () -> R): R = block(c1, c2)
And I get this compiler error:
Subtyping relation between context receivers is prohibited
Is this a bug, or did I mess up the syntax somewhere? There is no subtyping intended anywhere here.
Note that moving
C2
as a regular receiver fixes the compilation:
fun <C1, C2, R> withBoth(c1: C1, c2: C2, block: context(C1) C2.() -> R): R = block(c1, c2)