Skip to content

Commit f9e12fe

Browse files
committed
Remove dropLast from toFunctionType
If needed, use `derivedLambdaType` to drop the last parameters before converting to a function type.
1 parent eb8fba4 commit f9e12fe

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1874,22 +1874,19 @@ object Types {
18741874
/** Turn type into a function type.
18751875
* @pre this is a method type without parameter dependencies.
18761876
* @param isJava translate repeated params as as java `Array`s?
1877-
* @param dropLast the number of trailing parameters that should be dropped
1878-
* when forming the function type.
18791877
* @param alwaysDependent if true, always create a dependent function type.
18801878
*/
1881-
def toFunctionType(isJava: Boolean = false, dropLast: Int = 0, alwaysDependent: Boolean = false)(using Context): Type = this match {
1879+
def toFunctionType(isJava: Boolean = false, alwaysDependent: Boolean = false)(using Context): Type = this match {
18821880
case mt: MethodType =>
18831881
assert(!mt.isParamDependent)
18841882
def nonDependentFunType =
1885-
val formals1 = if (dropLast == 0) mt.paramInfos else mt.paramInfos dropRight dropLast
18861883
val isContextual = mt.isContextualMethod && !ctx.erasedTypes
18871884
val result1 = mt.nonDependentResultApprox match {
18881885
case res: MethodType => res.toFunctionType(isJava)
18891886
case res => res
18901887
}
18911888
defn.FunctionOf(
1892-
formals1 mapConserve (_.translateFromRepeated(toArray = isJava)),
1889+
mt.paramInfos.mapConserve(_.translateFromRepeated(toArray = isJava)),
18931890
result1, isContextual)
18941891
if mt.hasErasedParams then
18951892
defn.PolyFunctionOf(mt)

0 commit comments

Comments
 (0)