Skip to content

Commit 8a202e5

Browse files
committed
Remove use of isFunctionNType
1 parent a420d71 commit 8a202e5

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

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

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -665,16 +665,18 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
665665
case _ =>
666666
isSubType(info1, info2)
667667

668-
if defn.isFunctionNType(tp2) then
669-
tp1w.widenDealias match
670-
case tp1: RefinedType =>
671-
return isSubInfo(tp1.refinedInfo, tp2.refinedInfo)
672-
case _ =>
673-
else if tp2.parent.typeSymbol == defn.PolyFunctionClass then
674-
tp1.member(nme.apply).info match
675-
case info1: PolyType =>
676-
return isSubInfo(info1, tp2.refinedInfo)
677-
case _ =>
668+
if defn.isFunctionType(tp2) then
669+
if defn.isPolyFunctionType(tp2) then
670+
// TODO should we handle ErasedFunction is this same way?
671+
tp1.member(nme.apply).info match
672+
case info1: PolyType =>
673+
return isSubInfo(info1, tp2.refinedInfo)
674+
case _ =>
675+
else
676+
tp1w.widenDealias match
677+
case tp1: RefinedType =>
678+
return isSubInfo(tp1.refinedInfo, tp2.refinedInfo)
679+
case _ =>
678680

679681
val skipped2 = skipMatching(tp1w, tp2)
680682
if (skipped2 eq tp2) || !Config.fastPathForRefinedSubtype then

0 commit comments

Comments
 (0)