aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/pickling/UnPickler.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/pickling/UnPickler.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/pickling/UnPickler.scala')
-rw-r--r--src/dotty/tools/dotc/core/pickling/UnPickler.scala8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/dotty/tools/dotc/core/pickling/UnPickler.scala b/src/dotty/tools/dotc/core/pickling/UnPickler.scala
index 1d748ae55..3168bb37c 100644
--- a/src/dotty/tools/dotc/core/pickling/UnPickler.scala
+++ b/src/dotty/tools/dotc/core/pickling/UnPickler.scala
@@ -82,10 +82,10 @@ object UnPickler {
def arrayToRepeated(tp: Type)(implicit ctx: Context): Type = tp match {
case tp @ MethodType(paramNames, paramTypes) =>
val lastArg = paramTypes.last
- assert(lastArg.typeSymbol == defn.ArrayClass)
+ assert(lastArg.isArray)
val elemtp0 :: Nil = lastArg.typeArgs
val elemtp = elemtp0 match {
- case AndType(t1, t2) if t1.typeSymbol.isAbstractType && t2.typeSymbol == defn.ObjectClass =>
+ case AndType(t1, t2) if t1.typeSymbol.isAbstractType && t2.isClassType(defn.ObjectClass) =>
t1 // drop intersection with Object for abstract types in varargs. UnCurry can handle them.
case _ =>
elemtp0
@@ -550,7 +550,7 @@ class UnPickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClassRoot:
*/
def elimExistentials(boundSyms: List[Symbol], tp: Type): Type = {
def removeSingleton(tp: Type): Type =
- if (tp.typeSymbol == defn.SingletonClass) defn.AnyType else tp
+ if (tp.isClassType(defn.SingletonClass)) defn.AnyType else tp
def elim(tp: Type): Type = tp match {
case tp @ RefinedType(parent, name) =>
val parent1 = elim(tp.parent)
@@ -559,7 +559,7 @@ class UnPickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClassRoot:
RefinedType(parent1, name, info.fixedSym.info)
case info: TypeRefBySym if boundSyms contains info.fixedSym =>
val info1 = info.fixedSym.info
- assert(info1 <:< defn.SingletonClass.typeConstructor)
+ assert(info1.derivesFrom(defn.SingletonClass))
RefinedType(parent1, name, info1.mapAnd(removeSingleton))
case info =>
tp.derivedRefinedType(parent1, name, info)