Skip to content

Commit f631fc3

Browse files
committed
Try to load but not enter case accessors fields in Scala2Unpickler
1 parent 8d34be7 commit f631fc3

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala

+3-13
Original file line numberDiff line numberDiff line change
@@ -449,18 +449,6 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
449449
// skip this member
450450
return NoSymbol
451451

452-
if flags.isAllOf(CaseAccessor | PrivateLocal, butNot = Method)
453-
// If akka.actor.Terminated.actor is not loaded, we get "no member new scala.beans.BeanProperty . <init>".
454-
// ```
455-
// final case class Terminated private[akka] (@BeanProperty actor: ActorRef)(
456-
// @BeanProperty val existenceConfirmed: Boolean,
457-
// @BeanProperty val addressTerminated: Boolean)
458-
// ```
459-
&& !(owner.fullName.toString() == "akka.actor.Terminated" && name.toString == "actor ")
460-
then
461-
// We discard the private val representing a case accessor. We only load the case accessor def.
462-
return NoSymbol
463-
464452
// Adapt the flags of getters so they become like vals/vars instead.
465453
// The info of this symbol is adapted in the `LocalUnpickler`.
466454
if flags.isAllOf(Method | Accessor) && !name.toString().endsWith("_$eq") then
@@ -544,7 +532,9 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
544532
// parameter unpickling and try to emulate it.
545533
!completer.areParamsInitialized
546534
case _ =>
547-
true)
535+
true) &&
536+
// We discard the private val representing a case accessor. We only enter the case accessor def.
537+
!flags.isAllOf(CaseAccessor | PrivateLocal, butNot = Method)
548538

549539
if (canEnter)
550540
owner.asClass.enter(sym, symScope(owner))

0 commit comments

Comments
 (0)