File tree 2 files changed +6
-12
lines changed
compiler/src/dotty/tools/dotc
2 files changed +6
-12
lines changed Original file line number Diff line number Diff line change @@ -1116,16 +1116,13 @@ class Definitions {
1116
1116
else
1117
1117
FunctionType (args.length, isContextual).appliedTo(args ::: resultType :: Nil )
1118
1118
def unapply (ft : Type )(using Context ): Option [(List [Type ], Type , Boolean )] = {
1119
- ft.dealias match
1119
+ ft match
1120
1120
case PolyFunctionOf (mt : MethodType ) =>
1121
1121
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
1129
1126
}
1130
1127
}
1131
1128
Original file line number Diff line number Diff line change @@ -1990,10 +1990,7 @@ trait Applications extends Compatibility {
1990
1990
// the arity of that function, otherise -1.
1991
1991
def paramCount (ref : TermRef ) =
1992
1992
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))
1997
1994
else - 1
1998
1995
1999
1996
val numArgs = args.length
You can’t perform that action at this time.
0 commit comments