Skip to content

Commit 1aa8181

Browse files
committed
More cleanups and removals of now redundant code
1 parent 23932c0 commit 1aa8181

File tree

9 files changed

+21
-58
lines changed

9 files changed

+21
-58
lines changed

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

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1402,17 +1402,10 @@ object SymDenotations {
14021402
}
14031403

14041404
private def computeThisType(implicit ctx: Context): Type =
1405-
ThisType.raw(
1406-
TypeRef(if (this is Package) NoPrefix else owner.thisType, symbol.asType))
1407-
/* else {
1408-
val pre = owner.thisType
1409-
if (this is Module)
1410-
if (isMissing(pre)) TermRef(pre, sourceModule.asTerm)
1411-
else TermRef.withSig(pre, name.sourceModuleName, Signature.NotAMethod)
1412-
else ThisType.raw(TypeRef(pre, symbol.asType))
1413-
}
1414-
*/
1415-
private[this] var myTypeRef: TypeRef = null
1405+
ThisType.raw(TypeRef(
1406+
if (this is Package) NoPrefix else owner.thisType, symbol.asType))
1407+
1408+
private[this] var myTypeRef: TypeRef = null
14161409

14171410
override def typeRef(implicit ctx: Context): TypeRef = {
14181411
if (myTypeRef == null) myTypeRef = super.typeRef

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -532,8 +532,6 @@ class TypeErasure(isJava: Boolean, semiEraseVCs: Boolean, isConstructor: Boolean
532532
else tp.superType)
533533
case ErasedValueType(_, underlying) =>
534534
sigName(underlying)
535-
case defn.ArrayOf(elem) => // @!!!
536-
sigName(this(tp))
537535
case JavaArrayType(elem) =>
538536
sigName(elem) ++ "[]"
539537
case tp: TermRef =>

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

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -832,10 +832,6 @@ object Types {
832832
}
833833
}
834834

835-
/** Temporary replacement for baseTypeRef */
836-
final def baseTypeTycon(base: Symbol)(implicit ctx: Context): Type = // @!!! drop
837-
baseType(base).typeConstructor
838-
839835
def & (that: Type)(implicit ctx: Context): Type = track("&") {
840836
ctx.typeComparer.glb(this, that)
841837
}
@@ -3488,24 +3484,10 @@ object Types {
34883484
class CachedClassInfo(prefix: Type, cls: ClassSymbol, classParents: List[Type], decls: Scope, selfInfo: DotClass)
34893485
extends ClassInfo(prefix, cls, classParents, decls, selfInfo)
34903486

3491-
/** A class for temporary class infos where `parents` are not yet known. */
3487+
/** A class for temporary class infos where `parents` are not yet known. // @!!! eliminate? */
34923488
final class TempClassInfo(prefix: Type, cls: ClassSymbol, decls: Scope, selfInfo: DotClass)
34933489
extends CachedClassInfo(prefix, cls, Nil, decls, selfInfo) {
34943490

3495-
/** A list of actions that were because they rely on the class info of `cls` to
3496-
* be no longer temporary. These actions will be performed once `cls` gets a real
3497-
* ClassInfo.
3498-
*/
3499-
private var suspensions: List[Context => Unit] = Nil
3500-
3501-
def addSuspension(suspension: Context => Unit): Unit = suspensions ::= suspension
3502-
3503-
/** Install classinfo with known parents in `denot` and resume all suspensions */ // @!!! elim
3504-
def finalize(denot: SymDenotation, parents: List[Type])(implicit ctx: Context) = {
3505-
denot.info = derivedClassInfo(classParents = parents)
3506-
suspensions.foreach(_(ctx))
3507-
}
3508-
35093491
override def derivedClassInfo(prefix: Type)(implicit ctx: Context) =
35103492
if (prefix eq this.prefix) this
35113493
else new TempClassInfo(prefix, cls, decls, selfInfo)

compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ object Scala2Unpickler {
125125
registerCompanionPair(scalacCompanion, denot.classSymbol)
126126
}
127127

128-
tempInfo.finalize(denot, normalizedParents) // install final info, except possibly for typeparams ordering
129128
denot.ensureTypeParamsInCorrectOrder()
130129
}
131130
}

compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,10 @@ class PlainPrinter(_ctx: Context) extends Printer {
128128
}
129129

130130
/** The longest sequence of refinement types, starting at given type
131-
* and following parents, but stopping at applied types.
131+
* and following parents.
132132
*/
133133
private def refinementChain(tp: Type): List[Type] =
134134
tp :: (tp match {
135-
case AppliedType(_, _) => Nil // @!!!
136135
case tp: RefinedType => refinementChain(tp.parent.stripTypeVar)
137136
case _ => Nil
138137
})

compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,8 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
6262
override def nameString(name: Name): String =
6363
if (ctx.settings.debugNames.value) name.debugString else name.toString
6464

