Right now izumi-reflect correctly detects variance on Scala 3 for trait/class types:
But not for opaque types, where type variables are assumed invariant:
object x {
opaque type X[+T] = Any
}
That's because we rely on Symbol#declaredTypes method to find out the variances of type parameters of a type. But an opaque type does not "declare" its parameters as members of its definition and therefore declaredTypes List is empty.
We need to find and test some other way to extract that data – perhaps using private compiler APIs if there's no way to extract that data using public API.
Right now izumi-reflect correctly detects variance on Scala 3 for trait/class types:
But not for opaque types, where type variables are assumed invariant:
That's because we rely on
Symbol#declaredTypesmethod to find out the variances of type parameters of a type. But an opaque type does not "declare" its parameters as members of its definition and thereforedeclaredTypesList is empty.We need to find and test some other way to extract that data – perhaps using private compiler APIs if there's no way to extract that data using public API.