diff options
author | Martin Odersky <odersky@gmail.com> | 2013-03-26 16:44:07 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-03-26 16:44:07 +0100 |
commit | df79c5efc7190e7a61ce7ac526aca0aac520ea9f (patch) | |
tree | 98b138cb0ce27e85b44e1faa81e4ac6057b10f2d | |
parent | ebc23ad054787d87b18b713f26847ee1443d6890 (diff) | |
download | dotty-df79c5efc7190e7a61ce7ac526aca0aac520ea9f.tar.gz dotty-df79c5efc7190e7a61ce7ac526aca0aac520ea9f.tar.bz2 dotty-df79c5efc7190e7a61ce7ac526aca0aac520ea9f.zip |
Getting rid of forceProperType in Unpicklers
-rw-r--r-- | src/dotty/tools/dotc/core/pickling/UnPickler.scala | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/src/dotty/tools/dotc/core/pickling/UnPickler.scala b/src/dotty/tools/dotc/core/pickling/UnPickler.scala index 161034bde..75144ca01 100644 --- a/src/dotty/tools/dotc/core/pickling/UnPickler.scala +++ b/src/dotty/tools/dotc/core/pickling/UnPickler.scala @@ -488,7 +488,7 @@ class UnPickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClassRoot: pw } // println("reading type for "+denot) // !!! DEBUG - val tp = at(inforef, () => readType(forceProperType = denot.isTerm)) + val tp = at(inforef, readType) denot match { case denot: ClassDenotation => val optSelfType = if (atEnd) NoType else readTypeRef() @@ -582,7 +582,7 @@ class UnPickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClassRoot: * the flag say that a type of kind * is expected, so that PolyType(tps, restpe) can be disambiguated to PolyType(tps, NullaryMethodType(restpe)) * (if restpe is not a ClassInfoType, a MethodType or a NullaryMethodType, which leaves TypeRef/SingletonType -- the latter would make the polytype a type constructor) */ - protected def readType(forceProperType: Boolean = false): Type = { + protected def readType(): Type = { val tag = readByte() val end = readNat() + readIndex (tag: @switch) match { @@ -670,18 +670,8 @@ class UnPickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClassRoot: case POLYtpe => val restpe = readTypeRef() val typeParams = until(end, readSymbolRef) - if (typeParams.nonEmpty) { - // NMT_TRANSITION: old class files denoted a polymorphic nullary method as PolyType(tps, restpe), we now require PolyType(tps, NullaryMethodType(restpe)) - // when a type of kind * is expected (forceProperType is true), we know restpe should be wrapped in a NullaryMethodType (if it wasn't suitably wrapped yet) - def transitionNMT(restpe: Type) = { - val resTpeCls = restpe.getClass.toString // what's uglier than isInstanceOf? right! -- isInstanceOf does not work since the concrete types are defined in the compiler (not in scope here) - if (forceProperType /*&& pickleformat < 2.9 */ && !(resTpeCls.endsWith("MethodType"))) { - assert(!resTpeCls.contains("ClassInfoType")) - ExprType(restpe) - } else restpe - } - TempPolyType(typeParams, transitionNMT(restpe)) - } else ExprType(restpe) + if (typeParams.nonEmpty) TempPolyType(typeParams, restpe) + else ExprType(restpe) case EXISTENTIALtpe => val restpe = readTypeRef() val boundSyms = until(end, readSymbolRef) |