From d101f49223ca9b3cf807125fa42af581b729d9ce Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Sun, 19 Mar 2017 23:00:31 +0100 Subject: Polishings --- compiler/src/dotty/tools/dotc/core/ConstraintHandling.scala | 4 ++-- compiler/src/dotty/tools/dotc/core/Symbols.scala | 4 ++-- compiler/src/dotty/tools/dotc/core/Types.scala | 11 ++++++----- compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala | 7 ------- 4 files changed, 10 insertions(+), 16 deletions(-) (limited to 'compiler/src/dotty/tools/dotc/core') diff --git a/compiler/src/dotty/tools/dotc/core/ConstraintHandling.scala b/compiler/src/dotty/tools/dotc/core/ConstraintHandling.scala index 64621ec94..de96f644a 100644 --- a/compiler/src/dotty/tools/dotc/core/ConstraintHandling.scala +++ b/compiler/src/dotty/tools/dotc/core/ConstraintHandling.scala @@ -360,9 +360,9 @@ trait ConstraintHandling { if (comparedTypeLambdas.nonEmpty) { val approx = new ApproximatingTypeMap { def apply(t: Type): Type = t match { - case t @ TypeParamRef(pt: TypeLambda, n) if comparedTypeLambdas contains pt => + case t @ TypeParamRef(tl: TypeLambda, n) if comparedTypeLambdas contains tl => val effectiveVariance = if (fromBelow) -variance else variance - val bounds = pt.paramInfos(n) + val bounds = tl.paramInfos(n) if (effectiveVariance > 0) bounds.lo else if (effectiveVariance < 0) bounds.hi else NoType diff --git a/compiler/src/dotty/tools/dotc/core/Symbols.scala b/compiler/src/dotty/tools/dotc/core/Symbols.scala index a3c8e54b2..95ff1cb75 100644 --- a/compiler/src/dotty/tools/dotc/core/Symbols.scala +++ b/compiler/src/dotty/tools/dotc/core/Symbols.scala @@ -516,8 +516,8 @@ object Symbols { // ParamInfo types and methods def isTypeParam(implicit ctx: Context) = denot.is(TypeParam) def paramName(implicit ctx: Context) = name.asInstanceOf[ThisName] - def paramInfo(implicit ctx: Context) = denot.info.bounds - def paramInfoAsSeenFrom(pre: Type)(implicit ctx: Context) = pre.memberInfo(this).bounds + def paramInfo(implicit ctx: Context) = denot.info + def paramInfoAsSeenFrom(pre: Type)(implicit ctx: Context) = pre.memberInfo(this) def paramInfoOrCompleter(implicit ctx: Context): Type = denot.infoOrCompleter def paramVariance(implicit ctx: Context) = denot.variance def paramRef(implicit ctx: Context) = denot.typeRef diff --git a/compiler/src/dotty/tools/dotc/core/Types.scala b/compiler/src/dotty/tools/dotc/core/Types.scala index 0a3191b84..0a23157c8 100644 --- a/compiler/src/dotty/tools/dotc/core/Types.scala +++ b/compiler/src/dotty/tools/dotc/core/Types.scala @@ -65,12 +65,13 @@ object Types { * | +- ExprType * | +- AnnotatedType * | +- TypeVar - * | +- HKLambda --------- PolyType + * | +- HKTypeLambda * | * +- GroundType -+- AndType * +- OrType - * +- MethodOrPoly ----- MethodType ---+- ImplicitMethodType - * | +- JavaMethodType + * +- MethodOrPoly ---+-- PolyType + * +-- MethodType ---+- ImplicitMethodType + * | +- JavaMethodType * +- ClassInfo * | * +- NoType @@ -2359,8 +2360,8 @@ object Types { def isDependent(implicit ctx: Context): Boolean def isParamDependent(implicit ctx: Context): Boolean - final def isTermLambda = paramNames.head.isTermName - final def isTypeLambda = paramNames.head.isTypeName + final def isTermLambda = isInstanceOf[TermLambda] + final def isTypeLambda = isInstanceOf[TypeLambda] final def isHigherKinded = isInstanceOf[TypeProxy] lazy val paramRefs: List[ParamRef] = paramNames.indices.toList.map(newParamRef) diff --git a/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala b/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala index b83045a11..4db995e10 100644 --- a/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala +++ b/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala @@ -227,13 +227,6 @@ class TreeUnpickler(reader: TastyReader, tastyName: TastyName.Table, posUnpickle def readLengthType(): Type = { val end = readEnd() - def readNamesSkipParams: (List[Name], TreeReader) = { - val nameReader = fork - nameReader.skipTree() // skip result - val paramReader = nameReader.fork - (nameReader.readParamNames(end), paramReader) - } - def readMethodic[N <: Name, PInfo <: Type, LT <: LambdaType] (companion: LambdaTypeCompanion[N, PInfo, LT], nameMap: Name => N): LT = { val nameReader = fork -- cgit v1.2.3