Skip to content

Commit

Permalink
Make isSubArg symmetric again
Browse files Browse the repository at this point in the history
  • Loading branch information
odersky committed Jan 20, 2022
1 parent 890066f commit b340d82
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions compiler/src/dotty/tools/dotc/core/TypeComparer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1499,7 +1499,7 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
false
}

def isSubArg(arg1: Type, arg2: Type): Boolean = arg2 match {
def isSubArg(arg1: Type, arg2: Type): Boolean = arg2 match
case arg2: TypeBounds =>
val arg1norm = arg1 match {
case arg1: TypeBounds =>
Expand All @@ -1517,14 +1517,16 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
// embedded `=> T` arguments alone. This clause needs to compensate for that.
isSubArg(arg1.argInfos.head, arg2res)
case _ =>
arg1 match {
arg1 match
case arg1: TypeBounds =>
compareCaptured(arg1, arg2)
case ExprType(arg1res)
if ctx.phaseId > elimByNamePhase.id && !ctx.erasedTypes
&& defn.isByNameFunction(arg2) =>
isSubArg(arg1res, arg2.argInfos.head)
case _ =>
(v > 0 || isSubType(arg2, arg1)) &&
(v < 0 || isSubType(arg1, arg2))
}
}

isSubArg(args1.head, args2.head)
} && recurArgs(args1.tail, args2.tail, tparams2.tail)
Expand Down

0 comments on commit b340d82

Please sign in to comment.