diff --git a/compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala b/compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala index 521306eb73fc..611fda9c1d41 100644 --- a/compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala +++ b/compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala @@ -445,8 +445,6 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas // Scala 2 sometimes pickle the same type parameter symbol multiple times // (see i11173 for an example), but we should only unpickle it once. || tag == TYPEsym && flags.is(TypeParam) && symScope(owner).lookup(name.asTypeName).exists - // We discard the private val representing a case accessor. We only load the case accessor def. - || flags.isAllOf(CaseAccessor| PrivateLocal, butNot = Method) then // skip this member return NoSymbol @@ -534,7 +532,10 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas // parameter unpickling and try to emulate it. !completer.areParamsInitialized case _ => - true) + true) && + // We discard the private val representing a case accessor. We only enter the case accessor def. + // We do need to load these symbols to read properly unpickle the annotations on the symbol (see sbt-test/scala2-compat/i19421). + !flags.isAllOf(CaseAccessor | PrivateLocal, butNot = Method) if (canEnter) owner.asClass.enter(sym, symScope(owner)) diff --git a/sbt-test/scala2-compat/i19421/S3SnapshotStoreSpec.scala b/sbt-test/scala2-compat/i19421/S3SnapshotStoreSpec.scala new file mode 100644 index 000000000000..9dce07d206fc --- /dev/null +++ b/sbt-test/scala2-compat/i19421/S3SnapshotStoreSpec.scala @@ -0,0 +1,8 @@ +import com.typesafe.config.Config +import akka.persistence.snapshot.SnapshotStoreSpec + +object ConfigHelper { + def config(): Config = ??? +} + +class S3SnapshotStoreSpec extends SnapshotStoreSpec(null) diff --git a/sbt-test/scala2-compat/i19421/build.sbt b/sbt-test/scala2-compat/i19421/build.sbt new file mode 100644 index 000000000000..fa553d80d273 --- /dev/null +++ b/sbt-test/scala2-compat/i19421/build.sbt @@ -0,0 +1,5 @@ +scalaVersion := sys.props("plugin.scalaVersion") + +libraryDependencies ++= Seq( + "com.typesafe.akka" %% "akka-persistence-tck" % "2.8.0" +).map(_.cross(CrossVersion.for3Use2_13)) diff --git a/sbt-test/scala2-compat/i19421/test b/sbt-test/scala2-compat/i19421/test new file mode 100644 index 000000000000..fb936bd5ecaf --- /dev/null +++ b/sbt-test/scala2-compat/i19421/test @@ -0,0 +1,3 @@ +> compile +> clean +> compile