Skip to content

Commit 3c61bca

Browse files
committed
Fix context for unpickling symbol annotations
For member definitions, the owner for unpickling annotations should be the owner of the symbol. Note that the type checking has a more complex mechanism to avoid entering argument definitions in the enclosing class. See `Typer.annotContext` and `Context.exprContext`. In the context of unpickling, it is unclear how to get that mechanism to work.
1 parent 235e393 commit 3c61bca

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ class TreeUnpickler(reader: TastyReader,
578578
else
579579
ctx.newSymbol(ctx.owner, name, flags, completer, privateWithin, coord)
580580
}
581-
sym.annotations = annotFns.map(_(sym))
581+
sym.annotations = annotFns.map(_(sym.owner))
582582
if sym.isOpaqueAlias then sym.setFlag(Deferred)
583583
val isScala2MacroDefinedInScala3 = flags.is(Macro, butNot = Inline) && flags.is(Erased)
584584
ctx.owner match {

0 commit comments

Comments
 (0)