Skip to content

Commit b340d82

Browse files
committed
Make isSubArg symmetric again
1 parent 890066f commit b340d82

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

compiler/src/dotty/tools/dotc/core/TypeComparer.scala

+6-4
Original file line numberDiff line numberDiff line change
@@ -1499,7 +1499,7 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
14991499
false
15001500
}
15011501

1502-
def isSubArg(arg1: Type, arg2: Type): Boolean = arg2 match {
1502+
def isSubArg(arg1: Type, arg2: Type): Boolean = arg2 match
15031503
case arg2: TypeBounds =>
15041504
val arg1norm = arg1 match {
15051505
case arg1: TypeBounds =>
@@ -1517,14 +1517,16 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
15171517
// embedded `=> T` arguments alone. This clause needs to compensate for that.
15181518
isSubArg(arg1.argInfos.head, arg2res)
15191519
case _ =>
1520-
arg1 match {
1520+
arg1 match
15211521
case arg1: TypeBounds =>
15221522
compareCaptured(arg1, arg2)
1523+
case ExprType(arg1res)
1524+
if ctx.phaseId > elimByNamePhase.id && !ctx.erasedTypes
1525+
&& defn.isByNameFunction(arg2) =>
1526+
isSubArg(arg1res, arg2.argInfos.head)
15231527
case _ =>
15241528
(v > 0 || isSubType(arg2, arg1)) &&
15251529
(v < 0 || isSubType(arg1, arg2))
1526-
}
1527-
}
15281530

15291531
isSubArg(args1.head, args2.head)
15301532
} && recurArgs(args1.tail, args2.tail, tparams2.tail)

0 commit comments

Comments
 (0)