Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions compiler/src/dotty/tools/dotc/core/Designators.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,11 @@ object Designators {
type ThisName <: Name

/** Classifiers and casts, to be overridden in implemetations */
def isName: Boolean = false
def isSymbol: Boolean = false

def isTerm(implicit ctx: Context) = false
def isType(implicit ctx: Context) = false

def asTerm(implicit ctx: Context): TermDesignator = unsupported("asTerm")
def asType(implicit ctx: Context): TypeDesignator = unsupported("asType")
def asTerm(implicit ctx: Context): TermDesignator
def asType(implicit ctx: Context): TypeDesignator

def withNameSpace(space: NameSpace)(implicit ctx: Context): Designator { type ThisName = self.ThisName } =
if (space == noNameSpace) this
Expand Down
1 change: 0 additions & 1 deletion compiler/src/dotty/tools/dotc/core/Names.scala
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ object Names {
def endsWith(str: String): Boolean = lastPart.endsWith(str)

/** Designator overrides */
override def isName = true
override def isTerm(implicit ctx: Context) = isTermName
override def isType(implicit ctx: Context) = isTypeName
override def asTerm(implicit ctx: Context) = asTermName
Expand Down
1 change: 0 additions & 1 deletion compiler/src/dotty/tools/dotc/core/Symbols.scala
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,6 @@ object Symbols {
lastDenot.validFor.runId == ctx.runId || ctx.stillValid(lastDenot)

/** Designator overrides */
final override def isSymbol = true
final override def isTerm(implicit ctx: Context): Boolean =
(if (defRunId == ctx.runId) lastDenot else denot).isTerm
final override def isType(implicit ctx: Context): Boolean =
Expand Down
12 changes: 7 additions & 5 deletions compiler/src/dotty/tools/dotc/core/Types.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3373,6 +3373,8 @@ object Types {

// ------ ClassInfo, Type Bounds ------------------------------------------------------------

type TypeOrSymbol = AnyRef /* should be: Type | Symbol */

/** Roughly: the info of a class during a period.
* @param prefix The prefix on which parents, decls, and selfType need to be rebased.
* @param cls The class symbol.
Expand All @@ -3389,7 +3391,7 @@ object Types {
cls: ClassSymbol,
classParents: List[Type],
decls: Scope,
selfInfo: DotClass /* should be: Type | Symbol */) extends CachedGroundType with TypeType {
selfInfo: TypeOrSymbol) extends CachedGroundType with TypeType {

private[this] var selfTypeCache: Type = null
private[this] var appliedRefCache: Type = null
Expand Down Expand Up @@ -3437,7 +3439,7 @@ object Types {
if (prefix eq this.prefix) this
else ClassInfo(prefix, cls, classParents, decls, selfInfo)

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

Expand All @@ -3456,11 +3458,11 @@ object Types {
override def toString = s"ClassInfo($prefix, $cls, $classParents)"
}

class CachedClassInfo(prefix: Type, cls: ClassSymbol, classParents: List[Type], decls: Scope, selfInfo: DotClass)
class CachedClassInfo(prefix: Type, cls: ClassSymbol, classParents: List[Type], decls: Scope, selfInfo: TypeOrSymbol)
extends ClassInfo(prefix, cls, classParents, decls, selfInfo)

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

/** Install classinfo with known parents in `denot` s */
Expand All @@ -3475,7 +3477,7 @@ object Types {
}

object ClassInfo {
def apply(prefix: Type, cls: ClassSymbol, classParents: List[Type], decls: Scope, selfInfo: DotClass = NoType)(implicit ctx: Context) =
def apply(prefix: Type, cls: ClassSymbol, classParents: List[Type], decls: Scope, selfInfo: TypeOrSymbol = NoType)(implicit ctx: Context) =
unique(new CachedClassInfo(prefix, cls, classParents, decls, selfInfo))
}

Expand Down