Skip to content

Commit 934b988

Browse files
nicolasstuckiKordyjan
authored andcommitted
Remove use of isFunctionNType
[Cherry-picked 8a202e5]
1 parent 449c649 commit 934b988

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
@@ -658,16 +658,18 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
658658
case _ =>
659659
isSubType(info1, info2)
660660

661-
if defn.isFunctionNType(tp2) then
662-
tp1w.widenDealias match
663-
case tp1: RefinedType =>
664-
return isSubInfo(tp1.refinedInfo, tp2.refinedInfo)
665-
case _ =>
666-
else if tp2.parent.typeSymbol == defn.PolyFunctionClass then
667-
tp1.member(nme.apply).info match
668-
case info1: PolyType =>
669-
return isSubInfo(info1, tp2.refinedInfo)
670-
case _ =>
661+
if defn.isFunctionType(tp2) then
662+
if defn.isPolyFunctionType(tp2) then
663+
// TODO should we handle ErasedFunction is this same way?
664+
tp1.member(nme.apply).info match
665+
case info1: PolyType =>
666+
return isSubInfo(info1, tp2.refinedInfo)
667+
case _ =>
668+
else
669+
tp1w.widenDealias match
670+
case tp1: RefinedType =>
671+
return isSubInfo(tp1.refinedInfo, tp2.refinedInfo)
672+
case _ =>
671673

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

0 commit comments

Comments
 (0)