Skip to content

Commit d7e2832

Browse files
committed
Disentangled denotation types from their symbols, based on info instead.
1 parent 401fae7 commit d7e2832

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/dotty/tools/dotc/core/Denotations.scala

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,10 @@ object Denotations {
129129
def validFor: Period
130130

131131
/** Is this a reference to a type symbol? */
132-
def isType: Boolean = false
132+
def isType: Boolean
133133

134134
/** Is this a reference to a term symbol? */
135-
def isTerm: Boolean = false
135+
final def isTerm: Boolean = !isType
136136

137137
/** Is this denotation overloaded? */
138138
def isOverloaded = isInstanceOf[MultiDenotation]
@@ -238,7 +238,6 @@ object Denotations {
238238
*/
239239
case class MultiDenotation(denot1: Denotation, denot2: Denotation) extends Denotation {
240240
final override def isType = false
241-
final override def isTerm = true
242241
def derivedMultiDenotation(d1: Denotation, d2: Denotation) =
243242
if ((d1 eq denot1) && (d2 eq denot2)) this else MultiDenotation(d1, d2)
244243
def symbol = unsupported("symbol")
@@ -254,9 +253,7 @@ object Denotations {
254253
}
255254

256255
abstract class SingleDenotation extends Denotation with DenotationSet {
257-
258-
override def isType = symbol.isType
259-
override def isTerm = symbol.isTerm
256+
final override def isType = info.isInstanceOf[TypeType]
260257
override def signature: Signature = {
261258
def sig(tp: Type): Signature = tp match {
262259
case tp: PolyType =>

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,9 @@ object Types {
589589
*/
590590
trait SingletonType extends TypeProxy
591591

592+
/** A marker trait for types that apply only to type symbols */
593+
trait TypeType extends Type
594+
592595
// --- NamedTypes ------------------------------------------------------------------
593596

594597
/** A NamedType of the form Prefix # name
@@ -964,7 +967,7 @@ object Types {
964967

965968
// ------ ClassInfo, Type Bounds ------------------------------------------------------------
966969

967-
abstract case class ClassInfo(prefix: Type, classd: ClassDenotation) extends CachedGroundType {
970+
abstract case class ClassInfo(prefix: Type, classd: ClassDenotation) extends CachedGroundType with TypeType {
968971

969972
/* def typeTemplate(implicit ctx: Context): Type =
970973
classd.typeTemplate asSeenFrom (prefix, classd.symbol)
@@ -991,7 +994,7 @@ object Types {
991994
unique(new CachedClassInfo(prefix, classd))
992995
}
993996

994-
abstract case class TypeBounds(lo: Type, hi: Type) extends CachedProxyType {
997+
abstract case class TypeBounds(lo: Type, hi: Type) extends CachedProxyType with TypeType {
995998
override def underlying(implicit ctx: Context): Type = hi
996999
def derivedTypeBounds(lo1: Type, hi1: Type)(implicit ctx: Context) =
9971000
if ((lo1 eq lo) && (hi1 eq hi)) this

0 commit comments

Comments
 (0)