Skip to content

Commit 03a8f64

Browse files
committed
Improve subtyping check for not yet eta-expanded higher kinded types
1 parent ed57e32 commit 03a8f64

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
@@ -580,7 +580,7 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
580580
val base = nonExprBaseType(tp1, cls2)
581581
if (base.typeSymbol == cls2) return true
582582
}
583-
else if tp1.isLambdaSub && !tp1.isAnyKind then
583+
else if tp1.typeParams.nonEmpty && !tp1.isAnyKind then
584584
return recur(tp1, EtaExpansion(tp2))
585585
fourthTry
586586
}

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)