@@ -814,10 +814,20 @@ clauses need be tried.
814814 - Note that we have already eliminated the case that ` X ` is a variable in
815815 ` L ` .
816816
817- - If ` P ` is ` C<M0, ..., Mk> ` and ` Q ` is ` C<N0, ..., Nk> ` , then the match holds
818- under constraints ` C0 + ... + Ck ` :
819- - If ` Mi ` is a subtype match for ` Ni ` with respect to ` L ` under constraints
820- ` Ci ` .
817+ - If ` P ` is ` C<M0, ..., Mk> ` and ` Q ` is ` C<N0, ..., Nk> ` , and the corresponding
818+ type parameters declared by the class ` C ` are ` T0, ..., Tk ` , then the match
819+ holds under constraints ` C0 + ... + Ck ` , if for each ` i ` :
820+ - If ` Ti ` is a ** covariant** type variable, and ` Mi ` is a subtype match for
821+ ` Ni ` with respect to ` L ` under constraints ` Ci ` ,
822+ - Or ` Ti ` is a ** contravariant** type variable, ` Ni ` is a subtype match for
823+ ` Mi ` with respect to ` L ` under constraints ` Ci ` ,
824+ - Or ` Ti ` is an ** invariant** type variable, and:
825+ - ` Mi ` is a subtype match for ` Ni ` with respect to ` L ` under constraints
826+ ` Ci0 ` ,
827+ - And ` Ni ` is a subtype match for ` Mi ` with respect to ` L ` under constraints
828+ ` Ci1 ` ,
829+ - And ` Ci ` is ` Ci0 + Ci1 ` .
830+
821831- If ` P ` is ` C0<M0, ..., Mk> ` and ` Q ` is ` C1<N0, ..., Nj> ` then the match holds
822832with respect to ` L ` under constraints ` C ` :
823833 - If ` C1<B0, ..., Bj> ` is a superinterface of ` C0<M0, ..., Mk> ` and `C1<B0,
0 commit comments