Typeclass variance cannot be expressed with language.experimental.modularity
Self
types
#20365
Labels
stat:needs triage
Every issue needs to have an "area" and "itype" label
Compiler version
Latest
main
,3393f7ea7704eb1dd553c96a805906821c61db5f
.Minimized example
I'm not sure if I've missed a critical detail somewhere, but it's not clear if there's an intended way to support definition-site variance on a typeclass's
Self
type. (The word "variance" doesn't appear in the documentation, and I don't recall it being discussed during the long discussion about the feature.)What this seems to mean is that the old-style typeclass and given instance,
would need its
given
instance rewritten as,rather than,
in order for
summon[Foo['x']]
to resolve.Expectation
I would expect there to be a way to specify the
Self
type's variance at the typeclass definition site, or for the documentation to offer a solution.The text was updated successfully, but these errors were encountered: