File tree Expand file tree Collapse file tree 2 files changed +3
-10
lines changed
src/dotty/tools/dotc/core Expand file tree Collapse file tree 2 files changed +3
-10
lines changed Original file line number Diff line number Diff line change @@ -596,14 +596,7 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
596596 val saved = comparedTypeLambdas
597597 comparedTypeLambdas += tp1
598598 comparedTypeLambdas += tp2
599- val variancesOK =
600- variancesConform(tp1.typeParams, tp2.typeParams)
601- || { // if tp1 is of the form [X] =>> C[X] where `C` is co- or contra-variant
602- // assume the variance of `C` for `tp1` instead. Fixes #7648.
603- tp1 match
604- case EtaExpansion (tycon1) => variancesConform(tycon1.typeParams, tp2.typeParams)
605- case _ => false
606- }
599+ val variancesOK = variancesConform(tp1.typeParams, tp2.typeParams)
607600 try variancesOK && boundsOK && isSubType(tp1.resType, tp2.resType.subst(tp2, tp1))
608601 finally comparedTypeLambdas = saved
609602 case _ =>
Original file line number Diff line number Diff line change 11scala> object Foo1 { type T[+A] = (A, Int) }
22// defined object Foo1
3- scala> object Foo2 { type T[+A] = [+ B] =>> (A, B) }
3+ scala> object Foo2 { type T[+A] = [B] =>> (A, B) }
44// defined object Foo2
5- scala> object Foo3 { type T[+A] = [+ B] =>> [C] =>> (A, B) }
5+ scala> object Foo3 { type T[+A] = [B] =>> [C] =>> (A, B) }
66// defined object Foo3
77scala> ((1, 2): Foo1.T[Int]): Foo1.T[Any]
88val res0: (Any, Int) = (1,2)
You can’t perform that action at this time.
0 commit comments