@@ -513,7 +513,7 @@ class TreeUnpickler(reader: TastyReader,
513513 val rhsStart = currentAddr
514514 val rhsIsEmpty = nothingButMods(end)
515515 if (! rhsIsEmpty) skipTree()
516- val (givenFlags, annots , privateWithin) = readModifiers(end)
516+ val (givenFlags, annotFns , privateWithin) = readModifiers(end)
517517 pickling.println(i " creating symbol $name at $start with flags $givenFlags" )
518518 val flags = normalizeFlags(tag, givenFlags, name, isAbsType, rhsIsEmpty)
519519 def adjustIfModule (completer : LazyType ) =
@@ -532,13 +532,12 @@ class TreeUnpickler(reader: TastyReader,
532532 rootd.symbol
533533 case _ =>
534534 val completer = adjustIfModule(new Completer (ctx.owner, subReader(start, end)))
535-
536535 if (isClass)
537536 ctx.newClassSymbol(ctx.owner, name.asTypeName, flags, completer, privateWithin, coord)
538537 else
539538 ctx.newSymbol(ctx.owner, name, flags, completer, privateWithin, coord)
540539 }
541- sym.annotations = annots
540+ sym.annotations = annotFns.map(_(sym))
542541 ctx.owner match {
543542 case cls : ClassSymbol => cls.enter(sym)
544543 case _ =>
@@ -548,7 +547,7 @@ class TreeUnpickler(reader: TastyReader,
548547 sym.completer.withDecls(newScope)
549548 forkAt(templateStart).indexTemplateParams()(localContext(sym))
550549 }
551- else if (sym.isInlineMethod )
550+ else if (sym.isInlineableMethod )
552551 sym.addAnnotation(LazyBodyAnnotation { ctx0 =>
553552 implicit val ctx : Context = localContext(sym)(ctx0).addMode(Mode .ReadPositions )
554553 // avoids space leaks by not capturing the current context
@@ -561,9 +560,9 @@ class TreeUnpickler(reader: TastyReader,
561560 /** Read modifier list into triplet of flags, annotations and a privateWithin
562561 * boundary symbol.
563562 */
564- def readModifiers (end : Addr )(implicit ctx : Context ): (FlagSet , List [Annotation ], Symbol ) = {
563+ def readModifiers (end : Addr )(implicit ctx : Context ): (FlagSet , List [Symbol => Annotation ], Symbol ) = {
565564 var flags : FlagSet = EmptyFlags
566- var annots : List [Annotation ] = Nil
565+ var annotFns : List [Symbol => Annotation ] = Nil
567566 var privateWithin : Symbol = NoSymbol
568567 while (currentAddr.index != end.index) {
569568 def addFlag (flag : FlagSet ) = {
@@ -588,6 +587,7 @@ class TreeUnpickler(reader: TastyReader,
588587 case LAZY => addFlag(Lazy )
589588 case OVERRIDE => addFlag(Override )
590589 case INLINE => addFlag(Inline )
590+ case TRANSPARENT => addFlag(Transparent )
591591 case MACRO => addFlag(Macro )
592592 case STATIC => addFlag(JavaStatic )
593593 case OBJECT => addFlag(Module )
@@ -614,23 +614,25 @@ class TreeUnpickler(reader: TastyReader,
614614 addFlag(Protected )
615615 privateWithin = readType().typeSymbol
616616 case ANNOTATION =>
617- annots = readAnnot(ctx) :: annots
617+ annotFns = readAnnot(ctx) :: annotFns
618618 case tag =>
619619 assert(false , s " illegal modifier tag $tag at $currentAddr, end = $end" )
620620 }
621621 }
622- (flags, annots .reverse, privateWithin)
622+ (flags, annotFns .reverse, privateWithin)
623623 }
624624
625- private val readAnnot : Context => Annotation = {
625+ private val readAnnot : Context => Symbol => Annotation = {
626626 implicit ctx =>
627627 readByte()
628628 val end = readEnd()
629629 val tp = readType()
630- val lazyAnnotTree = readLater(end, rdr => ctx => rdr.readTerm()(ctx))
631- Annotation .deferredSymAndTree(
632- implicit ctx => tp.typeSymbol,
633- implicit ctx => lazyAnnotTree.complete)
630+ val lazyAnnotTree = readLaterWithOwner(end, rdr => ctx => rdr.readTerm()(ctx))
631+
632+ owner =>
633+ Annotation .deferredSymAndTree(
634+ implicit ctx => tp.typeSymbol,
635+ implicit ctx => lazyAnnotTree(owner).complete)
634636 }
635637
636638 /** Create symbols for the definitions in the statement sequence between
@@ -1153,10 +1155,13 @@ class TreeUnpickler(reader: TastyReader,
11531155 setPos(start, CaseDef (pat, guard, rhs))
11541156 }
11551157
1156- def readLater [T <: AnyRef ](end : Addr , op : TreeReader => Context => T )(implicit ctx : Context ): Trees .Lazy [T ] = {
1158+ def readLater [T <: AnyRef ](end : Addr , op : TreeReader => Context => T )(implicit ctx : Context ): Trees .Lazy [T ] =
1159+ readLaterWithOwner(end, op)(ctx)(ctx.owner)
1160+
1161+ def readLaterWithOwner [T <: AnyRef ](end : Addr , op : TreeReader => Context => T )(implicit ctx : Context ): Symbol => Trees .Lazy [T ] = {
11571162 val localReader = fork
11581163 goto(end)
1159- new LazyReader (localReader, ctx. owner, ctx.mode, op)
1164+ owner => new LazyReader (localReader, owner, ctx.mode, op)
11601165 }
11611166
11621167 def readHole (end : Addr , isType : Boolean )(implicit ctx : Context ): Tree = {
0 commit comments