File tree Expand file tree Collapse file tree 2 files changed +17
-7
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 2 files changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -475,14 +475,12 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
475
475
isSubType(tp1.resType, tp2.resType.subst(tp2, tp1))
476
476
finally comparedTypeLambdas = saved
477
477
case _ =>
478
- if (! tp1.isHK) {
479
- tp2 match {
480
- case EtaExpansion (tycon2) if tycon2.symbol.isClass =>
481
- return isSubType(tp1, tycon2)
482
- case _ =>
483
- }
478
+ tp2 match {
479
+ case EtaExpansion (tycon2) if (! tp1.isHK && tycon2.symbol.isClass) || tp1.isDirectRef(tycon2.symbol) =>
480
+ isSubType(tp1, tycon2)
481
+ case _ =>
482
+ fourthTry(tp1, tp2)
484
483
}
485
- fourthTry(tp1, tp2)
486
484
}
487
485
compareTypeLambda
488
486
case OrType (tp21, tp22) =>
Original file line number Diff line number Diff line change
1
+ class Foo [+ X [_]] {
2
+ // OK
3
+ def foo1 [Y [_]](right : Foo [Y ]): Foo [Y ] = right
4
+ // OK
5
+ def foo2 [Y [_]](right : Foo [[T ] => Y [T ]]): Foo [Y ] = right
6
+ // OK
7
+ def foo3 [Y [_]](right : Foo [[T ] => Y [T ]]): Foo [[T ] => Y [T ]] = right
8
+ // Error:
9
+ // found: Foo[Y](right)
10
+ // required: Foo[Y]
11
+ def foo4 [Y [_]](right : Foo [Y ]): Foo [[T ] => Y [T ]] = right
12
+ }
You can’t perform that action at this time.
0 commit comments