Skip to content

Commit 6331cd5

Browse files
authored
Merge pull request #3293 from dotty-staging/cleanups
Some small cleanups
2 parents 6e917f7 + f07c25a commit 6331cd5

File tree

4 files changed

+9
-12
lines changed

4 files changed

+9
-12
lines changed

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,11 @@ object Designators {
1818
type ThisName <: Name
1919

2020
/** Classifiers and casts, to be overridden in implemetations */
21-
def isName: Boolean = false
22-
def isSymbol: Boolean = false
23-
2421
def isTerm(implicit ctx: Context) = false
2522
def isType(implicit ctx: Context) = false
2623

27-
def asTerm(implicit ctx: Context): TermDesignator = unsupported("asTerm")
28-
def asType(implicit ctx: Context): TypeDesignator = unsupported("asType")
24+
def asTerm(implicit ctx: Context): TermDesignator
25+
def asType(implicit ctx: Context): TypeDesignator
2926

3027
def withNameSpace(space: NameSpace)(implicit ctx: Context): Designator { type ThisName = self.ThisName } =
3128
if (space == noNameSpace) this

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ object Names {
152152
def endsWith(str: String): Boolean = lastPart.endsWith(str)
153153

154154
/** Designator overrides */
155-
override def isName = true
156155
override def isTerm(implicit ctx: Context) = isTermName
157156
override def isType(implicit ctx: Context) = isTypeName
158157
override def asTerm(implicit ctx: Context) = asTermName

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,6 @@ object Symbols {
444444
lastDenot.validFor.runId == ctx.runId || ctx.stillValid(lastDenot)
445445

446446
/** Designator overrides */
447-
final override def isSymbol = true
448447
final override def isTerm(implicit ctx: Context): Boolean =
449448
(if (defRunId == ctx.runId) lastDenot else denot).isTerm
450449
final override def isType(implicit ctx: Context): Boolean =

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3380,6 +3380,8 @@ object Types {
33803380

33813381
// ------ ClassInfo, Type Bounds ------------------------------------------------------------
33823382

3383+
type TypeOrSymbol = AnyRef /* should be: Type | Symbol */
3384+
33833385
/** Roughly: the info of a class during a period.
33843386
* @param prefix The prefix on which parents, decls, and selfType need to be rebased.
33853387
* @param cls The class symbol.
@@ -3396,7 +3398,7 @@ object Types {
33963398
cls: ClassSymbol,
33973399
classParents: List[Type],
33983400
decls: Scope,
3399-
selfInfo: DotClass /* should be: Type | Symbol */) extends CachedGroundType with TypeType {
3401+
selfInfo: TypeOrSymbol) extends CachedGroundType with TypeType {
34003402

34013403
private[this] var selfTypeCache: Type = null
34023404
private[this] var appliedRefCache: Type = null
@@ -3444,7 +3446,7 @@ object Types {
34443446
if (prefix eq this.prefix) this
34453447
else ClassInfo(prefix, cls, classParents, decls, selfInfo)
34463448

3447-
def derivedClassInfo(prefix: Type = this.prefix, classParents: List[Type] = this.classParents, decls: Scope = this.decls, selfInfo: DotClass = this.selfInfo)(implicit ctx: Context) =
3449+
def derivedClassInfo(prefix: Type = this.prefix, classParents: List[Type] = this.classParents, decls: Scope = this.decls, selfInfo: TypeOrSymbol = this.selfInfo)(implicit ctx: Context) =
34483450
if ((prefix eq this.prefix) && (classParents eq this.classParents) && (decls eq this.decls) && (selfInfo eq this.selfInfo)) this
34493451
else ClassInfo(prefix, cls, classParents, decls, selfInfo)
34503452

@@ -3463,11 +3465,11 @@ object Types {
34633465
override def toString = s"ClassInfo($prefix, $cls, $classParents)"
34643466
}
34653467

3466-
class CachedClassInfo(prefix: Type, cls: ClassSymbol, classParents: List[Type], decls: Scope, selfInfo: DotClass)
3468+
class CachedClassInfo(prefix: Type, cls: ClassSymbol, classParents: List[Type], decls: Scope, selfInfo: TypeOrSymbol)
34673469
extends ClassInfo(prefix, cls, classParents, decls, selfInfo)
34683470

34693471
/** A class for temporary class infos where `parents` are not yet known */
3470-
final class TempClassInfo(prefix: Type, cls: ClassSymbol, decls: Scope, selfInfo: DotClass)
3472+
final class TempClassInfo(prefix: Type, cls: ClassSymbol, decls: Scope, selfInfo: TypeOrSymbol)
34713473
extends CachedClassInfo(prefix, cls, Nil, decls, selfInfo) {
34723474

34733475
/** Install classinfo with known parents in `denot` s */
@@ -3482,7 +3484,7 @@ object Types {
34823484
}
34833485

34843486
object ClassInfo {
3485-
def apply(prefix: Type, cls: ClassSymbol, classParents: List[Type], decls: Scope, selfInfo: DotClass = NoType)(implicit ctx: Context) =
3487+
def apply(prefix: Type, cls: ClassSymbol, classParents: List[Type], decls: Scope, selfInfo: TypeOrSymbol = NoType)(implicit ctx: Context) =
34863488
unique(new CachedClassInfo(prefix, cls, classParents, decls, selfInfo))
34873489
}
34883490

0 commit comments

Comments
 (0)