Skip to content

Commit ff2f0c7

Browse files
committed
Drop mixed MethodType apply method
The dropped method takes direct parameter types but a result type expression. Since parameter types are now in general dependent as well, that method is mostly redundant.
1 parent 0f4f5f9 commit ff2f0c7

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ trait Symbols { this: Context =>
252252

253253
/** Create a class constructor symbol for given class `cls`. */
254254
def newConstructor(cls: ClassSymbol, flags: FlagSet, paramNames: List[TermName], paramTypes: List[Type], privateWithin: Symbol = NoSymbol, coord: Coord = NoCoord) =
255-
newSymbol(cls, nme.CONSTRUCTOR, flags | Method, MethodType(paramNames, paramTypes)(_ => cls.typeRef), privateWithin, coord)
255+
newSymbol(cls, nme.CONSTRUCTOR, flags | Method, MethodType(paramNames, paramTypes, cls.typeRef), privateWithin, coord)
256256

257257
/** Create an empty default constructor symbol for given class `cls`. */
258258
def newDefaultConstructor(cls: ClassSymbol) =

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2470,12 +2470,10 @@ object Types {
24702470

24712471
abstract class MethodTypeCompanion {
24722472
def apply(paramNames: List[TermName])(paramTypesExp: MethodType => List[Type], resultTypeExp: MethodType => Type)(implicit ctx: Context): MethodType
2473-
def apply(paramNames: List[TermName], paramTypes: List[Type])(resultTypeExp: MethodType => Type)(implicit ctx: Context): MethodType =
2474-
apply(paramNames)(_ => paramTypes, resultTypeExp)
24752473
def apply(paramNames: List[TermName], paramTypes: List[Type], resultType: Type)(implicit ctx: Context): MethodType =
2476-
apply(paramNames, paramTypes)(_ => resultType)
2474+
apply(paramNames)(_ => paramTypes, _ => resultType)
24772475
def apply(paramTypes: List[Type])(resultTypeExp: MethodType => Type)(implicit ctx: Context): MethodType =
2478-
apply(nme.syntheticParamNames(paramTypes.length), paramTypes)(resultTypeExp)
2476+
apply(nme.syntheticParamNames(paramTypes.length))(_ => paramTypes, resultTypeExp)
24792477
def apply(paramTypes: List[Type], resultType: Type)(implicit ctx: Context): MethodType =
24802478
apply(nme.syntheticParamNames(paramTypes.length), paramTypes, resultType)
24812479

compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ class ClassfileParser(
339339
}
340340
index += 1
341341
val restype = sig2type(tparams, skiptvs)
342-
JavaMethodType(paramnames.toList, paramtypes.toList)(_ => restype)
342+
JavaMethodType(paramnames.toList, paramtypes.toList, restype)
343343
case 'T' =>
344344
val n = subName(';'.==).toTypeName
345345
index += 1

compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,8 @@ class TreeUnpickler(reader: TastyReader, tastyName: TastyName.Table, posUnpickle
278278
result
279279
case METHODtype =>
280280
val (names, paramReader) = readNamesSkipParams
281-
val result = MethodType(names.map(_.toTermName), paramReader.readParamTypes[Type](end))(
281+
val result = MethodType(names.map(_.toTermName))(
282+
mt => paramReader.readParamTypes[Type](end), // !!!
282283
mt => registeringType(mt, readType()))
283284
goto(end)
284285
result

compiler/src/dotty/tools/dotc/transform/FullParameterization.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,9 @@ trait FullParameterization {
105105
def resultType(mapClassParams: Type => Type) = {
106106
val thisParamType = mapClassParams(clazz.classInfo.selfType)
107107
val firstArgType = if (liftThisType) thisParamType & clazz.thisType else thisParamType
108-
MethodType(nme.SELF :: Nil, firstArgType :: Nil)(mt =>
109-
mapClassParams(origResult).substThisUnlessStatic(clazz, MethodParam(mt, 0)))
108+
MethodType(nme.SELF :: Nil)(
109+
mt => firstArgType :: Nil,
110+
mt => mapClassParams(origResult).substThisUnlessStatic(clazz, MethodParam(mt, 0)))
110111
}
111112

112113
/** Replace class type parameters by the added type parameters of the polytype `pt` */

0 commit comments

Comments
 (0)