Skip to content

Commit 9fa3ea6

Browse files
committed
Further simplifications and test fixes
1 parent 85c11d1 commit 9fa3ea6

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

compiler/src/dotty/tools/dotc/core/TypeComparer.scala

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff 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 _ =>

compiler/test-resources/repl/i6474

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
scala> 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
77
scala> ((1, 2): Foo1.T[Int]): Foo1.T[Any]
88
val res0: (Any, Int) = (1,2)

0 commit comments

Comments
 (0)