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
596
596
val saved = comparedTypeLambdas
597
597
comparedTypeLambdas += tp1
598
598
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)
607
600
try variancesOK && boundsOK && isSubType(tp1.resType, tp2.resType.subst(tp2, tp1))
608
601
finally comparedTypeLambdas = saved
609
602
case _ =>
Original file line number Diff line number Diff line change 1
1
scala> object Foo1 { type T[+A] = (A, Int) }
2
2
// defined object Foo1
3
- scala> object Foo2 { type T[+A] = [+ B] =>> (A, B) }
3
+ scala> object Foo2 { type T[+A] = [B] =>> (A, B) }
4
4
// 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) }
6
6
// defined object Foo3
7
7
scala> ((1, 2): Foo1.T[Int]): Foo1.T[Any]
8
8
val res0: (Any, Int) = (1,2)
You can’t perform that action at this time.
0 commit comments