diff --git a/compiler/src/dotty/tools/dotc/core/TypeComparer.scala b/compiler/src/dotty/tools/dotc/core/TypeComparer.scala index f183e0467571..5a95b422b284 100644 --- a/compiler/src/dotty/tools/dotc/core/TypeComparer.scala +++ b/compiler/src/dotty/tools/dotc/core/TypeComparer.scala @@ -1003,7 +1003,7 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling /** True if `tp1` and `tp2` have compatible type constructors and their * corresponding arguments are subtypes relative to their variance (see `isSubArgs`). */ - def isMatchingApply(tp1: Type): Boolean = tp1 match { + def isMatchingApply(tp1: Type): Boolean = tp1.widen match { case tp1 @ AppliedType(tycon1, args1) => // We intentionally do not automatically dealias `tycon1` or `tycon2` here. // `TypeApplications#appliedTo` already takes care of dealiasing type diff --git a/tests/pos/i11499.scala b/tests/pos/i11499.scala new file mode 100644 index 000000000000..2d64750c3b22 --- /dev/null +++ b/tests/pos/i11499.scala @@ -0,0 +1,11 @@ +trait Functor[F[_]] + +object data { + + type OptionT[F[_], A] = F[Option[A]] + + def fold[F[_], A, B](value: OptionT[F, A])(f: Functor[F]): F[B] = ??? + + def cata[F[_], A, B](value: OptionT[F, A])(f: Functor[F]): F[B] = + fold(value)(f) // error +}