Open
Description
Based on apache/pekko#1474
In Scala 2.13 all generic param types of HKT (both covariant and invariant) are transformed into wildcard types.
In 3.3.4-RC1 / 3.5.0 contravariant types are preserved but erased.
In 3.3.3- both contravariant and covariant types were preserved and not erased
Compiler version
3.3.4 / 3.5.0
Minimized code
import scala.annotation.unchecked.uncheckedVariance
trait SubFlowDef[+F[+_]]
final class Flow1[-In]{
type Repr[+O] = Flow1[In @uncheckedVariance]
}
final class Flow2[+Out]{
type Repr[+O] = Flow2[O]
}
class SubFlow[In, Out](
delegate1: SubFlowDef[Flow1[In]#Repr],
delegate2: SubFlowDef[Flow2[Out]#Repr]
)
Output
Based on javap outputs
Signatures:
Scala 3.3.4-RC1 / 3.5.0
public SubFlow(SubFlowDef<?>, SubFlowDef<Flow2>);
descriptor: (LSubFlowDef;LSubFlowDef;)V
Signature: #9 // (LSubFlowDef<*>;LSubFlowDef<LFlow2;>;)V
Scala 2.13
public SubFlow(SubFlowDef<?>, SubFlowDef<?>);
descriptor: (LSubFlowDef;LSubFlowDef;)V
Signature: #12 // (LSubFlowDef<*>;LSubFlowDef<*>;)V
Scala 3.3.3
public SubFlow(SubFlowDef<Flow1<In>>, SubFlowDef<Flow2<java.lang.Object>>);
descriptor: (LSubFlowDef;LSubFlowDef;)V
Signature: #9 // (LSubFlowDef<LFlow1<TIn;>;>;LSubFlowDef<LFlow2<Ljava/lang/Object;>;>;)V
Expectation
Probably both covariant and contravaraint types should have been replaced with wildcard types in generic signatures