@@ -168,6 +168,13 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
168
168
/** A mapping from method types to the parameters used in constructing them */
169
169
private val paramsOfMethodType = new java.util.IdentityHashMap [MethodType , List [Symbol ]]
170
170
171
+ /** Set of var param accessors that need to become case accessors */
172
+ private val paramAccessorNeedsCaseAccessor = mutable.Map .empty[ClassSymbol , mutable.Set [Name ]]
173
+
174
+ /** If a var param accessors that need to become case accessors */
175
+ private def paramAccessorNeedsCaseAccessor (owner : ClassSymbol , name : Name ): Boolean =
176
+ paramAccessorNeedsCaseAccessor.get(owner).exists(_.contains(name))
177
+
171
178
protected def errorBadSignature (msg : String , original : Option [RuntimeException ] = None )(using Context ): Nothing = {
172
179
val ex = new BadSignature (
173
180
i """ error reading Scala signature of $classRoot from $source:
@@ -462,6 +469,14 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
462
469
flags &~= Method | Accessor
463
470
if ! flags.is(StableRealizable ) then flags |= Mutable
464
471
472
+ // Skip case accessor `<xyz>$access$<idx>` and keep track of their name to make `<xyz>` the case accessor
473
+ if flags.is(CaseAccessor ) && name.toString().contains(" $access$" ) then
474
+ val accessorName = name.toString().split('$' ).head.toTermName
475
+ paramAccessorNeedsCaseAccessor
476
+ .getOrElseUpdate(owner.asClass, mutable.Set .empty)
477
+ .+= (accessorName)
478
+ return NoSymbol // skip this member
479
+
465
480
name = name.adjustIfModuleClass(flags)
466
481
if (flags.is(Method ))
467
482
name =
@@ -632,6 +647,11 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
632
647
// This is the `def` of an accessor that needs to be transformed into
633
648
// a `val`/`var`. Note that the `Method | Accessor` flags were already
634
649
// striped away in `readDisambiguatedSymbol`.
650
+ //
651
+ // If there was a `<xyz>$access$<idx>` case accessor, we also need to
652
+ // make this accessor a case accessor.
653
+ if paramAccessorNeedsCaseAccessor(denot.owner.asClass, denot.name) then
654
+ denot.setFlag(CaseAccessor )
635
655
resultType
636
656
case tp1 => tp1
637
657
denot.info =
0 commit comments