From 700e7ac6658a1d699502c94141091012d18519c4 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Fri, 17 Mar 2017 14:58:27 +0100 Subject: replace derived{Method,Poly}Type with derivedLambdaType --- compiler/src/dotty/tools/dotc/core/Types.scala | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) (limited to 'compiler/src/dotty/tools/dotc/core/Types.scala') diff --git a/compiler/src/dotty/tools/dotc/core/Types.scala b/compiler/src/dotty/tools/dotc/core/Types.scala index 49fc825ca..074d2e1fb 100644 --- a/compiler/src/dotty/tools/dotc/core/Types.scala +++ b/compiler/src/dotty/tools/dotc/core/Types.scala @@ -2524,11 +2524,6 @@ object Types { override def computeSignature(implicit ctx: Context): Signature = resultSignature.prepend(paramInfos, isJava) - def derivedMethodType(paramNames: List[TermName] = this.paramNames, - paramInfos: List[Type] = this.paramInfos, - resType: Type = this.resType)(implicit ctx: Context) = - derivedLambdaType(paramNames, paramInfos, resType) - protected def prefixString = "MethodType" } @@ -2697,11 +2692,6 @@ object Types { override def underlying(implicit ctx: Context) = resType - def derivedPolyType(paramNames: List[TypeName] = this.paramNames, - paramInfos: List[TypeBounds] = this.paramInfos, - resType: Type = this.resType)(implicit ctx: Context) = - derivedLambdaType(paramNames, paramInfos, resType) - /** Merge nested polytypes into one polytype. nested polytypes are normally not supported * but can arise as temporary data structures. */ @@ -3467,12 +3457,11 @@ object Types { tp.derivedClassInfo(pre) protected def derivedJavaArrayType(tp: JavaArrayType, elemtp: Type): Type = tp.derivedJavaArrayType(elemtp) - protected def derivedMethodType(tp: MethodType, formals: List[Type], restpe: Type): Type = - tp.derivedMethodType(tp.paramNames, formals, restpe) protected def derivedExprType(tp: ExprType, restpe: Type): Type = tp.derivedExprType(restpe) - protected def derivedPolyType(tp: PolyType, pbounds: List[TypeBounds], restpe: Type): Type = - tp.derivedPolyType(tp.paramNames, pbounds, restpe) + // note: currying needed because Scala2 does not support param-dependencies + protected def derivedLambdaType(tp: LambdaType)(formals: List[tp.PInfo], restpe: Type): Type = + tp.derivedLambdaType(tp.paramNames, formals, restpe) /** Map this function over given type */ def mapOver(tp: Type): Type = { @@ -3507,7 +3496,7 @@ object Types { variance = -variance val ptypes1 = tp.paramInfos mapConserve this variance = -variance - derivedMethodType(tp, ptypes1, this(tp.resultType)) + derivedLambdaType(tp)(ptypes1, this(tp.resultType)) } mapOverMethod @@ -3519,7 +3508,7 @@ object Types { variance = -variance val bounds1 = tp.paramInfos.mapConserve(this).asInstanceOf[List[TypeBounds]] variance = -variance - derivedPolyType(tp, bounds1, this(tp.resultType)) + derivedLambdaType(tp)(bounds1, this(tp.resultType)) } mapOverPoly -- cgit v1.2.3