aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/SymDenotations.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-04-10 15:19:13 +0200
committerMartin Odersky <odersky@gmail.com>2013-04-10 15:19:13 +0200
commit87ae863c3efa7ce41fed81b783855c572d541898 (patch)
tree590151812be9d41257e7c4b5d5f804853be78d31 /src/dotty/tools/dotc/core/SymDenotations.scala
parent1034d4e420c2b0724945486f341c53a07e6a90e0 (diff)
downloaddotty-87ae863c3efa7ce41fed81b783855c572d541898.tar.gz
dotty-87ae863c3efa7ce41fed81b783855c572d541898.tar.bz2
dotty-87ae863c3efa7ce41fed81b783855c572d541898.zip
Re-organized comparisons of types with classes.
New methods: isClassType, derivesFrom, isArray. Refactored calls to typeSymbol and <:< into these. Made sure to use dealias where needed on remaining typeSymbol calls.
Diffstat (limited to 'src/dotty/tools/dotc/core/SymDenotations.scala')
-rw-r--r--src/dotty/tools/dotc/core/SymDenotations.scala12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala
index a559e9d79..a14f28ce4 100644
--- a/src/dotty/tools/dotc/core/SymDenotations.scala
+++ b/src/dotty/tools/dotc/core/SymDenotations.scala
@@ -319,7 +319,7 @@ object SymDenotations {
/** Is this a subclass of `base`,
* and is the denoting symbol also different from `Null` or `Nothing`?
*/
- def isNonBottomSubClass(base: Symbol)(implicit ctx: Context) = false
+ def derivesFrom(base: Symbol)(implicit ctx: Context) = false
/** Is this symbol a class that does not extend `AnyVal`? */
final def isNonValueClass(implicit ctx: Context): Boolean =
@@ -351,7 +351,7 @@ object SymDenotations {
def isCorrectThisType(pre: Type): Boolean = pre match {
case ThisType(pclazz) =>
(pclazz eq owner) ||
- (this is Protected) && pclazz.isNonBottomSubClass(owner)
+ (this is Protected) && pclazz.derivesFrom(owner)
case _ => false
}
@@ -723,7 +723,7 @@ object SymDenotations {
_baseClasses
}
- final override def isNonBottomSubClass(base: Symbol)(implicit ctx: Context): Boolean =
+ final override def derivesFrom(base: Symbol)(implicit ctx: Context): Boolean =
base.isClass &&
( (symbol eq base)
|| (superClassBits contains base.superId)
@@ -732,7 +732,7 @@ object SymDenotations {
)
final override def isSubClass(base: Symbol)(implicit ctx: Context) =
- isNonBottomSubClass(base) ||
+ derivesFrom(base) ||
base.isClass && (
(symbol eq defn.NothingClass) ||
(symbol eq defn.NullClass) && (base ne defn.NothingClass))
@@ -885,8 +885,8 @@ object SymDenotations {
NoType
}
- ctx.debugTraceIndented(s"$tp.baseType($this) ${tp.typeSymbol.fullName} ${this.fullName}") {
- if (symbol.isStatic && tp.typeSymbol.isNonBottomSubClass(symbol))
+ ctx.debugTraceIndented(s"$tp.baseType($this)") {
+ if (symbol.isStatic && tp.derivesFrom(symbol))
symbol.typeConstructor
else tp match {
case tp: CachedType =>