Skip to content

Commit

Permalink
Improve subtyping check for not yet eta-expanded higher kinded types (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
odersky authored Apr 22, 2023
2 parents 3e85eb7 + 03a8f64 commit 8b635cc
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/core/TypeComparer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
val base = nonExprBaseType(tp1, cls2)
if (base.typeSymbol == cls2) return true
}
else if tp1.isLambdaSub && !tp1.isAnyKind then
else if tp1.typeParams.nonEmpty && !tp1.isAnyKind then
return recur(tp1, EtaExpansion(tp2))
fourthTry
}
Expand Down
14 changes: 14 additions & 0 deletions tests/pos/i16183/Lib_1.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package pkg

trait Foo1[A]
trait Foo2[A] extends Foo1[A]

trait Bar[F[_]]
object Bar {
implicit val bar: Bar[pkg.Foo2] = ???
}

trait Qux
object Qux {
implicit def qux[F[_]](implicit bar: Bar[F]): F[Qux] = ???
}
6 changes: 6 additions & 0 deletions tests/pos/i16183/Test_2.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import pkg._

object Test {
implicitly[Foo2[Qux]]
implicitly[Foo1[Qux]]
}

0 comments on commit 8b635cc

Please sign in to comment.