Skip to content

Commit cb34be5

Browse files
committed
Optimize FunctionTypeOfMethod RefinedType guard
1 parent fa0c231 commit cb34be5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1115,7 +1115,7 @@ class Definitions {
11151115
def unapply(ft: Type)(using Context): Option[MethodOrPoly] = {
11161116
ft match
11171117
case RefinedType(parent, nme.apply, mt: MethodOrPoly)
1118-
if parent.derivesFrom(defn.PolyFunctionClass) || isFunctionNType(parent) =>
1118+
if parent.derivesFrom(defn.PolyFunctionClass) || (mt.isInstanceOf[MethodType] && isFunctionNType(parent)) =>
11191119
Some(mt)
11201120
case AppliedType(parent, targs) if targs.nonEmpty && isFunctionNType(ft) =>
11211121
val isContextual = ft.typeSymbol.name.isContextFunction

0 commit comments

Comments
 (0)