From 8b10844da492292d1fd70bf94f639fe70f88fcd2 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Mon, 31 Oct 2016 15:09:34 +0100 Subject: Eliminate LAMBDAtype from TASTYformat Merge with POLYtypem, as we do already for internal types. --- src/dotty/tools/dotc/core/tasty/TastyFormat.scala | 12 +++++------- src/dotty/tools/dotc/core/tasty/TreePickler.scala | 2 +- src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala | 9 +-------- 3 files changed, 7 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/dotty/tools/dotc/core/tasty/TastyFormat.scala b/src/dotty/tools/dotc/core/tasty/TastyFormat.scala index a8725136d..f9743d9d2 100644 --- a/src/dotty/tools/dotc/core/tasty/TastyFormat.scala +++ b/src/dotty/tools/dotc/core/tasty/TastyFormat.scala @@ -139,12 +139,11 @@ Standard-Section: "ASTs" TopLevelStat* BIND Length boundName_NameRef bounds_Type // for type-variables defined in a type pattern BYNAMEtype underlying_Type - LAMBDAtype Length result_Type NamesTypes // variance encoded in front of name: +/-/= - POLYtype Length result_Type NamesTypes // needed for refinements + POLYtype Length result_Type NamesTypes // variance encoded in front of name: +/-/= METHODtype Length result_Type NamesTypes // needed for refinements PARAMtype Length binder_ASTref paramNum_Nat // needed for refinements SHARED type_ASTRef - NamesTypes = ParamType* + NamesTypes = NameType* NameType = paramName_NameRef typeOrBounds_ASTRef Modifier = PRIVATE @@ -325,9 +324,8 @@ object TastyFormat { final val ORtype = 172 final val METHODtype = 174 final val POLYtype = 175 - final val LAMBDAtype = 176 - final val PARAMtype = 177 - final val ANNOTATION = 178 + final val PARAMtype = 176 + final val ANNOTATION = 177 final val firstSimpleTreeTag = UNITconst final val firstNatTreeTag = SHARED @@ -489,7 +487,7 @@ object TastyFormat { case PROTECTEDqualified => "PROTECTEDqualified" } - /** @return If non-negative, the number of leading references of a length/trees entry. + /** @return If non-negative, the number of leading references (represented as nats) of a length/trees entry. * If negative, minus the number of leading non-reference trees. */ def numRefs(tag: Int) = tag match { diff --git a/src/dotty/tools/dotc/core/tasty/TreePickler.scala b/src/dotty/tools/dotc/core/tasty/TreePickler.scala index f0d8da9df..9dfb78798 100644 --- a/src/dotty/tools/dotc/core/tasty/TreePickler.scala +++ b/src/dotty/tools/dotc/core/tasty/TreePickler.scala @@ -262,7 +262,7 @@ class TreePickler(pickler: TastyPickler) { writeByte(BYNAMEtype) pickleType(tpe.underlying) case tpe: PolyType => - writeByte(LAMBDAtype) + writeByte(POLYtype) val paramNames = tpe.typeParams.map(tparam => varianceToPrefix(tparam.paramVariance) +: tparam.paramName) pickleMethodic(tpe.resultType, paramNames, tpe.paramBounds) diff --git a/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala b/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala index c2779ba88..a0d788955 100644 --- a/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala +++ b/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala @@ -266,7 +266,7 @@ class TreeUnpickler(reader: TastyReader, tastyName: TastyName.Table, posUnpickle val sym = ctx.newSymbol(ctx.owner, readName().toTypeName, BindDefinedType, readType()) registerSym(start, sym) TypeRef.withFixedSym(NoPrefix, sym.name, sym) - case LAMBDAtype => + case POLYtype => val (rawNames, paramReader) = readNamesSkipParams val (variances, paramNames) = rawNames .map(name => (prefixToVariance(name.head), name.tail.toTypeName)).unzip @@ -275,13 +275,6 @@ class TreeUnpickler(reader: TastyReader, tastyName: TastyName.Table, posUnpickle pt => readType()) goto(end) result - case POLYtype => - val (names, paramReader) = readNamesSkipParams - val result = PolyType(names.map(_.toTypeName))( - pt => registeringType(pt, paramReader.readParamTypes[TypeBounds](end)), - pt => readType()) - goto(end) - result case METHODtype => val (names, paramReader) = readNamesSkipParams val result = MethodType(names.map(_.toTermName), paramReader.readParamTypes[Type](end))( -- cgit v1.2.3