From e4d499945b93f95bbff7e9fe71aeffc9af4fc8bd Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Sat, 18 Mar 2017 13:57:52 +0100 Subject: Handle hk lambdas in tasty --- .../dotty/tools/dotc/core/tasty/TreePickler.scala | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala') diff --git a/compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala b/compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala index 4c600564d..fc9d9c447 100644 --- a/compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala +++ b/compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala @@ -253,12 +253,12 @@ class TreePickler(pickler: TastyPickler) { case tpe: ExprType => writeByte(BYNAMEtype) pickleType(tpe.underlying) - case tpe: TypeLambda => - writeByte(POLYtype) - pickleMethodic(tpe.resultType, tpe.paramNames, tpe.paramInfos) + case tpe: HKTypeLambda => + pickleMethodic(TYPELAMBDAtype, tpe) + case tpe: PolyType /*if richTypes*/ => //### + pickleMethodic(POLYtype, tpe) case tpe: MethodType if richTypes => - writeByte(METHODtype) - pickleMethodic(tpe.resultType, tpe.paramNames, tpe.paramInfos) + pickleMethodic(METHODtype, tpe) case tpe: TypeParamRef => if (!pickleParamRef(tpe)) // TODO figure out why this case arises in e.g. pickling AbstractFileReader. @@ -281,13 +281,15 @@ class TreePickler(pickler: TastyPickler) { pickleName(qualifiedName(pkg)) } - def pickleMethodic(result: Type, names: List[Name], types: List[Type])(implicit ctx: Context) = + def pickleMethodic(tag: Int, tpe: LambdaType)(implicit ctx: Context) = { + writeByte(tag) withLength { - pickleType(result, richTypes = true) - (names, types).zipped.foreach { (name, tpe) => + pickleType(tpe.resultType, richTypes = true) + (tpe.paramNames, tpe.paramInfos).zipped.foreach { (name, tpe) => pickleName(name); pickleType(tpe) } } + } def pickleParamRef(tpe: ParamRef)(implicit ctx: Context): Boolean = { val binder = pickledTypes.get(tpe.binder) @@ -554,7 +556,7 @@ class TreePickler(pickler: TastyPickler) { writeByte(ANNOTATEDtpt) withLength { pickleTree(tree); pickleTree(annot.tree) } case LambdaTypeTree(tparams, body) => - writeByte(POLYtpt) + writeByte(LAMBDAtpt) withLength { pickleParams(tparams); pickleTree(body) } case TypeBoundsTree(lo, hi) => writeByte(TYPEBOUNDStpt) -- cgit v1.2.3