diff options
Diffstat (limited to 'src/dotty/tools/dotc/core')
-rw-r--r-- | src/dotty/tools/dotc/core/Types.scala | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index 529452c73..6145bdffb 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -906,10 +906,14 @@ object Types { /** Turn type into a function type. * @pre this is a non-dependent method type. + * @param drop The number of trailing parameters that should be dropped + * when forming the function type. */ - def toFunctionType(implicit ctx: Context): Type = this match { + def toFunctionType(dropLast: Int = 0)(implicit ctx: Context): Type = this match { case mt @ MethodType(_, formals) if !mt.isDependent => - defn.FunctionType(formals mapConserve (_.underlyingIfRepeated(mt.isJava)), mt.resultType) + val formals1 = if (dropLast == 0) formals else formals dropRight dropLast + defn.FunctionType( + formals1 mapConserve (_.underlyingIfRepeated(mt.isJava)), mt.resultType) } /** The signature of this type. This is by default NotAMethod, |