Skip to content

Commit

Permalink
Merge pull request #12846 from dotty-staging/fix-i11499
Browse files Browse the repository at this point in the history
When checking tp1 <:< tycon2[args2], widen tp1 to reveal application
  • Loading branch information
abgruszecki authored Jun 17, 2021
2 parents 71f317c + fb7a058 commit 227d55c
Show file tree
Hide file tree
Showing 2 changed files with 12 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 @@ -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
Expand Down
11 changes: 11 additions & 0 deletions tests/pos/i11499.scala
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit 227d55c

Please sign in to comment.