From d7e283216a4d6a53aa3f0c837f3412165e5bcba6 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Wed, 6 Feb 2013 22:37:35 +0100 Subject: Disentangled denotation types from their symbols, based on info instead. --- src/dotty/tools/dotc/core/Denotations.scala | 9 +++------ src/dotty/tools/dotc/core/Types.scala | 7 +++++-- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src/dotty/tools/dotc/core') diff --git a/src/dotty/tools/dotc/core/Denotations.scala b/src/dotty/tools/dotc/core/Denotations.scala index f7935d675..f43fe5121 100644 --- a/src/dotty/tools/dotc/core/Denotations.scala +++ b/src/dotty/tools/dotc/core/Denotations.scala @@ -129,10 +129,10 @@ object Denotations { def validFor: Period /** Is this a reference to a type symbol? */ - def isType: Boolean = false + def isType: Boolean /** Is this a reference to a term symbol? */ - def isTerm: Boolean = false + final def isTerm: Boolean = !isType /** Is this denotation overloaded? */ def isOverloaded = isInstanceOf[MultiDenotation] @@ -238,7 +238,6 @@ object Denotations { */ case class MultiDenotation(denot1: Denotation, denot2: Denotation) extends Denotation { final override def isType = false - final override def isTerm = true def derivedMultiDenotation(d1: Denotation, d2: Denotation) = if ((d1 eq denot1) && (d2 eq denot2)) this else MultiDenotation(d1, d2) def symbol = unsupported("symbol") @@ -254,9 +253,7 @@ object Denotations { } abstract class SingleDenotation extends Denotation with DenotationSet { - - override def isType = symbol.isType - override def isTerm = symbol.isTerm + final override def isType = info.isInstanceOf[TypeType] override def signature: Signature = { def sig(tp: Type): Signature = tp match { case tp: PolyType => diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index e17572cde..c04ccd60c 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -589,6 +589,9 @@ object Types { */ trait SingletonType extends TypeProxy + /** A marker trait for types that apply only to type symbols */ + trait TypeType extends Type + // --- NamedTypes ------------------------------------------------------------------ /** A NamedType of the form Prefix # name @@ -964,7 +967,7 @@ object Types { // ------ ClassInfo, Type Bounds ------------------------------------------------------------ - abstract case class ClassInfo(prefix: Type, classd: ClassDenotation) extends CachedGroundType { + abstract case class ClassInfo(prefix: Type, classd: ClassDenotation) extends CachedGroundType with TypeType { /* def typeTemplate(implicit ctx: Context): Type = classd.typeTemplate asSeenFrom (prefix, classd.symbol) @@ -991,7 +994,7 @@ object Types { unique(new CachedClassInfo(prefix, classd)) } - abstract case class TypeBounds(lo: Type, hi: Type) extends CachedProxyType { + abstract case class TypeBounds(lo: Type, hi: Type) extends CachedProxyType with TypeType { override def underlying(implicit ctx: Context): Type = hi def derivedTypeBounds(lo1: Type, hi1: Type)(implicit ctx: Context) = if ((lo1 eq lo) && (hi1 eq hi)) this -- cgit v1.2.3