Skip to content

Commit

Permalink
Optimize FunctionTypeOfMethod RefinedType guard
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasstucki committed Aug 30, 2023
1 parent fa0c231 commit cb34be5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/core/Definitions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1115,7 +1115,7 @@ class Definitions {
def unapply(ft: Type)(using Context): Option[MethodOrPoly] = {
ft match
case RefinedType(parent, nme.apply, mt: MethodOrPoly)
if parent.derivesFrom(defn.PolyFunctionClass) || isFunctionNType(parent) =>
if parent.derivesFrom(defn.PolyFunctionClass) || (mt.isInstanceOf[MethodType] && isFunctionNType(parent)) =>
Some(mt)
case AppliedType(parent, targs) if targs.nonEmpty && isFunctionNType(ft) =>
val isContextual = ft.typeSymbol.name.isContextFunction
Expand Down

0 comments on commit cb34be5

Please sign in to comment.