Skip to content

Commit 8b635cc

Browse files
authored
Improve subtyping check for not yet eta-expanded higher kinded types (#17139)
Fixes #16183
2 parents 3e85eb7 + 03a8f64 commit 8b635cc

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
591591
val base = nonExprBaseType(tp1, cls2)
592592
if (base.typeSymbol == cls2) return true
593593
}
594-
else if tp1.isLambdaSub && !tp1.isAnyKind then
594+
else if tp1.typeParams.nonEmpty && !tp1.isAnyKind then
595595
return recur(tp1, EtaExpansion(tp2))
596596
fourthTry
597597
}

tests/pos/i16183/Lib_1.scala

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package pkg
2+
3+
trait Foo1[A]
4+
trait Foo2[A] extends Foo1[A]
5+
6+
trait Bar[F[_]]
7+
object Bar {
8+
implicit val bar: Bar[pkg.Foo2] = ???
9+
}
10+
11+
trait Qux
12+
object Qux {
13+
implicit def qux[F[_]](implicit bar: Bar[F]): F[Qux] = ???
14+
}

tests/pos/i16183/Test_2.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import pkg._
2+
3+
object Test {
4+
implicitly[Foo2[Qux]]
5+
implicitly[Foo1[Qux]]
6+
}

0 commit comments

Comments
 (0)