diff options
author | Martin Odersky <odersky@gmail.com> | 2017-03-17 11:29:07 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2017-04-06 13:15:28 +0200 |
commit | c7718516fdad609625215f4fb1c7cffe27db3af5 (patch) | |
tree | 3c2a45791cf23d6572d78e72fb7e8c392fdccc5d | |
parent | 71daa0342120d2414c840a1dda2eae5e676aece2 (diff) | |
download | dotty-c7718516fdad609625215f4fb1c7cffe27db3af5.tar.gz dotty-c7718516fdad609625215f4fb1c7cffe27db3af5.tar.bz2 dotty-c7718516fdad609625215f4fb1c7cffe27db3af5.zip |
Remove parameter from lambda type
-rw-r--r-- | compiler/src/dotty/tools/dotc/core/Types.scala | 19 | ||||
-rw-r--r-- | compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala | 2 |
2 files changed, 12 insertions, 9 deletions
diff --git a/compiler/src/dotty/tools/dotc/core/Types.scala b/compiler/src/dotty/tools/dotc/core/Types.scala index 226399ed3..0642ca8d4 100644 --- a/compiler/src/dotty/tools/dotc/core/Types.scala +++ b/compiler/src/dotty/tools/dotc/core/Types.scala @@ -2324,15 +2324,16 @@ object Types { * Proxy (hk) | HKTermLambda | HKTypeLambda * Ground (*) | MethodType | PolyType */ - trait LambdaType[PInfo <: Type] extends BindingType with MethodOrPoly { self => + trait LambdaType extends BindingType with MethodOrPoly { self => type ThisName <: Name - type This <: LambdaType[PInfo] + type PInfo <: Type + type This <: LambdaType{type PInfo = self.PInfo} def paramNames: List[ThisName] def paramInfos: List[PInfo] def resType: Type def newLikeThis(paramNames: List[ThisName], paramInfos: List[PInfo], resType: Type) - (implicit ctx: Context): LambdaType[PInfo] { type ThisName = self.ThisName } + (implicit ctx: Context): LambdaType { type ThisName = self.ThisName; type PInfo = self.PInfo } def newParamRef(n: Int): ParamRef[This] override def resultType(implicit ctx: Context) = resType @@ -2356,7 +2357,7 @@ object Types { else newLikeThis(paramNames, paramInfos, resType) override def equals(that: Any) = that match { - case that: LambdaType[_] => + case that: LambdaType => this.paramNames == that.paramNames && this.paramInfos == that.paramInfos && this.resType == that.resType @@ -2365,9 +2366,10 @@ object Types { } } - trait LambdaOverTerms extends LambdaType[Type] { thisLambdaType => + trait LambdaOverTerms extends LambdaType { thisLambdaType => import LambdaOverTerms._ type ThisName = TermName + type PInfo = Type type This = LambdaOverTerms def paramNames: List[TermName] @@ -2533,7 +2535,7 @@ object Types { override protected def prefixString = "ImplicitMethodType" } - abstract class LambdaTypeCompanion[N <: Name, PInfo <: Type, LT <: LambdaType[PInfo]] { + abstract class LambdaTypeCompanion[N <: Name, PInfo <: Type, LT <: LambdaType] { def apply(paramNames: List[N])(paramInfosExp: LT => List[PInfo], resultTypeExp: LT => Type)(implicit ctx: Context): LT def syntheticParamNames(n: Int): List[N] def apply(paramNames: List[N], paramInfos: List[PInfo], resultType: Type)(implicit ctx: Context): LT = @@ -2646,9 +2648,10 @@ object Types { */ class PolyType(val paramNames: List[TypeName])( paramInfosExp: PolyType => List[TypeBounds], resultTypeExp: PolyType => Type) - extends CachedProxyType with LambdaType[TypeBounds] { + extends CachedProxyType with LambdaType { type ThisName = TypeName + type PInfo = TypeBounds type This = PolyType /** The bounds of the type parameters */ @@ -2860,7 +2863,7 @@ object Types { def paramName: Name } - abstract case class ParamRef[LT <: LambdaType[_ <: Type]] + abstract case class ParamRef[LT <: LambdaType] (binder: LT, paramNum: Int) extends ParamType { type BT = LT diff --git a/compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala b/compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala index 8232f31db..a4f9921db 100644 --- a/compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala +++ b/compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala @@ -217,7 +217,7 @@ class PlainPrinter(_ctx: Context) extends Printer { protected def simpleNameString(sym: Symbol): String = nameString(sym.name) /** If -uniqid is set, the hashcode of the polytype, after a # */ - protected def lambdaHash(pt: LambdaType[_]): Text = + protected def lambdaHash(pt: LambdaType): Text = if (ctx.settings.uniqid.value) "#" + pt.hashCode else "" /** If -uniqid is set, the unique id of symbol, after a # */ |