Skip to content

Commit ba564fa

Browse files
committed
dealias type when type inference occurs
1 parent 6896fe3 commit ba564fa

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1207,9 +1207,12 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
12071207
if fromBelow then isSubType(tp2, tp1) else isSubType(tp1, tp2)
12081208
def directionalRecur(tp1: Type, tp2: Type): Boolean =
12091209
if fromBelow then recur(tp2, tp1) else recur(tp1, tp2)
1210-
1211-
val otherTycon = other.tycon
1212-
val otherArgs = other.args
1210+
val otherDealias = other.dealias match
1211+
case appliedType: AppliedType if appliedType.args.hasSameLengthAs(args) && !other.args.hasSameLengthAs(args) =>
1212+
appliedType
1213+
case _ => other
1214+
val otherTycon = otherDealias.tycon
1215+
val otherArgs = otherDealias.args
12131216

12141217
val d = otherArgs.length - args.length
12151218
d >= 0 && {
@@ -1234,7 +1237,7 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
12341237
otherTycon
12351238
rollbackConstraintsUnless:
12361239
(assumedTrue(tycon) || directionalIsSubType(tycon, adaptedTycon))
1237-
&& directionalRecur(adaptedTycon.appliedTo(args), other)
1240+
&& directionalRecur(adaptedTycon.appliedTo(args), otherDealias)
12381241
}
12391242
}
12401243
end compareAppliedTypeParamRef

0 commit comments

Comments
 (0)