aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2017-03-19 23:00:31 +0100
committerMartin Odersky <odersky@gmail.com>2017-04-06 13:15:29 +0200
commitd101f49223ca9b3cf807125fa42af581b729d9ce (patch)
tree3ad9ea25b1515809c0e59c4540e1e30aa7a4a084
parent2e04574c4791428ed43f2fb98884361b2cd4e659 (diff)
downloaddotty-d101f49223ca9b3cf807125fa42af581b729d9ce.tar.gz
dotty-d101f49223ca9b3cf807125fa42af581b729d9ce.tar.bz2
dotty-d101f49223ca9b3cf807125fa42af581b729d9ce.zip
Polishings
-rw-r--r--compiler/src/dotty/tools/dotc/ast/Desugar.scala2
-rw-r--r--compiler/src/dotty/tools/dotc/core/ConstraintHandling.scala4
-rw-r--r--compiler/src/dotty/tools/dotc/core/Symbols.scala4
-rw-r--r--compiler/src/dotty/tools/dotc/core/Types.scala11
-rw-r--r--compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala7
-rw-r--r--compiler/src/dotty/tools/dotc/printing/Formatting.scala2
-rw-r--r--compiler/src/dotty/tools/dotc/typer/Typer.scala2
7 files changed, 13 insertions, 19 deletions
diff --git a/compiler/src/dotty/tools/dotc/ast/Desugar.scala b/compiler/src/dotty/tools/dotc/ast/Desugar.scala
index 6abcf6fff..66fc6bf84 100644
--- a/compiler/src/dotty/tools/dotc/ast/Desugar.scala
+++ b/compiler/src/dotty/tools/dotc/ast/Desugar.scala
@@ -245,7 +245,7 @@ object desugar {
if (tdef.mods is PrivateLocalParam) {
val tparam = cpy.TypeDef(tdef)(name = tdef.name.expandedName(ctx.owner))
.withMods(tdef.mods &~ PrivateLocal | ExpandedName)
- val alias = cpy.TypeDef(tdef)(name = tdef.name, rhs = refOfDef(tparam))
+ val alias = cpy.TypeDef(tdef)(rhs = refOfDef(tparam))
.withMods(tdef.mods & VarianceFlags | PrivateLocalParamAccessor | Synthetic)
Thicket(tparam, alias)
}
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
diff --git a/compiler/src/dotty/tools/dotc/printing/Formatting.scala b/compiler/src/dotty/tools/dotc/printing/Formatting.scala
index 4a57270a4..e8fa45403 100644
--- a/compiler/src/dotty/tools/dotc/printing/Formatting.scala
+++ b/compiler/src/dotty/tools/dotc/printing/Formatting.scala
@@ -31,7 +31,7 @@ object Formatting {
case arg: Showable =>
try arg.show
catch {
- case NonFatal(ex) if false => s"[cannot display due to $ex, raw string = $toString]"
+ case NonFatal(ex) => s"[cannot display due to $ex, raw string = $toString]"
}
case _ => arg.toString
}
diff --git a/compiler/src/dotty/tools/dotc/typer/Typer.scala b/compiler/src/dotty/tools/dotc/typer/Typer.scala
index 723e7007f..2760ceba9 100644
--- a/compiler/src/dotty/tools/dotc/typer/Typer.scala
+++ b/compiler/src/dotty/tools/dotc/typer/Typer.scala
@@ -1055,7 +1055,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
typr.println(s"adding refinement $refinement")
checkRefinementNonCyclic(refinement, refineCls, seen)
val rsym = refinement.symbol
- if (rsym.info.isInstanceOf[TypeLambda] && rsym.allOverriddenSymbols.isEmpty)
+ if (rsym.info.isInstanceOf[PolyType] && rsym.allOverriddenSymbols.isEmpty)
ctx.error(i"polymorphic refinement $rsym without matching type in parent $tpt1 is no longer allowed", refinement.pos) }
assignType(cpy.RefinedTypeTree(tree)(tpt1, refinements1), tpt1, refinements1, refineCls)
}