65-
override protected def simpleNameString(sym: Symbol): String = {
66-
val name = if (ctx.property(XprintMode).isEmpty) sym.originalName else sym.name
67-
nameString(if (sym.is(TypeParam)) name.asTypeName.unexpandedName else name) // @!!!
68-
}
65+
override protected def simpleNameString(sym: Symbol): String =
66+
nameString(if (ctx.property(XprintMode).isEmpty) sym.originalName else sym.name)
6967

7068
override def fullNameString(sym: Symbol): String =
7169
if (isEmptyPrefix(sym.maybeOwner)) nameString(sym)

compiler/src/dotty/tools/dotc/typer/Checking.scala

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ object Checking {
487487
ctx.error(ValueClassesMayNotWrapItself(clazz), clazz.pos)
488488
else {
489489
val clParamAccessors = clazz.asClass.paramAccessors.filter { param =>
490-
param.isTerm && !param.is(Flags.Accessor) // @!!!
490+
param.isTerm && !param.is(Flags.Accessor)
491491
}
492492
clParamAccessors match {
493493
case List(param) =>
@@ -565,29 +565,26 @@ trait Checking {
565565
* are feasible, i.e. that their lower bound conforms to their upper bound. If a type
566566
* argument is infeasible, issue and error and continue with upper bound.
567567
*/
568-
def checkFeasibleParent(tp: Type, pos: Position, where: => String = "")(implicit ctx: Context): Type =
568+
def checkFeasibleParent(tp: Type, pos: Position, where: => String = "")(implicit ctx: Context): Type = {
569+
def checkGoodBounds(tp: Type) = tp match {
570+
case tp @ TypeBounds(lo, hi) if !(lo <:< hi) =>
571+
ctx.error(ex"no type exists between low bound $lo and high bound $hi$where", pos)
572+
TypeBounds(hi, hi)
573+
case _ =>
574+
tp
575+
}
569576
tp match {
570577
case tp @ AndType(tp1, tp2) =>
571578
ctx.error(s"conflicting type arguments$where", pos)
572579
tp1
573580
case tp @ AppliedType(tycon, args) =>
574-
def checkArg(arg: Type) = arg match {
575-
case tp @ TypeBounds(lo, hi) if !(lo <:< hi) =>
576-
ctx.error(ex"no type exists between low bound $lo and high bound $hi$where", pos)
577-
hi
578-
case _ => arg
579-
}
580-
tp.derivedAppliedType(tycon, args.mapConserve(checkArg))
581-
case tp: RefinedType => // @!!!
582-
tp.derivedRefinedType(tp.parent, tp.refinedName, checkFeasibleParent(tp.refinedInfo, pos, where))
583-
case tp: RecType => // @!!!
584-
tp.rebind(tp.parent)
585-
case tp @ TypeBounds(lo, hi) if !(lo <:< hi) => // @!!!
586-
ctx.error(ex"no type exists between low bound $lo and high bound $hi$where", pos)
587-
TypeAlias(hi)
581+
tp.derivedAppliedType(tycon, args.mapConserve(checkGoodBounds))
582+
case tp: RefinedType =>
583+
tp.derivedRefinedType(tp.parent, tp.refinedName, checkGoodBounds(tp.refinedInfo))
588584
case _ =>
589585
tp
590586
}
587+
}
591588

592589
/** Check that `tree` is a pure expression of constant type */
593590
def checkInlineConformant(tree: Tree, what: => String)(implicit ctx: Context): Unit =

compiler/src/dotty/tools/dotc/typer/Namer.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -916,8 +916,6 @@ class Namer { typer: Typer =>
916916
val parentTypes = ensureFirstIsClass(parents.map(checkedParentType(_)), cls.pos)
917917
typr.println(i"completing $denot, parents = $parents%, %, parentTypes = $parentTypes%, %")
918918

919-
tempInfo.finalize(denot, parentTypes)
920-
921919
Checking.checkWellFormed(cls)
922920
if (isDerivedValueClass(cls)) cls.setFlag(Final)
923921
cls.info = avoidPrivateLeaks(cls, cls.pos)

compiler/src/dotty/tools/dotc/typer/RefChecks.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ object RefChecks {
8585
*/
8686
private def upwardsThisType(cls: Symbol)(implicit ctx: Context) = cls.info match {
8787
case ClassInfo(_, _, _, _, tp: Type) if (tp ne cls.typeRef) && !cls.is(ModuleOrFinal) =>
88-
// @!!! case ClassInfo(_, _, _, _, selfTp: Type) if selfTp.exists && !cls.is(ModuleOrFinal) =>
8988
SkolemType(cls.typeRef).withName(nme.this_)
9089
case _ =>
9190
cls.thisType

0 commit comments

Comments
 (0)