File tree Expand file tree Collapse file tree 2 files changed +6
-12
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 2 files changed +6
-12
lines changed Original file line number Diff line number Diff line change @@ -1116,16 +1116,13 @@ class Definitions {
11161116 else
11171117 FunctionType (args.length, isContextual).appliedTo(args ::: resultType :: Nil )
11181118 def unapply (ft : Type )(using Context ): Option [(List [Type ], Type , Boolean )] = {
1119- ft.dealias match
1119+ ft match
11201120 case PolyFunctionOf (mt : MethodType ) =>
11211121 Some (mt.paramInfos, mt.resType, mt.isContextualMethod)
1122- case dft =>
1123- val tsym = dft.typeSymbol
1124- if isFunctionSymbol(tsym) && ft.isRef(tsym) then
1125- val targs = dft.argInfos
1126- if (targs.isEmpty) None
1127- else Some (targs.init, targs.last, tsym.name.isContextFunction)
1128- else None
1122+ case AppliedType (parent, targs) if targs.nonEmpty && isFunctionNType(ft) =>
1123+ Some (targs.init, targs.last, ft.typeSymbol.name.isContextFunction)
1124+ case _ =>
1125+ None
11291126 }
11301127 }
11311128
Original file line number Diff line number Diff line change @@ -1990,10 +1990,7 @@ trait Applications extends Compatibility {
19901990 // the arity of that function, otherise -1.
19911991 def paramCount (ref : TermRef ) =
19921992 val formals = ref.widen.firstParamTypes
1993- if formals.length > idx then
1994- formals(idx) match
1995- case defn.FunctionOf (args, _, _) => args.length
1996- case _ => - 1
1993+ if formals.length > idx then defn.functionArity(formals(idx))
19971994 else - 1
19981995
19991996 val numArgs = args.length
You can’t perform that action at this time.
0 commit comments