@@ -168,6 +168,9 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
168168 /** A mapping from method types to the parameters used in constructing them */
169169 private val paramsOfMethodType = new java.util.IdentityHashMap [MethodType , List [Symbol ]]
170170
171+ /** Set of var param accessors that need to become case accessors */
172+ private val paramAccessorNeedsCaseAccessor = mutable.Set .empty[Name ]
173+
171174 protected def errorBadSignature (msg : String , original : Option [RuntimeException ] = None )(using Context ): Nothing = {
172175 val ex = new BadSignature (
173176 i """ error reading Scala signature of $classRoot from $source:
@@ -462,6 +465,12 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
462465 flags &~= Method | Accessor
463466 if ! flags.is(StableRealizable ) then flags |= Mutable
464467
468+ // Skip case accessor `<xyz>$access$<idx>` and keep track of their name to make `<xyz>` the case accessor
469+ if flags.is(CaseAccessor ) && name.toString().contains(" $access$" ) then
470+ val accessorName = name.toString().split('$' ).head
471+ paramAccessorNeedsCaseAccessor += accessorName.toTermName
472+ return NoSymbol // skip this member
473+
465474 name = name.adjustIfModuleClass(flags)
466475 if (flags.is(Method ))
467476 name =
@@ -632,6 +641,11 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
632641 // This is the `def` of an accessor that needs to be transformed into
633642 // a `val`/`var`. Note that the `Method | Accessor` flags were already
634643 // striped away in `readDisambiguatedSymbol`.
644+ //
645+ // If there was a `<xyz>$access$<idx>` case accessor, we also need to
646+ // make this accessor a case accessor.
647+ if paramAccessorNeedsCaseAccessor(denot.name) then
648+ denot.setFlag(CaseAccessor )
635649 resultType
636650 case tp1 => tp1
637651 denot.info =
0 commit comments