This PR ensures that all symbols in annotation trees are different by creating fresh symbols for all symbols in annotation tree during PostTyper.
In my previous attempt which was discussed on #19957, I did it in Annotations.mapWith. Here, it's only done once in PostTyper, so this is more lightweight.
Fixes #17939, fixes #19846 and fixes (partially?) #20272.
In a nutshell: when mapping annotated types, we can currently end up with the same symbol being declared in distinct trees, which crashes the pickler as it expects each symbol to be declared in a single place. See https://github.com/scala/scala3/pull/19957#discussion_r1644920020 and https://github.com/scala/scala3/pull/19957#discussion_r1644921716 for more context.
This PR ensures that all symbols in annotation trees are different by creating fresh symbols for all symbols in annotation tree during
PostTyper
.In my previous attempt which was discussed on #19957, I did it in
Annotations.mapWith
. Here, it's only done once inPostTyper
, so this is more lightweight.Fixes #17939, fixes #19846 and fixes (partially?) #20272.