@@ -438,6 +438,7 @@ class TreeUnpickler(reader: TastyReader,
438
438
var flags = givenFlags
439
439
if (lacksDefinition && tag != PARAM ) flags |= Deferred
440
440
if (tag == DEFDEF ) flags |= Method
441
+ if (tag == TYPEDEF && givenFlags.is(Transparent )) flags |= TypeMethod
441
442
if (givenFlags is Module )
442
443
flags = flags | (if (tag == VALDEF ) ModuleValCreationFlags else ModuleClassCreationFlags )
443
444
if (ctx.owner.isClass) {
@@ -754,28 +755,33 @@ class TreeUnpickler(reader: TastyReader,
754
755
ta.assignType(untpd.ValDef (sym.name.asTermName, tpt, readRhs(localCtx)), sym)
755
756
756
757
def DefDef (tparams : List [TypeDef ], vparamss : List [List [ValDef ]], tpt : Tree ) =
757
- ta.assignType(
758
- untpd.DefDef (sym.name.asTermName , tparams, vparamss, tpt, readRhs(localCtx)),
759
- sym)
758
+ ta.assignType(
759
+ untpd.DefDef (sym.name, tparams, vparamss, tpt, readRhs(localCtx)),
760
+ sym)
760
761
761
762
def TypeDef (rhs : Tree ) =
762
763
ta.assignType(untpd.TypeDef (sym.name.asTypeName, rhs), sym)
763
764
764
765
def ta = ctx.typeAssigner
765
766
766
767
val name = readName()
768
+
769
+ def readDefDef () = {
770
+ val tparams = readParams[TypeDef ](TYPEPARAM )(localCtx)
771
+ val vparamss = readParamss(localCtx)
772
+ val tpt = readTpt()(localCtx)
773
+ val typeParams = tparams.map(_.symbol.asType)
774
+ val valueParamss = ctx.normalizeIfConstructor(
775
+ vparamss.nestedMap(_.symbol.asTerm), name == nme.CONSTRUCTOR )
776
+ val resType = ctx.effectiveResultType(sym, typeParams, tpt.tpe)
777
+ sym.info = ctx.lambdaType(typeParams, valueParamss, resType, sym)
778
+ DefDef (tparams, vparamss, tpt)
779
+ }
780
+
767
781
pickling.println(s " reading def of $name at $start" )
768
782
val tree : MemberDef = tag match {
769
783
case DEFDEF =>
770
- val tparams = readParams[TypeDef ](TYPEPARAM )(localCtx)
771
- val vparamss = readParamss(localCtx)
772
- val tpt = readTpt()(localCtx)
773
- val typeParams = tparams.map(_.symbol.asType)
774
- val valueParamss = ctx.normalizeIfConstructor(
775
- vparamss.nestedMap(_.symbol.asTerm), name == nme.CONSTRUCTOR )
776
- val resType = ctx.effectiveResultType(sym, typeParams, tpt.tpe)
777
- sym.info = ctx.termLambda(typeParams, valueParamss, resType, sym)
778
- DefDef (tparams, vparamss, tpt)
784
+ readDefDef()
779
785
case VALDEF =>
780
786
val tpt = readTpt()(localCtx)
781
787
sym.info = tpt.tpe
@@ -795,7 +801,10 @@ class TreeUnpickler(reader: TastyReader,
795
801
else sym.registerCompanionMethod(nme.COMPANION_MODULE_METHOD , companion)
796
802
}
797
803
TypeDef (readTemplate(localCtx))
798
- } else {
804
+ }
805
+ else if (sym.is(Transparent ))
806
+ readDefDef()
807
+ else {
799
808
sym.info = TypeBounds .empty // needed to avoid cyclic references when unpicklin rhs, see i3816.scala
800
809
sym.setFlag(Provisional )
801
810
val rhs = readTpt()(localCtx)
@@ -1337,8 +1346,13 @@ class TreeUnpickler(reader: TastyReader,
1337
1346
case ALTERNATIVE =>
1338
1347
untpd.Alternative (until(end)(readUntyped()))
1339
1348
case DEFDEF =>
1340
- untpd.DefDef (readName(), readParams[TypeDef ](TYPEPARAM ), readParamss(), readUntyped(), readRhs())
1341
- .withMods(readMods())
1349
+ var name = readName()
1350
+ val tparams = readParams[TypeDef ](TYPEPARAM )
1351
+ val vparamss = readParamss()
1352
+ val tpt = readUntyped()
1353
+ untpd.DefDef (
1354
+ if (untpd.isBounds(tpt)) name.toTypeName else name,
1355
+ tparams, vparamss, tpt, readRhs()).withMods(readMods())
1342
1356
case VALDEF | PARAM =>
1343
1357
untpd.ValDef (readName(), readUntyped(), readRhs())
1344
1358
.withMods(readMods())
0 commit comments